tso: avoid blocking split finish state reads#10931
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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesSplit-finish lock contention refactor
Sequence Diagram(s)sequenceDiagram
participant Caller
participant finishSplitKeyspaceGroup
participant getFinishSplitRequest
participant completeFinishSplitKeyspaceGroup
participant PDServer as PD HTTP Server
Caller->>finishSplitKeyspaceGroup: invoke
finishSplitKeyspaceGroup->>finishSplitKeyspaceGroup: lock finishSplitMu
finishSplitKeyspaceGroup->>getFinishSplitRequest: kgm.RLock, validate split target & httpClient
getFinishSplitRequest-->>finishSplitKeyspaceGroup: (client, url, ok) then kgm.RUnlock
note over finishSplitKeyspaceGroup,PDServer: kgm.Lock NOT held during HTTP call
finishSplitKeyspaceGroup->>PDServer: HTTP DELETE /split
PDServer-->>finishSplitKeyspaceGroup: response
finishSplitKeyspaceGroup->>completeFinishSplitKeyspaceGroup: kgm.Lock, replace kgs[id], clear SplitState
completeFinishSplitKeyspaceGroup-->>finishSplitKeyspaceGroup: kgm.Unlock
finishSplitKeyspaceGroup->>finishSplitKeyspaceGroup: unlock finishSplitMu
finishSplitKeyspaceGroup-->>Caller: return nil
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Avoid holding the keyspace group manager lock while waiting for the finish split HTTP request. Use a dedicated mutex to serialize split finish requests, preserving the previous single-request semantics without blocking state readers. Signed-off-by: Ryan Leung <rleungx@gmail.com>
bd7e856 to
8d35157
Compare
|
/test pull-unit-test-next-gen-2 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #10931 +/- ##
==========================================
+ Coverage 79.15% 79.22% +0.06%
==========================================
Files 540 540
Lines 74801 74813 +12
==========================================
+ Hits 59212 59268 +56
+ Misses 11405 11366 -39
+ Partials 4184 4179 -5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@rleungx: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: ref #9842
finishSplitKeyspaceGroupheld the keyspace group manager lock while sending the finish split HTTP request. If the request was blocked or slow, readers such asFindGroupByKeyspaceIDcould not acquireRLock, which could make TSO split election checks time out.What is changed and how does it work?
Check List
Tests
Release note
Summary by CodeRabbit
Refactor
Tests