Akka.Persistence.MongoDB
Akka.Persistence.MongoDB copied to clipboard
Fix journal and snapshot write atomicity
Two issues are addressed:
- Right now, all write operations were done under transactions, if write transaction feature flag is turned on. But according to the MongoDb documentation, single document write or updates are already atomic and does not need to be enclosed inside a transaction.
- Right now, when we do a bulk atomic write
WriteMessagesAsync(), we're atomically writing each collection payload under separate transactions, which is wrong, the correct way is to cover all of the writes under a single transaction so that they can be written atomically.
Changes
- Add non-transactioned single document write optimization to snapshot store and journal
- Refactor
WriteMessagesAsync()to use a single transaction for its entire bulk write operation.