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
causal_ts: fix issue #12498 #12573
causal_ts: fix issue #12498 #12573
Conversation
Issue Number: tikv#12498 Signed-off-by: pingyu <yuping@pingcap.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. |
/cc @BusyJay @Connor1996 |
PTAL, 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.
Test case should be added.
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
// So we observe role change to Candidate to fix this issue. | ||
// Also note that when there is only one peer, it would become leader directly. | ||
if role_change.state == StateRole::Candidate | ||
|| (ctx.region().peers.len() == 1 && role_change.state == StateRole::Leader) |
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.
if there is only one peer, it would become leader directly, and on_role_change
is called later. You would still miss calling flush()
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.
to revert 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
OK~ |
/merge |
@iosmanthus: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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 ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: b78a519
|
/run-all-tests |
/run-test |
1 similar comment
/run-test |
/run-test |
2 similar comments
/run-test |
/run-test |
/run-test |
@pingyu: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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 ti-community-infra/tichi repository. |
/run-test |
4 similar comments
/run-test |
/run-test |
/run-test |
/run-test |
close tikv#12498, ref tikv#12498 Fix issue tikv#12498 Signed-off-by: pingyu <yuping@pingcap.com> Co-authored-by: iosmanthus <dengliming@pingcap.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> Signed-off-by: joccau <zak.zhao@pingcap.com>
Issue Number: #12498
Signed-off-by: pingyu yuping@pingcap.com
What is changed and how it works?
Issue Number: Close #12498
What's Changed:
By logging timestamp of regions, we found that the observing of change from follower to leader by
on_role_change
would be later than the real role change in raft state and adjacent write commands.When this happen, the adjacent write commands would get unexpected smaller timestamp than the peer transferred from.
The following screenshot shows such a case.
The "leader transfer" indicates where the leader transfer happen. The log with "pre_propose" is the adjacent write command. "[is_leader=false]" indicates that the change of peer role have not been observed yet. "on_role_change" is the observing of peer role change.
We can see that the
ts
of "pre_propose" is smaller thants
of "on_role_change", which is just the violation of causality correctness.In this PR, we observe region role change to "Candidate" other than "Leader", to avoid the late of flush.
Related changes
pingcap/docs
/pingcap/docs-cn
:No.
No.
Check List
Tests
E2E testing, with "shuffle_leader_scheduler".
Side effects
Release note