Skip to content

Conversation

@JmPotato
Copy link
Member

What problem does this PR solve?

Issue Number: ref #65746.

Problem Summary:

Optimize the performance of the runaway watch sync loop.

What changed and how does it work?

Introduce bootstrap version 254 that adds indexes to improve query efficiency in the runaway watch mechanism:

  • Add index idx_start_time on mysql.tidb_runaway_watch(start_time)
  • Add index idx_done_time on mysql.tidb_runaway_watch_done(done_time)

Check List

Tests

  • Unit test
  • Integration test

Release note

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

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 27, 2026
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.8274%. Comparing base (ba22c17) to head (4cbbeee).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65828        +/-   ##
================================================
+ Coverage   77.7230%   78.8274%   +1.1044%     
================================================
  Files          2001       1940        -61     
  Lines        545892     533654     -12238     
================================================
- Hits         424284     420666      -3618     
+ Misses       119946     111968      -7978     
+ Partials       1662       1020       -642     
Flag Coverage Δ
integration 44.9990% <0.0000%> (-3.1882%) ⬇️
unit 76.6956% <100.0000%> (+0.3091%) ⬆️

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

Components Coverage Δ
dumpling 56.7974% <ø> (ø)
parser ∅ <ø> (∅)
br 66.2965% <ø> (+5.3152%) ⬆️
🚀 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.

@JmPotato
Copy link
Member Author

/retest

@JmPotato JmPotato requested a review from rleungx February 2, 2026 03:48
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 2, 2026
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 3, 2026
@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 3, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 3, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-03 06:44:29.57292505 +0000 UTC m=+162940.674323769: ☑️ agreed by yudongusa.
  • 2026-02-03 06:45:34.579541668 +0000 UTC m=+163005.680940379: ☑️ agreed by YuJuncen.

Copy link
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

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

UT & FT is needed

}

func upgradeToVer254(s sessionapi.Session, _ int64) {
doReentrantDDL(s, "ALTER TABLE mysql.tidb_runaway_watch ADD INDEX idx_start_time(start_time)", dbterror.ErrDupKeyName)
Copy link
Member

Choose a reason for hiding this comment

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

No comment for these indexes, they are not the same as CreateTiDBRunawayWatchDoneTable

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@wjhuang2016
Copy link
Member

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2026
…temTableIncremental

Signed-off-by: JmPotato <github@ipotato.me>
…on in upgrade v254

Signed-off-by: JmPotato <github@ipotato.me>
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 3, 2026
@JmPotato
Copy link
Member Author

JmPotato commented Feb 3, 2026

UT & FT is needed

The tests for read and write functions related to these two tables are included in the UT and FT of the Runaway feature tests. For the newly added index, I’ve also added the corresponding explain tests in this PR.

@wjhuang2016
Copy link
Member

UT & FT is needed

The tests for read and write functions related to these two tables are included in the UT and FT of the Runaway feature tests. For the newly added index, I’ve also added the corresponding explain tests in this PR.

I mean, testing the upgrade. check session/bootstrap_test.go

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 3, 2026
@JmPotato
Copy link
Member Author

JmPotato commented Feb 3, 2026

bootstrap_test

Understood, tests for version 254 have been added in bootstrap_test.go. Please take a look.

@JmPotato JmPotato requested a review from wjhuang2016 February 3, 2026 07:30
Signed-off-by: JmPotato <github@ipotato.me>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wjhuang2016, yudongusa, YuJuncen

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

@wjhuang2016
Copy link
Member

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2026
@JmPotato
Copy link
Member Author

JmPotato commented Feb 3, 2026

/retest

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 3, 2026

@JmPotato: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/unit-test 4cbbeee link unknown /test unit-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@hawkingrei
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot bot merged commit 1b68e1e into pingcap:master Feb 3, 2026
31 of 32 checks passed
@JmPotato JmPotato deleted the fix_runaway_index branch February 3, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants