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: replace priorityCheck ResetLeader with TransferPrimary #8597

Merged
merged 5 commits into from
Sep 9, 2024

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Sep 5, 2024

What problem does this PR solve?

The issue detail process is #8533 (comment)

tso's priority uses ResetLeader instead of moveLeader.
The process is:

  • secondary: primary check priority -> resetLeader -> secondary exit watch -> secondary enter campaign -> secondary select new leader
  • primary: primary check priority -> resetLeader -> (need 200ms tick)[time gap] primary finds out there is not primary -> exit campaign -> primary enter campaign

Secondary can be elected as new primary because of time gap which is not stable!!!

For example, if the secondary io jitters and doesn't elected as new primary, the old primary will be elected, and then it will loop through the priority check logic again.

Issue Number: Close #8533

What is changed and how does it work?

  • Because transfer primary is actually as move etcd leader.
  • So replace ResetLeader with transfer primary, which is more time efficient and can avoid time lag.

Check List

Tests

  • Integration test
  • Manual test (add detailed scripts or steps below)

Release note

tso: replace priorityCheck ResetLeader with TransferPrimary

Signed-off-by: husharp <[email protected]>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 5, 2024
Signed-off-by: husharp <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Sep 5, 2024
Signed-off-by: husharp <[email protected]>
@HuSharp HuSharp changed the title tso: replace tso priority with transfer primary tso: replace priorityCheck ResetLeader with TransferPrimary Sep 5, 2024
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 55.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 77.56%. Comparing base (98e0407) to head (fd70e06).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8597      +/-   ##
==========================================
- Coverage   77.60%   77.56%   -0.04%     
==========================================
  Files         474      474              
  Lines       61864    61879      +15     
==========================================
- Hits        48007    47994      -13     
- Misses      10317    10343      +26     
- Partials     3540     3542       +2     
Flag Coverage Δ
unittests 77.56% <55.00%> (-0.04%) ⬇️

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

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 6, 2024
Signed-off-by: husharp <[email protected]>
@ti-chi-bot ti-chi-bot bot added the lgtm label Sep 9, 2024
Copy link
Contributor

ti-chi-bot bot commented Sep 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lhy1024, rleungx

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 9, 2024
Copy link
Contributor

ti-chi-bot bot commented Sep 9, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-06 05:44:32.980891241 +0000 UTC m=+595997.498944161: ☑️ agreed by lhy1024.
  • 2024-09-09 06:52:10.054474092 +0000 UTC m=+252799.794898023: ☑️ agreed by rleungx.

@ti-chi-bot ti-chi-bot bot merged commit 8733b55 into tikv:master Sep 9, 2024
23 of 25 checks passed
@HuSharp HuSharp deleted the refine_tso_priority branch September 9, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestGetTSOImmediately is flaky
3 participants