Skip to content

server, client: expose store scheduling state in GetStore#11041

Draft
LykxSassinator wants to merge 3 commits into
tikv:masterfrom
LykxSassinator:issue-2012-expose-store-scheduling-state
Draft

server, client: expose store scheduling state in GetStore#11041
LykxSassinator wants to merge 3 commits into
tikv:masterfrom
LykxSassinator:issue-2012-expose-store-scheduling-state

Conversation

@LykxSassinator

@LykxSassinator LykxSassinator commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: Ref tikv/client-go#2012

PD owns the slow-store eviction and recovery-time policy, but the existing
GetStore path only exposes metapb.Store and drops fields carried by the
full GetStoreResponse. Consequently, downstream clients cannot distinguish a
locally recovered Store from one that PD still keeps evicted as slow.

This PR exposes PD's scheduling decision through GetStoreResponse, enabling
client-go proposal 3 to keep non-leader replica reads excluded until PD
explicitly re-admits the Store.

Depends on pingcap/kvproto#1503.

What is changed and how does it work?

  • PD leader's GetStore response now populates
    StoreSchedulingState.evicted_as_slow_store from
    core.StoreInfo.EvictedAsSlowStore().
  • Adds optional pd.RPCClientExt.GetStoreResponse, which returns the complete
    protobuf response while keeping the existing RPCClient and
    Client.GetStore APIs source-compatible.
  • Keeps GetStore behavior unchanged by implementing it on top of
    GetStoreResponse and retaining existing response validation.
  • Router responses deliberately leave SchedulingState unset: Router's
    metadata cache does not retain PD leader's dynamic scheduling decision, and
    reporting a default false value would incorrectly imply that the Store is
    eligible.
  • Adds coverage for PD leader state exposure and Router's unknown semantics.

The kvproto dependency is temporarily replaced with the branch for PR #1503.
The replacement should be removed and dependencies tidied after that PR merges.

Check List

Tests

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

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

PD client now exposes Store scheduling state in the full GetStore response so
clients can honor PD slow-store recovery decisions.

Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
@ti-chi-bot

ti-chi-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the dco. labels Jul 23, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 23, 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 binshi-bing 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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f7c7235-11fd-438c-b918-32c915b4ea14

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 23, 2026
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
@LykxSassinator LykxSassinator changed the title client: expose store scheduling state in GetStore server, client: expose store scheduling state in GetStore Jul 23, 2026
@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jul 23, 2026
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
@ti-chi-bot

ti-chi-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456, multiple issues should use full syntax for each issue and be separated by a comma, like: Issue Number: close #123, ref #456.

📖 For more info, you can check the "Linking issues" section in the CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/needs-linked-issue do-not-merge/needs-triage-completed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

1 participant