locate: skip per-store limits for requests without a store - #2068
wjhuang2016 wants to merge 1 commit into
Conversation
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe request path now skips per-store token handling for TiDB endpoints without a backing store. A test validates routing and responses across three store-limit values. ChangesTiDB endpoint request handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The TiDB request path avoids the prior nil-store failure while retaining limits for backed stores. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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 |
|
@coderabbitai[bot]: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this: 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 kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: coderabbitai[bot] 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 |
What problem does this PR solve?
Issue Number: ref pingcap/tidb#57829
With
tidb_store_limitenabled, querying TiDB cluster information-schema tables can panic ingetStoreToken. These coprocessor requests use a TiDB endpoint, for whichgetRPCContextintentionally returns an address without a backingStore. The synchronous send path nevertheless dereferences that missing store to acquire a per-store token.What changed and how does it work?
Apply the per-store token limit only when the RPC context has a store. Requests to TiDB endpoints continue to the RPC client without acquiring or releasing a store token. TiKV/TiFlash contexts with stores retain the existing limit and release behavior. This matches the existing no-store handling in
acquireRequestAttemptTokenand does not change public APIs.Add a regression sending TiDB coprocessor requests with limits 0, 1, and 10, checking that the response is returned and the RPC context has no store. The positive-limit cases panic before the fix; the zero-limit control succeeds.
Tests
go test -tags=intest ./internal/locate -run '^TestRegionRequestToSingleStore$/^TestTiDBRequestWithStoreLimit$' -count=1go test -tags=intest ./internal/locate -run '^TestRegionRequestToSingleStore$/(TestTiDBRequestWithStoreLimit|TestRequestAttemptLimiter|TestSendReqAsync)$' -count=1go test -race -tags=intest ./internal/locate -run '^TestRegionRequestToSingleStore$/(TestTiDBRequestWithStoreLimit|TestRequestAttemptLimiter|TestSendReqAsync)$' -count=1golangci-lint run ./internal/locate: zero issues (local v2.11.3; repository CI uses v2.8).gofmton both changed files andgit diff --check.Real TiDB/TiKV cluster queries and the full module test suite were not run locally. This PR fixes client-go; TiDB still needs to consume the updated dependency before its reported issue is fully resolved.
Release note
Fix a panic when per-store request limits are enabled for coprocessor requests sent to TiDB endpoints.
Summary by CodeRabbit
Bug Fixes
Tests