Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe syncer reset path now resizes worker timestamp storage and recreates downstream DML connections when ChangesWorker-count resume handling
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: High Sequence Diagram(s)sequenceDiagram
participant Syncer
participant createDMLDBs
participant DownstreamDB
Syncer->>Syncer: reset worker timestamp array
Syncer->>createDMLDBs: create replacement pool
createDMLDBs->>DownstreamDB: create WorkerCount connections
DownstreamDB-->>createDMLDBs: pool or error
createDMLDBs-->>Syncer: new pool
Syncer->>DownstreamDB: close old pool after success
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The worker-count resume path safely resizes worker state and replaces downstream connections without establishing a concrete merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. A rabbit sees the workers grow 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (57.4519%) 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 #12861 +/- ##
================================================
+ Coverage 50.6546% 57.4519% +6.7973%
================================================
Files 213 525 +312
Lines 17720 69700 +51980
================================================
+ Hits 8976 40044 +31068
- Misses 8178 26742 +18564
- Partials 566 2914 +2348 🚀 New features to boost your workflow:
|
1824057 to
27332e7
Compare
Syncer.Update accepts a new worker-count, and the resumed DML workers use it to index the job timestamp slots and the downstream connections. Both were sized only when the syncer was created, so raising worker-count made dm-worker panic with index out of range after the task resumed. Resize the job timestamp slots when resetting the syncer, and recreate the DML connections when their number differs from worker-count. The old connections are kept if creating the new ones fails, so resuming can retry. The connection setup is shared with createDBs through createDMLDBs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
27332e7 to
0f762a6
Compare
What problem does this PR solve?
Issue Number: close #12813
Syncer.CheckCanUpdateCfgandSyncer.Updateaccept a newworker-countwhen foreign key causality is not in use, which is the default. After the task resumes, the DML workers use the new count, buts.workerJobTSArrayands.toDBConnskeep the size they had when the syncer was created. Raisingworker-countmakes queues beyond the old count index out of range, and dm-worker panics.What is changed and how it works?
worker-countis one of the fields the update path is intended to support, so this PR makes the change take effect instead of rejecting it:Syncer.resetresizesworkerJobTSArraytoWorkerCount + workerJobTSArrayInitSizewhen the size differs.resetruns after all goroutines of the previousRunhave exited, which are the only readers of the slice.resetDBsresets the DML connections through a newresetDMLDBs. When the number of connections differs fromWorkerCount, it creates a new downstream pool withWorkerCountconnections and closes the old pool only after the new connections are ready. If creating them fails, the old pool is kept and resuming can retry.The existing guard that rejects changing
worker-countwhen foreign key causality is in use is not changed.Check List
Tests
TestResetAfterWorkerCountUpdateResizesJobTSArray: increases, decreases, then increasesworker-counton the same syncer, and checks that every new DML queue can update its timestamp slot. Fails on master.TestResetDMLDBsAfterWorkerCountUpdate: checks that the DML connections are recreated with the new count, and that a failed recreation keeps the old pool. Fails on master.go test ./dm/syncer/...passes with failpoints enabled.Questions
Will it cause performance regression or break compatibility?
No. Connections are recreated only when
worker-countchanged.Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Tests