locate: honor PD slow-store recovery state for replica reads#2027
locate: honor PD slow-store recovery state for replica reads#2027LykxSassinator wants to merge 3 commits into
Conversation
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
|
Skipping CI for Draft Pull Request. |
|
[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 Plus 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 |
|
I considered adding
Moving the field into
The response-level field keeps the contract explicit: it is PD scheduling state for this If reducing PD leader traffic becomes a goal, the follow-up should be to replicate a versioned/freshness-aware routing-state snapshot to Router. Client-go could then accept a fresh Router response and fall back to the PD leader only when the state is absent or stale. That achieves the desired offload without conflating dynamic scheduling policy with Store metadata. |
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
What problem does this PR solve?
Replica selection currently relies on client-go's local health observations. A store can recover locally before PD's slow-store recovery-time expires, causing follower/learner/stale reads to be routed to a store that PD still evicts as slow.
Related issue: ref #2012
What is changed?
GetStoreResponse.scheduling_stateintroduced by kvproto memdb: retain old version nodes of ART to satisfy snapshot read #1503 and exposed by PD #11041.pd.RPCClientExtcapability to preserve source compatibility for existingpd.Clientimplementations and mocks.StoreHealthStatus, which only records local and TiKV-reported health observations.GetStorerefreshes because Router intentionally does not provide dynamic scheduling state.Compatibility
pd.Clientimplementation withoutRPCClientExtretain the existing replica-selection behavior.Tests
go test ./internal/locatego test ./... -run '^$'cd integration_tests && go test ./...