coordinator: clean stale owner checkpoint metrics - #5491
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds two exported metric helpers ( ChangesCheckpoint metric cleanup for terminal changefeed states
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Code Review
This pull request introduces helper functions to clean up and reset changefeed checkpoint metrics when a changefeed is stopped, finished, or removed, or when the coordinator's metric collection exits. It also adds corresponding unit tests to verify this behavior. The reviewer suggests expanding the reset logic to cover other owner-subsystem metrics (such as status, error, and downstream info gauges) to prevent stale metrics when a coordinator instance loses ownership.
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.
|
If the changefeed is deleted now, will the metrics from a certain period of time before be deleted? Please conduct a test to verify. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hongyunyan, wk989898 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/cherry-pick release-8.5 |
|
@asddongmen: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
/cherry-pick release-8.5-20260728-v8.5.7 |
|
@asddongmen: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
* This is an automated cherry-pick of #5491 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> * coordinator: resolve v8.5.7 cherry-pick conflicts * common: update TiDB TableInfo shared schema guard (#5652) (#5741) close #5740 --------- Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Co-authored-by: dongmen <20351731+asddongmen@users.noreply.github.com> Co-authored-by: dongmen <414110582@qq.com>

What problem does this PR solve?
Issue Number: close #5490
Finished or removed changefeeds can leave stale
ticdc_owner_checkpoint_ts_lagseries visible. Finished changefeeds remain in the coordinator changefeed DB as stopped metadata, but the owner metrics loop only skippedStateStoppedand kept setting checkpoint lag forStateFinished. Old owner instances could also keep checkpoint labels after ownership stops.What is changed and how it works?
This PR deletes owner checkpoint timestamp and lag labels together for stopped, finished, or removed changefeeds instead of recreating them during the metrics loop. It also resets owner checkpoint labels when the coordinator metrics loop exits, so an instance that loses ownership stops exposing stale checkpoint series. The stop/remove path now deletes both
checkpoint_tsandcheckpoint_ts_lag.Check List
Tests
Questions
Will it cause performance regression or break compatibility?
No. This only changes cleanup behavior for owner metrics labels.
Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit
Bug Fixes
Tests