-
Notifications
You must be signed in to change notification settings - Fork 15
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
better sync #55
Comments
Marking this as bug, as it is currently unreliable behavior for normal usage scenarios. |
Rough idea to tackle this:
Issues: |
Not sure this is a bug, after all the whole Django ORM paradigm kind of operates under the assumption of single threaded access: you get a model object instance from a Query Set, modify it by changing attributes on the instance, and then persist it using So I would rather label that an improvement. Regarding the deadlock issue, if locking is performed on a field by field basis rather than model instance basis, wouldn't that ensure that if there is no dependency cycle, then there's no possible deadlock ? Also, regarding the locking mechanism ideally we should support distributed lock solutions like Redis-based distributed locks (not all concurrent accesses might originate from the same process or even machine) |
Yes, thats a culprit of all ORMs more or less. We cannot fix that here, as it is an inherent issue with object mappers itself, but I think we should at least offer some of the measures to secure the access. I marked it as bug, since ppl might get into multi connection scenarios pretty quick by using a multi-process HTTP server, where they will see those hard to track down race conditions.
Yes field locking would solve that with proper TR in place, but imho django does not expose any field locking mechanism,
Wouldn't that already be handled by the DBMS, if it supports ACID conform transactions? |
@mobiware Changed the flag back to enhancement, bug is way too exaggerating. |
Investigate on options for better sync management.
Problem:
We only have transactions on CF updates currently, which is a rather weak sync guard and only works reliable in single access scenarios (very unlikely for any Django project). For concurrent access we have basically nothing, the sync state is undetermined and CF values are open for race conditions.
Ideas:
Django has not much to offer out of the box beside
select_for_update
regarding this. It still might be enough to get some sync management done with the help of additional lock tables. Further things to consider are single writer vs. multiple writer, optional read locks.The text was updated successfully, but these errors were encountered: