-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage/mysql: always write leaves to Unsequenced in hash order (#408)
If distinct multi-row write operations for the Unsequenced table (i.e. SequenceBatch, QueueLeaves) use arbitrary ordering, the chances of DB database deadlock are increased. AIUI each write will lock a range of index values to preserve primary key uniqueness, roughly [prev-existing-hash, new-hash]. So one multiple row update might lock (say) BCD then LMN then WXYZ. Meanwhile, a different transaction might try to lock UVW then DEF. This gives a chance of deadlock: 1) gets BCD and LMN 2) gets UVW 1) tries to get WXYZ and needs to wait for 2) 2) tries to get DEF and needs to wait for 1).
- Loading branch information
1 parent
363cc33
commit e104d60
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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