Skip to content

server/api: allow follower local region reads (#10682)#10694

Merged
ti-chi-bot[bot] merged 1 commit into
tikv:release-8.5-20251204-v8.5.4from
ti-chi-bot:cherry-pick-10682-to-release-8.5-20251204-v8.5.4
May 22, 2026
Merged

server/api: allow follower local region reads (#10682)#10694
ti-chi-bot[bot] merged 1 commit into
tikv:release-8.5-20251204-v8.5.4from
ti-chi-bot:cherry-pick-10682-to-release-8.5-20251204-v8.5.4

Conversation

@ti-chi-bot
Copy link
Copy Markdown
Member

This is an automated cherry-pick of #10682

What problem does this PR solve?

Issue Number: Close #10681

What is changed and how does it work?

Allow safe read-only region HTTP APIs to use the follower's local synced region cache when `PD-Allow-Follower-Handle: true` is set and the region syncer is running.

Keep normal redirect behavior unchanged for requests without the opt-in header, and keep follower-local handling limited to read-only region inspection paths.

Check List

Tests

  • Unit test

Code changes

Release note

PD followers can now serve read-only region HTTP APIs from their local synced region cache when explicitly requested.

Summary by CodeRabbit

  • New Features

    • Follower-synced nodes can directly serve many region read endpoints (lookups, lists/counts, topology and read stats) when a specific GET header is present, improving read availability when the leader is not serving. Region-read routes now use the follower-capable middleware.
  • Bug Fixes / Behavior

    • Certain region check endpoints still respond as unbootstrapped even with the allow header.
  • Tests

    • Added test verifying follower-served region responses and unchanged behavior for some endpoints.
  • Documentation

    • Clarified comment on a helper used for follower-local access.

Review Change Stack

@ti-chi-bot ti-chi-bot added dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5-20251204-v8.5.4 labels May 20, 2026
@ti-chi-bot
Copy link
Copy Markdown
Member Author

@okJiang This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented May 20, 2026

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

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

Review profile: CHILL

Plan: Pro

Run ID: 51bb1218-4a0c-411b-9e02-d24893c9f3f2

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 and usage tips.

@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 20, 2026
@okJiang
Copy link
Copy Markdown
Member

okJiang commented May 22, 2026

Please pull the latest base branch and resolve the cherry-pick conflicts

close tikv#10681

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: okjiang <[email protected]>
@okJiang okJiang force-pushed the cherry-pick-10682-to-release-8.5-20251204-v8.5.4 branch from 3b2ab98 to 21b8625 Compare May 22, 2026 07:40
@ti-chi-bot ti-chi-bot Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 22, 2026
@okJiang
Copy link
Copy Markdown
Member

okJiang commented May 22, 2026

/retest

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 95.34884% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.85%. Comparing base (d54de44) to head (21b8625).
⚠️ Report is 1 commits behind head on release-8.5-20251204-v8.5.4.

Additional details and impacted files
@@                       Coverage Diff                       @@
##           release-8.5-20251204-v8.5.4   #10694      +/-   ##
===============================================================
+ Coverage                        77.78%   77.85%   +0.06%     
===============================================================
  Files                              469      469              
  Lines                            63087    63108      +21     
===============================================================
+ Hits                             49075    49132      +57     
+ Misses                           10415    10379      -36     
  Partials                          3597     3597              
Flag Coverage Δ
unittests 77.85% <95.34%> (+0.06%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 22, 2026
@okJiang
Copy link
Copy Markdown
Member

okJiang commented May 22, 2026

/unhold

@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 22, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented May 22, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bufferflies, okJiang

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

The pull request process is described 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 approved label May 22, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented May 22, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-05-22 08:10:39.444987989 +0000 UTC m=+110970.085844792: ☑️ agreed by okJiang.
  • 2026-05-22 08:32:24.798403461 +0000 UTC m=+1085.305115120: ☑️ agreed by bufferflies.

@okJiang
Copy link
Copy Markdown
Member

okJiang commented May 22, 2026

/unhold

@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 22, 2026
@ti-chi-bot ti-chi-bot Bot merged commit f49fe5c into tikv:release-8.5-20251204-v8.5.4 May 22, 2026
30 of 34 checks passed
@ti-chi-bot ti-chi-bot Bot deleted the cherry-pick-10682-to-release-8.5-20251204-v8.5.4 branch May 22, 2026 08:58
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/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5-20251204-v8.5.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants