Skip to content
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

Handle concurrency issues better in specify #5337

Open
realVinayak opened this issue Oct 21, 2024 · 0 comments
Open

Handle concurrency issues better in specify #5337

realVinayak opened this issue Oct 21, 2024 · 0 comments
Labels
1 - Bug Incorrect behavior of the product

Comments

@realVinayak
Copy link
Collaborator

realVinayak commented Oct 21, 2024

A copy-paste of issue: https://github.com/specify/specify-development/issues/19

  1. Workbench performs everything in a transaction. If this was alone by itself, this wouldn't have caused an issue.
  2. Subtle concurrency issues with trees can issues. For instance, workbench if uploads trees, then it causes issues with tree actions which involve node numbering (because we end up doing a select * where nodenumber = whatever for update, but since node numbers aren't indexed, it implictly locks all rows (this is still not a full table lock)
  3. If you make collection objects via the form, when workbench is uploading to collection objects, then autonumbering causes a write lock on collectionobject, collection, and other tables. This is very bad. form's lock is delayed by workbench, so form save doesn't happen (gets timed out). Plus, no body is able to use specify because a simple '/specify/' request causes a read request from collection table (which waits for the write request from collection from form to be granted)

See #5047.

Some raw ideas:

Make this accept two args: one for read and one for writes.

def lock_tables(*tables):

Make this return 2 sets, one for read and one for writes. Repetition isn't allowed, so if a table is in both, elevate it to a write (just remove it from read). Put all the discipline, collection, and uniqueness rule tables, and the scope_table in the read set (basically, everything we know we won't write to)

def get_tables_to_lock(collection, obj, field_names) -> Set[str]:

@realVinayak realVinayak added the 1 - Bug Incorrect behavior of the product label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product
Projects
None yet
Development

No branches or pull requests

1 participant