test PD follower fallback on stale regions#1980
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
What changed
This PR adds a RegionCache unit test for active follower fallback when PD follower responses are stale or incomplete.
The test covers three region APIs:
GetRegion: the first follower-enabled request returns a stale pre-split region. The test verifies client-go rejects it as stale, retries without follower/router options, and gets the fresh leader result.ScanRegions: the first follower-enabled request returns a stale region that cannot cover the requested range. The test verifies the gap path retries without follower/router options and gets the complete leader result.BatchScanRegions: covers the same gap fallback behavior for batch scan.Why
A normal successful request does not prove that active follower fallback worked. This regression test checks request options, retry counts, and final region IDs/ranges so the fallback path is explicitly exercised.
Tests