Unique constraint violations are not propagated
tomhreb opened this issue · 3 comments
Hi,
if I define unique constraint and that constraint is violated, the exception is not propagated to the actor.
The issue is probably in the exception handling code -
Steps to repro:
Define a unique constraint on a property of your actor state model
Create multiple actors & save the state
-> duplicate actor does not receive any exception for WriteStateAsync()
I'll investigate further and possibly create a fix PR.
Tomas
What is a unique constraint in Orleans? AFAIK storages are just key-value stores
There's no such thing as unique constraint in Orleans, I meant MongoDB
{
"v" : 2,
"key" : {
"_doc.Entity.Id" : 1
},
"name" : "_doc.Entity.Id_1",
"unique" : true
}
The exception is used to detect concurrent updates. If you want to have your behavior, you have to change the exception handling so that it only handles unique constraint exceptions on the _id index. But you should provide a PR for that. Everything works as intended