-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: lock unchanged rows for pessimistic transaction #14045
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14045 +/- ##
===============================================
- Coverage 80.4293% 80.1644% -0.265%
===============================================
Files 482 482
Lines 122367 120904 -1463
===============================================
- Hits 98419 96922 -1497
- Misses 16219 16246 +27
- Partials 7729 7736 +7 |
tk.MustExec("update unchanged set c = 1 where id < 2") | ||
|
||
tk2.MustExec("begin pessimistic") | ||
err := tk2.ExecToErr("select * from unchanged where id = 1 for update nowait") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does the lock time out, would it block the CI ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it returns an error instantly.
Mostly LGTM |
LGTM |
@jackysp PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
cherry pick to release-3.0 in PR #14049 |
What problem does this PR solve?
The pessimistic lock is not acquired if a row is unchanged.
What is changed and how it works?
Add the unchanged row key to TxnCtx, later collect them before calling LockKeys.
Check List
Tests
Related changes
Release note