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) #2666

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #2665 to release-4.0


Signed-off-by: JmPotato [email protected]

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.

@ti-srebot ti-srebot added contribution This PR is from a community contributor. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/cherry-pick labels Jul 20, 2020
@ti-srebot ti-srebot added this to the v4.0.4 milestone Jul 20, 2020
@ti-srebot ti-srebot self-assigned this Jul 20, 2020
@ti-srebot ti-srebot added status/LGT1 Indicates that a PR has LGTM 1. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jul 20, 2020
@codecov-commenter
Copy link

Codecov Report

Merging #2666 into release-4.0 will decrease coverage by 0.03%.
The diff coverage is 75.45%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release-4.0    #2666      +/-   ##
===============================================
- Coverage        77.16%   77.13%   -0.04%     
===============================================
  Files              204      205       +1     
  Lines            21940    22207     +267     
===============================================
+ Hits             16931    17130     +199     
- Misses            3724     3768      +44     
- Partials          1285     1309      +24     
Impacted Files Coverage Δ
server/api/operator.go 45.40% <ø> (ø)
server/schedule/scheduler.go 69.76% <0.00%> (ø)
server/statistics/store_collection.go 59.70% <ø> (+0.44%) ⬆️
server/util.go 46.91% <0.00%> (-3.09%) ⬇️
server/schedule/operator/step.go 65.40% <41.17%> (-9.78%) ⬇️
server/cluster/store_limiter.go 53.70% <46.15%> (ø)
server/server.go 75.41% <53.84%> (-1.08%) ⬇️
server/api/store.go 66.32% <58.62%> (+0.98%) ⬆️
server/config/config.go 77.30% <62.50%> (-1.62%) ⬇️
server/tso/tso.go 75.69% <66.66%> (-4.60%) ⬇️
... and 50 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc1d384...440b91d. Read the comment docs.

@ti-srebot
Copy link
Contributor Author

@JmPotato,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: scheduling(slack).

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 20, 2020
@disksing
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor Author

Sorry @disksing, you don't have permission to trigger auto merge event on this branch.
The version releasement is in progress.

Copy link
Member

@HunDunDM HunDunDM left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jul 21, 2020
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added status/LGT4 The PR has already had 4 LGTM. and removed status/LGT3 The PR has already had 3 LGTM. labels Jul 21, 2020
@jebter
Copy link
Collaborator

jebter commented Jul 21, 2020

/run-integration-common-test

@jebter
Copy link
Collaborator

jebter commented Jul 21, 2020

/run-integration-compatibility-test

@jebter
Copy link
Collaborator

jebter commented Jul 21, 2020

/run-integration-ddl-test

@jebter
Copy link
Collaborator

jebter commented Jul 21, 2020

/merge

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

/run-all-tests

@ti-srebot ti-srebot merged commit 096ab27 into tikv:release-4.0 Jul 21, 2020
@disksing disksing deleted the release-4.0-082217c47f16 branch July 21, 2020 11:46
@disksing disksing modified the milestones: v4.0.4, v4.0.5 Jul 28, 2020
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. status/can-merge Indicates a PR has been approved by a committer. status/LGT4 The PR has already had 4 LGTM. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants