-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q: How multiple Doc
s guarantee transactions?
#612
Comments
ShareDB unfortunately has no concept of "transactions", and instead relies on everything eventually converging on a final state. The exact method of how to deal with the lack of transactions depends on your particular use-case. One possible approach is to do something like:
Note that with this approach, remote clients will still see the intermediate state, and the intermediate state is still committed to the DB. If you're allowing historic snapshot fetches, this also means you can fetch an invalid state. It depends on what aspect(s) of transactions you care about:
If you care about the atomicity, your only option at the moment is to use a single document, or submit a PR to add support for multi-document transactions. |
I've been looking into https://redis.com/glossary/redlock/ as a way to introduce a mutex around critical sections that should only be touched by one client at a time. Also, OT operations are designed to support multiple simultaneous edits and converge to a final state. Problems do arise, though, if you use a diff operation from a previous version of the doc to figure out what the ops should be. Some ops are totally robust to simultaneous edits, such as the number add operation. |
We have an operation that needs to operate on multiple
Doc
s at the same time in one loop.Will
ShareDB
guarantee the final consistency of the transaction?If not, how should I proceed?
PS : we are using
MySql
adapterThe text was updated successfully, but these errors were encountered: