Repository navigation
fix cdc resume recovery for running tasks - #26641
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Blocking lifecycle race on exact head be9ef8c:
[P1] Preserve recovery when the executor becomes Failed after the request is admitted. UpdateCDCTask now admits daemon Running -> ResumeRequested, but handling is asynchronous. Before resumeTask.Handle calls the active routine, the existing TableDetector callback can observe the persisted table error and run failTaskForPermanentTableError, which changes the in-memory executor from Running to Failed and unregisters/stops it. The handler then writes the daemon row back to Running and calls this Resume; because the new branch matches only StateRunning and the state machine has no Failed -> Resume transition, TransitionResume fails. handleTask only logs the error and does not retry or restore ResumeRequested. The terminal state is therefore daemon Running + executor Failed + uncleared table error, exactly the recovery command this PR is meant to make reliable.
Please make table-error recovery close both reachable states without converting it to reset-watermark restart semantics, and do not publish daemon Running before recovery succeeds (or restore/retry the request on failure). Add a deterministic barrier test for Running request admission -> TableDetector SetFailed -> resume handling, asserting the request is not lost and processing resumes from the recorded watermark. The PR body also appears to link #26634, while this change addresses #26633.
Q1: existing reader/detector cleanup remains owned. Q2: the admitted recovery control chain currently terminates without a live executor or retry. Q3: no new unbounded accumulation found. Existing focused tests pass 10x and race 3x, but they hold the executor in StateRunning throughout and do not exercise this reachable interleaving.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-review of exact head ff4f164b4fc1747936c2a84d59fd6ada8022064e.
The previous catalog-publication blocker is resolved. RESUME admission now uses one conditional catalog update that cannot overwrite a committed Failed row. Failed recovery keeps that durable state and task-level error until replacement startup succeeds, then publishes Failed -> Running together with err_msg = ''. The zero-affected-row idempotency path now verifies both state and error text, so stale errors or false Running publication are no longer accepted as success.
I traced the concurrent detector-before-admission, detector-concurrent-with-admission, scheduler rejection, startup timeout, retry, and successful replacement paths:
- Q1: the replacement attempt, waiter, reader/detector cleanup, and durable retry remain single-owned and generation-fenced.
- Q2: ResumeRequested remains the retry owner until bounded startup readiness; cancellation and timeout terminate the wait without publishing daemon/catalog Running.
- Q3: waiter and attempt state are removed per generation; no new unbounded accumulation was introduced.
Exact-head validation passed: focused recovery/catalog tests, the same lifecycle set under -race, full pkg/cdc, pkg/frontend, and pkg/taskservice, plus build, vet, and git diff --check.
Approve.
Merge Queue Status
This pull request spent 1 hour 53 minutes 53 seconds in the queue, including 48 minutes 18 seconds running CI. Required conditions to merge
|
fix cdc resume recovery for running tasks Approved by: @XuPeng-SH
fix cdc resume recovery for running tasks Approved by: @XuPeng-SH
fix cdc resume recovery for running tasks Approved by: @XuPeng-SH
What type of PR is this?
Which issue(s) this PR fixes:
issue #26633
What this PR does / why we need it:
fix cdc resume recovery for running tasks