-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
bindinfo: sync concurrent ops on mysql.bind_info from multiple tidb instances #21629
Conversation
@eurekaka This side effect is unacceptable. It brings a huge impact on the stability of TiDB applications which rely on SQL binding. Could you transport the old bindings to the new table? |
How to handle the possible insert error? |
491192b
to
28a2a07
Compare
I re-implemented the locking mechanism by introducing a builtin row into |
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
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
@Reminiscent, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: planner(slack). |
@eurekaka Please help merge. Thanks! |
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
/merge |
/run-all-tests |
cherry pick to release-4.0 in PR #21868 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
What problem does this PR solve?
Issue Number: close #21516
Problem Summary:
Inconsistency between binding cache and
mysql.bind_info
if there are concurrent CREATE BINDING / DROP BINDING on multiple tidb instances.What is changed and how it works?
What's Changed:
removeBindRecord
andappendBindRecord
into a singlesetBindRecord
.mysql.bind_info
to simulate table lock.mysql.bind_info
before manipulating records in that table by updating the specific builtin row. Since we have no gap lock in TiDB, and theLOCK TABLE mysql.bind_info WRITE
is not generally available now, we useUPDATE
on a specific row to simulateLOCK TABLE
.update_time
after acquiring the "simulated table lock", instead of theStartTS
of the transaction.Update()
during the interval of transaction commit and binding cache update byh.bindInfo.Lock()
.How it Works:
The core idea of this PR is to make the operations on
mysql.bind_info
atomic, i.e, the steps should not be interrupted by another transaction from another tidb instance.Related changes
Check List
Tests
Side effects
mysql.bind_info
, otherwise the locking mechanism would be broken.Release note
mysql.bind_info
from multiple tidb instances