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 corner case that may cause TSO fallback (#4885) #4892

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #4885

Signed-off-by: JmPotato [email protected]

What problem does this PR solve?

Issue Number: Close #4884.

This bug will occur when the following conditions are met:

  1. PD-0 resigns the leader.
  2. PD-0 updates the TSO right after resetting it concurrently and leaves the non-empty TSO in memory.
  3. PD-0 becomes the leader again.
  4. PD-0 receives a TSO request after the leadership is available and before the TSO synchronization is done.
  5. A smaller TSO will be generated with this request.
  6. BOOM!!!

What is changed and how does it work?

tso: fix the corner case that may cause TSO fallback

Do not update the TSO in memory if it's zero.

Check List

Tests

  • Unit test
  • Integration test

Release note

Fix the corner case that may cause TSO fallback.

@ti-chi-bot
Copy link
Member Author

ti-chi-bot commented May 6, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • lhy1024

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/cherry-pick-not-approved labels May 6, 2022
@ti-chi-bot ti-chi-bot added component/tso Timestamp Oracle. type/cherry-pick-for-release-5.4 This PR is cherry-picked to release-5.4 from a source PR. labels May 6, 2022
@JmPotato
Copy link
Member

JmPotato commented May 6, 2022

Close since we don't cherry-pick PR for 5.4 anymore.

@JmPotato JmPotato closed this May 6, 2022
@nolouch nolouch reopened this May 25, 2022
@nolouch
Copy link
Contributor

nolouch commented May 25, 2022

why 5.4 no need to cherry-pick?

@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jun 13, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 13, 2022
Signed-off-by: JmPotato <[email protected]>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 13, 2022
@JmPotato
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member Author

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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.

@ti-chi-bot
Copy link
Member Author

This pull request has been accepted and is ready to merge.

Commit hash: b519e15

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 13, 2022
@ti-chi-bot
Copy link
Member Author

@ti-chi-bot: 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.

@codecov
Copy link

codecov bot commented Jun 13, 2022

Codecov Report

Merging #4892 (0baaab6) into release-5.4 (273fe3d) will increase coverage by 0.13%.
The diff coverage is 75.00%.

@@               Coverage Diff               @@
##           release-5.4    #4892      +/-   ##
===============================================
+ Coverage        74.69%   74.83%   +0.13%     
===============================================
  Files              265      265              
  Lines            27964    27969       +5     
===============================================
+ Hits             20889    20930      +41     
+ Misses            5204     5184      -20     
+ Partials          1871     1855      -16     
Flag Coverage Δ
unittests 74.83% <75.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/server.go 71.68% <50.00%> (-0.18%) ⬇️
server/tso/tso.go 71.91% <100.00%> (+7.13%) ⬆️
server/region_syncer/server.go 81.41% <0.00%> (-5.13%) ⬇️
server/schedule/operator_controller.go 83.02% <0.00%> (-1.23%) ⬇️
server/election/leadership.go 77.31% <0.00%> (-1.04%) ⬇️
server/cluster/cluster.go 82.62% <0.00%> (-0.81%) ⬇️
server/core/storage.go 69.31% <0.00%> (-0.76%) ⬇️
client/client.go 72.83% <0.00%> (+0.10%) ⬆️
server/grpc_service.go 52.36% <0.00%> (+0.77%) ⬆️
... and 9 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 273fe3d...0baaab6. Read the comment docs.

@ti-chi-bot ti-chi-bot merged commit 5b2ea10 into tikv:release-5.4 Jun 13, 2022
@purelind purelind added this to the v5.4.2 milestone Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. component/tso Timestamp Oracle. release-note Denotes a PR that will be considered when it comes time to generate release notes. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-5.4 This PR is cherry-picked to release-5.4 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants