Skip to content

Conversation

@fzzf678
Copy link
Contributor

@fzzf678 fzzf678 commented Jan 15, 2026

What problem does this PR solve?

Issue Number: ref #65587

Problem Summary:

  • Oncall lacks a clear way to see which TiDB instance is the DDL owner and how long it has held ownership; owner switch visibility is limited.

What changed and how does it work?

  • Add gauge metric tidb_owner_is_owner_since_seconds{type="ddl"} (and other owner types via type) set to the Unix epoch seconds when an instance becomes owner, and reset to 0 when it is not owner.
  • Add a Grafana panel DDL Owner to visualize owner tenure (time() - tidb_owner_is_owner_since_seconds) and owner switches.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Manual test steps:

  1. Deploy a TiDB cluster with multiple TiDB instances.
  2. Verify tidb_owner_is_owner_since_seconds{type="ddl"} is > 0 only on the DDL owner instance and 0 on others.
  3. Trigger an owner switch (restart the owner TiDB) and verify the metric resets and starts increasing from ~0 on the new owner.
  4. Import updated dashboards and verify DDL Owner panel shows the owner tenure and switch events.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Added `tidb_owner_is_owner_since_seconds` metric and a Grafana panel to visualize DDL owner tenure and owner switches.

@ti-chi-bot ti-chi-bot bot added 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. labels Jan 15, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 15, 2026

[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 d3hunter, yibin87 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

@tiprow
Copy link

tiprow bot commented Jan 15, 2026

Hi @fzzf678. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.6082%. Comparing base (53dc671) to head (80a7216).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65590        +/-   ##
================================================
- Coverage   77.8520%   77.6082%   -0.2439%     
================================================
  Files          1973       1902        -71     
  Lines        541968     530181     -11787     
================================================
- Hits         421933     411464     -10469     
- Misses       118376     118709       +333     
+ Partials       1659          8      -1651     
Flag Coverage Δ
integration 41.7716% <0.0000%> (-6.4182%) ⬇️
unit 76.7700% <100.0000%> (+0.2928%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 56.7974% <ø> (ø)
parser ∅ <ø> (∅)
br 48.8219% <ø> (-12.3231%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

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