-
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
txn: make kv pairs converted from locks invisible #42409
txn: make kv pairs converted from locks invisible #42409
Conversation
Signed-off-by: zyguan <zhongyangguan@gmail.com>
[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. |
/test unit-test |
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.
The rest LGTM.
) | ||
|
||
type visibilityChecker interface { | ||
isVisible(kv.Key) bool |
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.
The name is a bit vague. The status is 3-valued: (1)exist + visible, (2)exist + invisible, (3)absent(unknown).
It returns true iff (1) || (3).
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 about to rename it to invisible
?
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.
Sounds good. Or something like isVisibleOrUnknown
(?)
Signed-off-by: zyguan <zhongyangguan@gmail.com>
/test mysql-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: b789231
|
Signed-off-by: zyguan <zhongyangguan@gmail.com>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: d8483a8
|
/retest |
1 similar comment
/retest |
/test unit-test |
/test check-dev |
What problem does this PR solve?
Issue Number: ref #28011
Problem Summary: as described in #28011 , kv pairs converted from locks is visible to union-scan, which leads to duplicated rows (one from snapshot and the other from mem-index-reader).
What is changed and how it works?
Mark keys converted from lock as invisible and bypass those keys on read. Since this PR is only a hotfix for #28011 , it's better not to introduce extra complexity. Thus, instead of adding a new flag to client-go, an invisible key set is added to
tikvTxn
for tracking key visibility.For v6.5.0 and above, tikv/tikv#13694 is a better solution.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.