Skip to content

api,cli: fix running changefeed resume handling (#4894) - #5328

Merged
wlwilliamx merged 3 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-4894-to-release-8.5
Jul 30, 2026
Merged

wlwilliamx merged 3 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-4894-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #4894

What problem does this PR solve?

Issue Number: close #4893

What is changed and how it works?

This PR rejects changefeed resume requests when the changefeed is already in a running state.

The change adds a shared FeedState.IsResumable predicate and uses it in:

  • CLI parameter validation, so cdc cli changefeed resume fails before printing a misleading success message or sending the resume request.
  • HTTP resume handling, before downstream validation and resume GC safepoint/barrier setup.
  • Coordinator resume handling, replacing the previous silent no-op with ErrChangefeedUpdateRefused.

This prevents running changefeeds from reporting resume success and avoids creating unnecessary resuming GC guards for invalid resume requests.

Check List

Tests

  • Unit test
  • Manual test
go test ./api/v2 ./coordinator ./pkg/config ./cmd/cdc/cli -count=1

Questions

Will it cause performance regression or break compatibility?

No performance regression. Invalid resume requests for running changefeeds now return an explicit error instead of success/no-op.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

Fix `cdc cli changefeed resume` to reject running changefeeds instead of reporting success, and avoid creating temporary resume GC guards for invalid resume requests.

Summary by CodeRabbit

  • Bug Fixes

    • Resume now validates changefeed state and rejects non-resumable states (only stopped/failed/finished allowed), returning a clear refusal error early across API, controller, and CLI.
  • Tests

    • Added/expanded tests for resume state validation (API, CLI, controller), masking sensitive sink-URI fields in errors, and route-conflict detection.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b26dfdaa-43ea-4457-954f-7cc538cd2483

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a validation guard to ensure that a changefeed can only be resumed if it is in a resumable state (stopped, failed, or finished). This check is implemented across the API, CLI, and coordinator controller layers, preventing invalid resume requests early in the process. Comprehensive unit tests have been added to verify this behavior across all affected components. There are no review comments to address, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@wlwilliamx

Copy link
Copy Markdown
Collaborator

/test all

Resolve the add/add conflict in api/v2/changefeed_test.go while preserving the current release branch tests and the resume regression coverage.

Remove a master-only batch field test that the automated cherry-pick copied into release-8.5, where the referenced fields do not exist.

Signed-off-by: wlwilliamx <wlwilliamx@gmail.com>
@ti-chi-bot ti-chi-bot Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cherry-pick-approved Cherry pick PR approved by release team. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. do-not-merge/cherry-pick-not-approved labels Jul 28, 2026
@wlwilliamx

Copy link
Copy Markdown
Collaborator

/test all

@ti-chi-bot

ti-chi-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lidezhu, wlwilliamx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the approved label Jul 29, 2026
The release branch now reloads persisted changefeed info before validating resume state. Teach the normal-state fake to return the same persisted view so the regression test continues to exercise that guard.

Signed-off-by: wlwilliamx <wlwilliamx@gmail.com>
@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 29, 2026
@wlwilliamx

Copy link
Copy Markdown
Collaborator

/test all

@wlwilliamx

Copy link
Copy Markdown
Collaborator

/retest

1 similar comment
@wlwilliamx

Copy link
Copy Markdown
Collaborator

/retest

@wlwilliamx
wlwilliamx merged commit 572a647 into pingcap:release-8.5 Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants