OrleansContrib / Orleans.Providers.MongoDB

A MongoDb implementation of the Orleans Providers: Membership, Storage and Reminders.
MIT License
100 stars 43 forks source link

UpdateIAmAlive for SingleMembership fixed to not create invalid subdocuments without required properties #135

Closed mlehoncak closed 4 months ago

mlehoncak commented 4 months ago

Current implementation of UpdateIAmAlive method for SingleMembership uses update of member qualified by its full path in document, but this update works even if there is no subdocument for given silo. It creates a new document with IAmAlive as its only property (due to some race condition in Orleans membership, when UpdateIAmAlive can be invoked before Insert/Upsert). This invalid document leads to fail for every subsequent read from table, as most of properties in document are BsonRequired.

My fix will ensure that either silo subdocument exists, and change is written, or not, and change is ignored.

wassim-k commented 4 months ago

Thanks @mlehoncak for investigating and submitting a fix 👍