Skip to content

fix cdc resume recovery for running tasks - #26641

Merged
mergify[bot] merged 7 commits into
matrixorigin:mainfrom
jiangxinmeng1:agent/fix-cdc-resume-running
Aug 5, 2026
Merged

mergify[bot] merged 7 commits into
matrixorigin:mainfrom
jiangxinmeng1:agent/fix-cdc-resume-running

Conversation

@jiangxinmeng1

@jiangxinmeng1 jiangxinmeng1 commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #26633

What this PR does / why we need it:

fix cdc resume recovery for running tasks

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@matrix-meow matrix-meow removed the size/M Denotes a PR that changes [100,499] lines label Aug 5, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Aug 5, 2026
@jiangxinmeng1
jiangxinmeng1 requested a review from XuPeng-SH August 5, 2026 02:57

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mergify mergify Bot added the queued label Aug 5, 2026
@mergify

mergify Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-05 03:56 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-08-05 05:50 UTC · at 1fa6af1128437509c70de25a77d0336a32903b40 · squash

This pull request spent 1 hour 53 minutes 53 seconds in the queue, including 48 minutes 18 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

@mergify
mergify Bot merged commit 607a926 into matrixorigin:main Aug 5, 2026
26 of 27 checks passed
@mergify mergify Bot removed the queued label Aug 5, 2026
@LeftHandCold LeftHandCold mentioned this pull request Aug 5, 2026
1 of 7 tasks
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
fix cdc resume recovery for running tasks

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
fix cdc resume recovery for running tasks

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
fix cdc resume recovery for running tasks

Approved by: @XuPeng-SH

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants