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

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #4885

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

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.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
@ti-chi-bot
Copy link
Member Author

ti-chi-bot commented May 6, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • disksing

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 do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. component/tso Timestamp Oracle. type/cherry-pick-for-release-5.0 The PR belongs to release-5.0 cherry pick. labels May 6, 2022
Signed-off-by: JmPotato <ghzpotato@gmail.com>
@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #4894 (13c6b41) into release-5.0 (bcf3615) will increase coverage by 0.20%.
The diff coverage is 75.00%.

@@               Coverage Diff               @@
##           release-5.0    #4894      +/-   ##
===============================================
+ Coverage        74.89%   75.09%   +0.20%     
===============================================
  Files              245      245              
  Lines            24447    24452       +5     
===============================================
+ Hits             18309    18363      +54     
+ Misses            4515     4482      -33     
+ Partials          1623     1607      -16     
Flag Coverage Δ
unittests 75.09% <75.00%> (+0.20%) ⬆️

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

Impacted Files Coverage Δ
server/server.go 72.71% <50.00%> (+0.27%) ⬆️
server/tso/tso.go 78.78% <100.00%> (+6.39%) ⬆️
server/schedule/operator/step.go 68.45% <0.00%> (-0.95%) ⬇️
client/client.go 72.24% <0.00%> (-0.28%) ⬇️
server/grpc_service.go 46.94% <0.00%> (-0.23%) ⬇️
server/tso/allocator_manager.go 75.24% <0.00%> (+0.16%) ⬆️
server/cluster/cluster.go 82.79% <0.00%> (+0.38%) ⬆️
server/schedule/placement/rule_manager.go 83.73% <0.00%> (+0.60%) ⬆️
server/core/storage.go 69.20% <0.00%> (+0.76%) ⬆️
... and 7 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 bcf3615...13c6b41. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 12, 2022
@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 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: 119f3a2

@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.

@JmPotato
Copy link
Member

/run-unit-tests

@ti-chi-bot ti-chi-bot merged commit 9a6dec5 into tikv:release-5.0 Jun 13, 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.0 The PR belongs to release-5.0 cherry pick.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants