Skip to content
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

tso: fix the bug that TSO request may fail at the time of leader changing #2665

Merged
merged 2 commits into from
Jul 20, 2020

Conversation

JmPotato
Copy link
Member

Signed-off-by: JmPotato ghzpotato@gmail.com

Close #2663

What problem does this PR solve?

Under the current latest version of PD, TSO request may fail at the time of leader changing because SyncTimestamp is not yet completed but PD receives a TSO request at the same time.

What is changed and how it works?

Add leader lease check and try to sleep a while to wait for SyncTimestamp.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has GetRespTS method change

Related changes

Release note

Fix the bug that TSO request may fail at the time of leader changing.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
@JmPotato JmPotato added type/bugfix This PR fixes a bug. needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. labels Jul 17, 2020
@ti-srebot ti-srebot added the contribution This PR is from a community contributor. label Jul 17, 2020
@JmPotato
Copy link
Member Author

/run-all-tests

@JmPotato
Copy link
Member Author

/rebuild

Signed-off-by: JmPotato <ghzpotato@gmail.com>
@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 19, 2020
@JmPotato
Copy link
Member Author

/run-all-tests

Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, do we need to add a related test case?

@JmPotato
Copy link
Member Author

LGTM, do we need to add a related test case?

I tried to add a test case but it turned out that it's hard to simulate this situation accurately through unit test codes.

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Jul 20, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Jul 20, 2020
@JmPotato
Copy link
Member Author

@ti-srebot /merge

@ti-srebot
Copy link
Contributor

@JmPotato No command or invalid command

@lhy1024
Copy link
Contributor

lhy1024 commented Jul 20, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 20, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 082217c into tikv:master Jul 20, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

@JmPotato
Copy link
Member Author

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

@zhouqiang-cl
Copy link
Contributor

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

@you06
Copy link
Contributor

you06 commented Jul 20, 2020

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

@you06
Copy link
Contributor

you06 commented Jul 20, 2020

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

@you06
Copy link
Contributor

you06 commented Jul 20, 2020

/run-cherry-picker

ti-srebot pushed a commit to ti-srebot/pd that referenced this pull request Jul 20, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #2666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TSO request may fail at the time of leader changing
6 participants