-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Optimistic Locking #100
Comments
There are at least two common approaches to optimistic locking I know:
The first approach is more flexible (can be used in any context), however it doesn't allow us to differentiate between errors for stale and nonexistent records. Is this that big of an issue? If we already have a record with a version, we know it existed (at least in the past). The user would have to get more info about the confict manually on abortion (like querying record with version again) What about turning locking off? Should it require special functions for saving/deleting? Given, that embedded structs can be supported, enabling/disabling could be done with wrapper types. |
yes I agree, the size of issue is depends, but I think it's not possible to differentiate
if user want to update/delete while ignoring lock, user should be able to use |
Having |
It's okay, this shouldn't break the compilation, and REL is still in unstable version (0.x.x) is due to this possible API change |
Background
Optimistic locking (or optimistic concurrency control) is a technique that allows concurrent edits on a single record (more: https://hexdocs.pm/ecto/0.9.0/Ecto.Model.OptimisticLock.html)
Implementation
LockVersion int
field.LockVersion
field whenever Update or Delete is performed to prevent operation on stale version of record. Maybe we can simply add additional where filter LockVersion=? on update or delete query.The text was updated successfully, but these errors were encountered: