-
Notifications
You must be signed in to change notification settings - Fork 40
Fix autonumbering locking with SQL named locks and Django row locking #7455
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
Open
acwhite211
wants to merge
34
commits into
main
Choose a base branch
from
issue-6490-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+386
−32
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
6fec1b6
fix autonumbering locking
acwhite211 fe388a8
Merge branch 'main' into issue-6490-1
acwhite211 ccfed12
Lint code with ESLint and Prettier
acwhite211 04512f6
Merge branch 'main' into issue-6490-1
acwhite211 d612278
Lint code with ESLint and Prettier
acwhite211 e604dec
Merge branch 'main' into issue-6490-1
acwhite211 a95ad63
Lint code with ESLint and Prettier
acwhite211 494dcd1
change autonumbering locking naming key to use db_name and table_name
acwhite211 e222a02
try row level locking with django
acwhite211 f5160aa
Add missing autonumbering tables to django model
acwhite211 411ea24
implement lock_ge_range
acwhite211 f1dddc6
add db indexes to help autonumbering range locking
acwhite211 719de2f
Merge branch 'main' into issue-6490-1
acwhite211 bc815be
fix migration after merge
acwhite211 61ddb00
Merge branch 'main' into issue-6490-1
acwhite211 359c152
add PR comment links to lock_tables warning note
acwhite211 3c2437c
remove unneeded autonum tables
acwhite211 5effe3d
remove unused function get_tables_to_lock_strict
acwhite211 a47537e
add more composite indexes for autonumbering
acwhite211 a9a5ea8
fix migration issues
acwhite211 02ab2c3
Remove duplicate invoicenumber index
acwhite211 fb28674
Remove duplicate indexes from migration
acwhite211 584cbb8
safer lock tables exception handling
acwhite211 b894bed
robust connection timeout handling
acwhite211 0ef86f7
Merge branch 'main' into issue-6490-1
acwhite211 b9fcfd3
Update and rename 0042_add_indexes_to_help_autonumbering.py to 0043_a…
acwhite211 023255b
Update 0043_add_indexes_to_help_autonumbering.py
acwhite211 8ed024e
try setting nowait for select_for_update
acwhite211 0dca315
try commenting out select_for_update
acwhite211 576a2dd
comment on select_for_update
acwhite211 1387dc6
correct do_autonumbering_old
acwhite211 a2ee789
remove lock_ge_range
acwhite211 a425131
Merge branch 'main' into issue-6490-1
acwhite211 b15343e
Lint code with ESLint and Prettier
acwhite211 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
specifyweb/specify/migrations/0043_add_indexes_to_help_autonumbering.py
acwhite211 marked this conversation as resolved.
Show resolved
Hide resolved
acwhite211 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| from django.db import migrations, models | ||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('specify', '0042_discipline_type_picklist'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| # accession, accessionnumber, division | ||
| migrations.AddIndex( | ||
| model_name='accession', | ||
| index=models.Index(fields=['division_id', 'accessionnumber'], name='DivAccessionNumberIDX'), | ||
| ), | ||
| # collectionobject, catalognumber, collection | ||
| migrations.AddIndex( | ||
| model_name='collectionobject', | ||
| index=models.Index(fields=['collectionmemberid', 'catalognumber'], name='ColCatalogNumberIDX'), | ||
| ), | ||
| # loan, discipline, loannumber | ||
| migrations.AddIndex( | ||
| model_name='loan', | ||
| index=models.Index(fields=['discipline', 'loannumber'], name='DispLoanNumberIDX'), | ||
| ), | ||
|
|
||
| # borrow, invoicenumber, null | ||
| # migrations.AddIndex( | ||
| # model_name='borrow', | ||
| # index=models.Index(fields=['invoicenumber'], name='BorrowInvoiceNumberIDX'), | ||
| # ), | ||
|
|
||
| # exchangein, exchangeinnumber, division | ||
| migrations.AddIndex( | ||
| model_name='exchangein', | ||
| index=models.Index(fields=['division', 'exchangeinnumber'], name='DivExcInNumberIDX'), | ||
| ), | ||
|
|
||
| # exchangeout, exchangeoutnumber, division | ||
| migrations.AddIndex( | ||
| model_name='exchangeout', | ||
| index=models.Index(fields=['division', 'exchangeoutnumber'], name='DivExcOutNumberIDX'), | ||
| ), | ||
|
|
||
| # collectingevent, stationfieldnumber, discipline | ||
| migrations.AddIndex( | ||
| model_name='collectingevent', | ||
| index=models.Index(fields=['discipline', 'stationfieldnumber'], name='DispStationFieldNumIDX'), | ||
| ), | ||
|
|
||
| # collection, regnumber, discipline | ||
| migrations.AddIndex( | ||
| model_name='collection', | ||
| index=models.Index(fields=['discipline', 'regnumber'], name='DispColRegNumberIDX'), | ||
| ), | ||
|
|
||
| # collector, ordernumber, division | ||
| migrations.AddIndex( | ||
| model_name='collector', | ||
| index=models.Index(fields=['division', 'ordernumber'], name='DivCollectorOrderNumIDX'), | ||
| ), | ||
|
|
||
| # discipline, regnumber, division | ||
| migrations.AddIndex( | ||
| model_name='discipline', | ||
| index=models.Index(fields=['division', 'regnumber'], name='DivDispRegNumberIDX'), | ||
| ), | ||
|
|
||
| # disposal, disposalnumber, null | ||
| # migrations.AddIndex( | ||
| # model_name='disposal', | ||
| # index=models.Index(fields=['disposalnumber'], name='DisposalNumberIDX'), | ||
| # ), | ||
|
|
||
| # division, regnumber, institution | ||
| migrations.AddIndex( | ||
| model_name='division', | ||
| index=models.Index(fields=['institution', 'regnumber'], name='InstDivRegNumberIDX'), | ||
| ), | ||
|
|
||
| # exsiccataitem, number, null | ||
| migrations.AddIndex( | ||
| model_name='exsiccataitem', | ||
| index=models.Index(fields=['number'], name='ExsiccataItemNumberIDX'), | ||
| ), | ||
|
|
||
| # fieldnotebookpage, pagenumber, discipline | ||
| migrations.AddIndex( | ||
| model_name='fieldnotebookpage', | ||
| index=models.Index(fields=['discipline', 'pagenumber'], name='DispFNBPageNumIDX'), | ||
| ), | ||
|
|
||
| # fieldnotebookpageset, ordernumber, discipline | ||
| migrations.AddIndex( | ||
| model_name='fieldnotebookpageset', | ||
| index=models.Index(fields=['discipline', 'ordernumber'], name='DispFNBPageSetNumIDX'), | ||
| ), | ||
|
|
||
| # fundingagent, ordernumber, division | ||
| migrations.AddIndex( | ||
| model_name='fundingagent', | ||
| index=models.Index(fields=['division', 'ordernumber'], name='DivFundingAgentOrderNumIDX'), | ||
| ), | ||
|
|
||
| # gift, giftnumber, discipline | ||
| migrations.AddIndex( | ||
| model_name='gift', | ||
| index=models.Index(fields=['discipline', 'giftnumber'], name='DispGiftNumberIDX'), | ||
| ), | ||
|
|
||
| # groupperson, ordernumber, division | ||
| migrations.AddIndex( | ||
| model_name='groupperson', | ||
| index=models.Index(fields=['division', 'ordernumber'], name='DivGroupPersonOrderNumIDX'), | ||
| ), | ||
|
|
||
| # permit, permitnumber, institution | ||
| migrations.AddIndex( | ||
| model_name='permit', | ||
| index=models.Index(fields=['institution', 'permitnumber'], name='InstPermitNumberIDX'), | ||
| ), | ||
|
|
||
| # referencework, librarynumber, institution | ||
| migrations.AddIndex( | ||
| model_name='referencework', | ||
| index=models.Index(fields=['institution', 'librarynumber'], name='InstRefWorkLibNumIDX'), | ||
| ), | ||
|
|
||
| # repositoryagreement, repositoryagreementnumber, division | ||
| migrations.AddIndex( | ||
| model_name='repositoryagreement', | ||
| index=models.Index(fields=['division', 'repositoryagreementnumber'], name='DivRepoAgreeNumIDX'), | ||
| ), | ||
|
|
||
| # shipment, shipmentnumber, discipline | ||
| migrations.AddIndex( | ||
| model_name='shipment', | ||
| index=models.Index(fields=['discipline', 'shipmentnumber'], name='DispShipmentNumberIDX'), | ||
| ), | ||
|
|
||
| # treatmentevent, treatmentnumber, division | ||
| migrations.AddIndex( | ||
| model_name='treatmentevent', | ||
| index=models.Index(fields=['division', 'treatmentnumber'], name='DivTreatmentNumberIDX'), | ||
| ), | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.