Skip to content

coordinator,api: ensure changefeed deletion removes persisted metadata - #6218

Open
lidezhu wants to merge 1 commit into
masterfrom
ldz/fix-delete-changefeed
Open

coordinator,api: ensure changefeed deletion removes persisted metadata#6218
lidezhu wants to merge 1 commit into
masterfrom
ldz/fix-delete-changefeed

Conversation

@lidezhu

@lidezhu lidezhu commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

Summary by CodeRabbit

  • Bug Fixes
    • Changefeed deletion now verifies persisted metadata before reporting success.
    • Deletions remain marked as unfinished until persisted metadata is fully removed.
    • Prevented canceled pause operations from overwriting removal progress.
    • Checkpoint updates now exclude stopped or removed changefeeds.
  • Tests
    • Added coverage for persisted deletion state, checkpoint filtering, and pause-to-remove transitions.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 11, 2026
@ti-chi-bot

ti-chi-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kennytm for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found 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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 11, 2026
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9bdd6318-0345-4e59-989b-62d459f3edaf

📥 Commits

Reviewing files that changed from the base of the PR and between a62695e and bc9c7dd.

📒 Files selected for processing (9)
  • api/v2/changefeed.go
  • api/v2/changefeed_test.go
  • coordinator/controller.go
  • coordinator/controller_test.go
  • coordinator/coordinator.go
  • coordinator/operator/operator_controller_test.go
  • coordinator/operator/operator_stop.go
  • coordinator/operator/operator_stop_integration_test.go
  • coordinator/operator/operator_stop_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change validates persisted metadata during changefeed deletion, waits for durable removal, filters checkpoint updates by running state, and prevents canceled stop operators from overwriting removal progress.

Changes

Changefeed lifecycle consistency

Layer / File(s) Summary
Persisted deletion validation
api/v2/changefeed.go, api/v2/changefeed_test.go
DeleteChangefeed checks persisted metadata before returning success and waits for metadata removal after RemoveChangefeed. Tests cover idempotent deletion, unfinished deletion, polling, and successful removal.
Checkpoint persistence filtering
coordinator/controller.go, coordinator/coordinator.go, coordinator/controller_test.go
Checkpoint persistence now filters missing or stopped changefeeds before calling the backend. Tests verify the filtered map.
Canceled stop operator handling
coordinator/operator/operator_stop.go, coordinator/operator/operator_stop_test.go, coordinator/operator/operator_controller_test.go, coordinator/operator/operator_stop_integration_test.go
Canceled stop operators no longer reset progress after a replacement remove operator persists ProgressRemoving. Unit and integration tests cover this lifecycle.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant API as DeleteChangefeed
  participant Coordinator
  participant Metastore
  participant Backend
  API->>Coordinator: GetChangefeed
  Coordinator-->>API: in-memory state
  API->>Coordinator: GetPersistedChangefeedInfo
  Coordinator->>Metastore: read durable metadata
  Metastore-->>Coordinator: metadata state
  API->>Coordinator: RemoveChangefeed
  API->>Coordinator: poll persisted metadata
  Coordinator->>Metastore: confirm deletion
  API-->>Backend: return deletion result
Loading

Suggested reviewers: wk989898

Merge Risk: ⚪ Minimal · up to bc9c7

Changefeed deletion now waits for durable metadata removal, avoids persisting checkpoints for stopped or removed feeds, and preserves removal progress when stop operators are replaced. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description retains the required headings but is largely incomplete. The issue reference remains the placeholder close #xxx``, and the problem, implementation, test selection, compatibility, docum… Replace close #xxx`` with the relevant issue reference. Describe the problem and implementation. Identify the tests that were run and provide details for manual tests if applicable. Answer both questions about compatibility and documentatio…
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: ensuring persisted changefeed metadata is removed during deletion. It is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description retains the required headings but is largely incomplete. The issue reference remains the placeholder close #xxx``, and the problem, implementation, test selection, compatibility, documentation, and release-note sections are not completed.

Resolution

Replace close #xxx`` with the relevant issue reference. Describe the problem and implementation. Identify the tests that were run and provide details for manual tests if applicable. Answer both questions about compatibility and documentation. Add a release note or specify None.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ldz/fix-delete-changefeed

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

A rabbit checks the changefeed trail
Durable crumbs confirm the tale
Checkpoints skip the stopped lane
Canceled paws leave progress plain
Removal waits till none remain

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

@ti-chi-bot

ti-chi-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

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

Labels

do-not-merge/needs-linked-issue 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant