-
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
table/tables: fix a corner case of renew lease operation on cached table #32643
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/c5dd83eb758529b5421d1356334b558d32ffeae7 |
@@ -52,7 +43,6 @@ type cachedTable struct { | |||
handle StateRemote | |||
totalSize int64 | |||
|
|||
lockingForRead tokenLimit |
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.
Before removing this line, the LockForRead
and RenewLease
operation may happen at the same time ... but they share the same StateRemote
handle instance for executing SQL.
That would cause DATA RACE
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 97171f8
|
/run-unit-test |
What problem does this PR solve?
Issue Number: close #32642
Problem Summary:
What is changed and how it works?
Handle the bug that after Read Locked -> Write -> Read Locked state changes, the renew lease operation success mistakenly.
Now I check
oldLocalLease != remoteLease
to see whether there is another intermediate state change, and prevent the ABA issue.This change can also reduce the conflict when there are several tidb instances handling renew lease simultaneously.
Check List
Tests
Side effects
Documentation
Release note