maintainer: prevent stale spans from reentering scheduler state - #6073
maintainer: prevent stale spans from reentering scheduler state#6073wk989898 wants to merge 2 commits into
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 |
|
Warning Review limit reachedNext included review available in 42 minutes. View limit detailsLimit details: You’ve used the included review 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: Pro Plus Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change prevents stale terminal statuses from marking reassigned or removed spans absent. It adds ownership-aware span-controller APIs and regression coverage for reassignment, removal, move, and split scenarios. ChangesSpan absence guard
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR prevents stale span state from being reintroduced during dispatcher split or move races, reducing the chance of stalled checkpoint progress; no actionable merge-blocking risk remains, so it is merge-ready after normal checks. Sequence Diagram(s)sequenceDiagram
participant MaintainerController
participant SpanController
participant Scheduler
MaintainerController->>SpanController: MarkSpanAbsentIfCurrent(span, reportingNode)
SpanController->>SpanController: Validate current task and node ownership
alt Span remains current on reportingNode
SpanController->>Scheduler: Trigger rescheduling
else Span was removed or reassigned
SpanController-->>MaintainerController: Return false
end
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
/test all |
|
/test pull-cdc-mysql-integration-heavy |
2 similar comments
|
/test pull-cdc-mysql-integration-heavy |
|
/test pull-cdc-mysql-integration-heavy |
What problem does this PR solve?
Issue Number: close #6072
What is changed and how it works?
This PR prevents a stale SpanReplication from being reintroduced into the scheduler’s Absent set after it has already been removed, replaced, or rebound to another node.
Previously, terminal dispatcher status handling performed the following operations separately:
A concurrent split could call ReplaceReplicaSet between these operations. The split removed the old span and created its replacement spans, but the terminal-status handler still held a pointer to the old span. Because MarkSpanAbsent did not verify that the span was still part of the controller’s desired state, it inserted the obsolete span into the scheduler’s Absent set.
This created a ghost Absent span: the scheduler repeatedly tried to create an Add operator for a dispatcher that no longer existed in the span controller, resulting in continuous add operator failed, span not found errors and a stalled checkpoint.
This PR makes the transition safe in two ways:
MarkSpanAbsent now checks, while holding the span controller mutex, that the dispatcher ID is still registered in allTasks and that the registered value is the exact same SpanReplication instance. If the span has already been removed or replaced, the operation returns without changing scheduler or checkpoint-tracker state.
The terminal-status fallback uses MarkSpanAbsentIfCurrent, which additionally verifies under the same lock that the span is still bound to the node that reported the terminal status. This prevents a delayed Stopped status from an old owner from marking a span Absent after it has already been moved to another node.
ReplaceReplicaSet and the new validation use the same span controller mutex. Therefore, removal/replacement and the Absent transition now have a deterministic order:
ReplaceReplicaSet first
-> old span is no longer the current task
-> MarkSpanAbsent is skipped
MarkSpanAbsent first
-> the span is still current and owned by the reporting node
-> the valid Absent transition completes
The terminal-status warning is now emitted only when the span is actually transitioned to Absent. Stale terminal statuses that lose the atomic validation are ignored without producing a misleading state-change log.
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note
Summary by CodeRabbit