Conversation
UpdateSubTasks only checked the expected stage of the first subtask in the request, so a task with several sources could update the config of a running subtask. The check also passed when another operation held the task latch, because the stage was then reported as invalid. Hold the task latch while updating, require every subtask to be paused or stopped, and let the worker reject the update until the subtask has actually paused. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
[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 |
|
Warning Review limit reachedNext included review available in 37 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
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 |
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (54.0883%) is below the target coverage (60.0000%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #12862 +/- ##
================================================
+ Coverage 50.6546% 54.0883% +3.4337%
================================================
Files 213 1013 +800
Lines 17720 141818 +124098
================================================
+ Hits 8976 76707 +67731
- Misses 8178 59357 +51179
- Partials 566 5754 +5188 🚀 New features to boost your workflow:
|
|
/retest |
|
/check-issue-triage-complete |
What problem does this PR solve?
Issue Number: close #12815
Scheduler.UpdateSubTasksonly checked the expected stage ofcfgs[0], but wrote the configs of all sources to etcd. For a task with several sources, an update was accepted while a source other than the first was still running. The etcd config then diverged from the config used by the running syncer until the subtask was recreated.The check could also pass silently:
GetExpectSubTaskStagereturnsInvalidStagewhen it cannot acquire the task latch, andInvalidStage != Running.What is changed and how it works?
UpdateSubTasksholds the task latch for the whole update. If another operation on the same task holds it, the update fails withErrSchedulerLatchInUseinstead of reading a stage that is being changed.PausedorStopped.SubTask.CheckUnitCfgCanUpdatealso requires the subtask to bePaused.SubTask.Updatealready had this requirement, so the check now fails before the new config is written to etcd.The scheduler lock scope is not changed here, see #12816.
Check List
Tests
TestUpdateSubTasksChecksStageOfAllSources: a running source is rejected in either request order, a held task latch is rejected, and the update succeeds once all sources are stopped. Fails on master.TestCheckUnitCfgCanUpdateRequiresPaused: the worker check rejects every stage other thanPaused. Fails on master.go test ./dm/master/ ./dm/master/scheduler/ ./dm/worker/passes with failpoints enabled.Questions
Will it cause performance regression or break compatibility?
No performance impact. An update issued right after a stop request, before the worker has paused the subtask, is now rejected, and can be retried once the task status shows
Paused.Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
🤖 Generated with Claude Code