worker(dm): keep query status responsive during task operations - #12783
worker(dm): keep query status responsive during task operations#12783GMHDBJD wants to merge 1 commit into
Conversation
Avoid queuing QueryStatus behind a SourceWorker write lock held by a blocking subtask lifecycle operation. Return a concurrency-safe snapshot of the subtask name, stage, and result when the detailed worker state cannot be locked immediately. Keep the existing lifecycle serialization unchanged and add regression coverage for blocked pause, stop, delete, canceled status requests, and concurrent lifecycle operations.
|
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 |
📝 WalkthroughWalkthrough
ChangesStatus query responsiveness
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
|
@GMHDBJD: The following tests 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: close #12778
A slow or stuck subtask Pause, Stop, or Delete operation holds
SourceWorker's write lock while waiting for the current unit to exit.QueryStatusused to block on the matching read lock, so status RPCs timed out and their handlers remained queued even after their contexts were canceled.What is changed and how it works?
SourceWorkerread-lock attempt inQueryStatus.SourceWorkerwrite-lock scope so lifecycle operations, worker Stop, and relay/subtask disable operations remain serialized.Check List
Tests
go test -race ./dm/worker -run 'Test(QueryStatusDuringBlockedSubTaskOperation|CanceledQueryStatusDoesNotQueueBehindSubTaskOperation|BlockedSubTaskOperationStillSerializesLifecycleOperations|QueryStatusSourceStatusTimeout)$' -count=1go test -race ./dm/worker -run 'Test(QueryStatusDuringBlockedSubTaskOperation|CanceledQueryStatusDoesNotQueueBehindSubTaskOperation|BlockedSubTaskOperationStillSerializesLifecycleOperations)$' -count=10go test -race ./dm/worker -run 'Test(Check|CheckTaskIndependent)$' -count=1go vet ./dm/workermake fmtgit diff --checkThe full
go test ./dm/worker -count=1run encountered the existingtestServer.TestHandleSourceBoundAfterErroretcd-event timing failure. The same focused gocheck case fails unchanged onupstream/master; the new and affected tests above pass with the race detector.Questions
Will it cause performance regression or break compatibility?
No protocol compatibility break is expected. The normal detailed
QueryStatuspath is unchanged. DuringSourceWorkerwrite-lock contention,QueryStatusnow returns a lightweight subtask state snapshot instead of blocking; unit, relay, and live source details are intentionally omitted only in that fallback response.Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit