Skip to content

pdms: use evict API for TSO primary transfer - #7022

Open
bufferflies wants to merge 1 commit into
pingcap:masterfrom
bufferflies:ms-evict-primary
Open

pdms: use evict API for TSO primary transfer#7022
bufferflies wants to merge 1 commit into
pingcap:masterfrom
bufferflies:ms-evict-primary

Conversation

@bufferflies

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

TSO service may have multiple keyspace groups, each with its own primary. The old transfer API only handles a single group's primary. This PR uses the new evict API (introduced in tikv/pd#10968) that transfers all keyspace group primaries from the TSO node at once.

What is changed and how does it work?

  • Add pdMSPrimaryEvictPrefix = "api/v1/primary/evict" constant
  • In TransferPrimary, for TSO service, try the evict API first (POST /tso/api/v1/primary/evict). If it succeeds, return. On failure (old PD without evict support), fall back to the old transfer API (POST /tso/api/v1/primary/transfer).
  • Non-TSO services (router, scheduler) continue to use the transfer API directly.

Code changes

  • Has Go code change

Tests

  • Unit test (existing tests pass)

Related changes

Related to tikv/pd#10968

TSO service may have multiple keyspace groups. Use the new evict API (POST /api/v1/primary/evict) to transfer all group primaries at once, falling back to the old transfer API for older PD versions.

Signed-off-by: tongjian <1045931706@qq.com>
@ti-chi-bot
ti-chi-bot Bot requested a review from shonge August 6, 2026 09:06
@ti-chi-bot

ti-chi-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign july2993 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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 added the size/S label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56bd48d8-c2a4-4765-8b8c-764ea10644ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.54%. Comparing base (a16b2e8) to head (2b19560).
⚠️ Report is 72 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7022      +/-   ##
==========================================
+ Coverage   57.19%   57.54%   +0.34%     
==========================================
  Files         259      262       +3     
  Lines       33233    38240    +5007     
==========================================
+ Hits        19008    22004    +2996     
- Misses      12291    14156    +1865     
- Partials     1934     2080     +146     
Flag Coverage Δ
unittest 57.54% <0.00%> (+0.34%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liubog2008

Copy link
Copy Markdown
Member

Add a feature gate to change current api call. Hence this api is not available for all pd versions.

@liubog2008 liubog2008 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add a new feature gate for this incompatible change

@ti-chi-bot

ti-chi-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-08-07 03:56:12.924222828 +0000 UTC m=+2759558.960317885: ✖️🔁 reset by liubog2008.

@bufferflies
bufferflies requested a review from liubog2008 August 7, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants