-
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
planner: do not push down lock to pointGet/bacthPointGet when selection exists #21878
Conversation
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
@you06 pointGet and batchPointGet will lock not exists index keys, this is because in MySQL if you select for update finally get an empty result it will use GapLock to prevent other transaction insert or update such field with the same value. But MySQL can let other transactions set a read lock over that gap lock. |
Lock non-exist key in point-get is reasonable, the problems comes when we use a point get for faster plan but don't actually want it locks key, eg.
Compare with Further more, a test case( |
@you06 in MySQL |
If we want to solve this problem perfectly we should introduce something like GapLock in TiDB. And that will be a big project. |
Yeah, GapLock is not in roadmap due to a great performance impact. |
@blacktear23 |
@you06: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What problem does this PR solve?
Issue Number: close #21688
Problem Summary:
What is changed and how it works?
Proposal: xxx
What's Changed:
When using selection plan with
pointGet
/batchPointGet
, #15257 will push down lock topointGet
/batchPointGet
and remove theselectLock
plan. This may wrongly lock indexes, this PR handle the invalid situation and do not push down in such cases.How it Works:
Do not push down locks when selection plan exists.
Related changes
Check List
Tests
Release note