Skip to content

coordinator: clean stale owner checkpoint metrics (#5491) - #5793

Merged
asddongmen merged 3 commits into
pingcap:release-8.5-20260728-v8.5.7from
ti-chi-bot:cherry-pick-5491-to-release-8.5-20260728-v8.5.7
Jul 28, 2026
Merged

coordinator: clean stale owner checkpoint metrics (#5491)#5793
asddongmen merged 3 commits into
pingcap:release-8.5-20260728-v8.5.7from
ti-chi-bot:cherry-pick-5491-to-release-8.5-20260728-v8.5.7

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #5491

What problem does this PR solve?

Issue Number: close #5490

Finished or removed changefeeds can leave stale ticdc_owner_checkpoint_ts_lag series visible. Finished changefeeds remain in the coordinator changefeed DB as stopped metadata, but the owner metrics loop only skipped StateStopped and kept setting checkpoint lag for StateFinished. 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_ts and checkpoint_ts_lag.

Check List

Tests

  • Unit test

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

Fix stale owner checkpoint lag metrics for finished or removed changefeeds.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed metric cleanup for stopped changefeeds to prevent stale metrics from persisting in monitoring systems.
    • Improved periodic reset of changefeed metrics to ensure monitoring accuracy.
  • Tests

    • Added tests to verify metrics are properly cleaned up when changefeeds reach terminal states.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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-20260728-v8.5.7 labels Jul 28, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member Author

@asddongmen This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

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.

@coderabbitai

coderabbitai Bot commented Jul 28, 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: 87073e0e-6e6a-4876-9b56-a7b7d86dea2e

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 28, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 28, 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 ask for approval from asddongmen. 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

Copy link
Copy Markdown
Member Author

Cherry-pick conflicts appear resolved; removing the do-not-merge/hold label.

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2026
@ti-chi-bot ti-chi-bot Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 28, 2026
@asddongmen

Copy link
Copy Markdown
Collaborator

/test all

@asddongmen

Copy link
Copy Markdown
Collaborator

/retest

@asddongmen
asddongmen merged commit c8d4d68 into pingcap:release-8.5-20260728-v8.5.7 Jul 28, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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-20260728-v8.5.7

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants