Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: add col/idx name(s) for BackfillProgressGauge and BackfillTotalCounter #58380

Merged
merged 3 commits into from
Dec 23, 2024

Conversation

CbcWestwolf
Copy link
Member

@CbcWestwolf CbcWestwolf commented Dec 18, 2024

What problem does this PR solve?

Issue Number: close #58114

Problem Summary:

For BackfillProgressGauge and BackfillTotalCounter, tidb only shows the database name and table name in the metrics. If we add multiple indexes on a single table, it would be difficult to know the rate and progress of each index.

What changed and how does it work?

  • Add column names and index names for metrics.

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.

Test script:

mysql -h 127.0.0.1 -P4000 -uroot -e'create database test1; create database test2;'

sysbench oltp_read_write prepare --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=4000 --mysql-user=root --mysql-db=test1 --threads=16 --tables=2 --table-size=1000000
sysbench oltp_read_write prepare --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=4000 --mysql-user=root --mysql-db=test2 --threads=16 --tables=2 --table-size=1000000

# Add Index
mysql -h 127.0.0.1 -P4000 -uroot -e'create index k_pad on test1.sbtest1(pad); alter table test1.sbtest2 add index k_pad(pad), add index k_comp(c, pad);'
mysql -h 127.0.0.1 -P4000 -uroot -e'create index k_pad on test2.sbtest1(pad); alter table test2.sbtest2 add index k_pad(pad), add index k_comp(c, pad);'

# Modify Column
mysql -h 127.0.0.1 -P4000 -uroot -e'alter table test1.sbtest1 change column k k varchar(64); alter table test1.sbtest2 change column k k varchar(64);'
mysql -h 127.0.0.1 -P4000 -uroot -e'alter table test2.sbtest1 change column k k varchar(64); alter table test2.sbtest2 change column k k varchar(64);'
image

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.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. labels Dec 18, 2024
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 79.12088% with 19 lines in your changes missing coverage. Please review.

Project coverage is 74.9075%. Comparing base (1405c5e) to head (5b8a111).
Report is 42 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58380        +/-   ##
================================================
+ Coverage   73.1849%   74.9075%   +1.7226%     
================================================
  Files          1681       1727        +46     
  Lines        463027     476996     +13969     
================================================
+ Hits         338866     357306     +18440     
+ Misses       103358      97417      -5941     
- Partials      20803      22273      +1470     
Flag Coverage Δ
integration 49.1145% <64.8351%> (?)
unit 72.4298% <79.1208%> (+0.1130%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 60.5307% <ø> (+14.5287%) ⬆️

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 18, 2024
@CbcWestwolf
Copy link
Member Author

/retest

@CbcWestwolf CbcWestwolf changed the title wip: include index name in tidb_ddl_add_index_total metrics metrics: add col/idx name(s) for BackfillProgressGauge and BackfillTotalCounter Dec 18, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 18, 2024
@sre-bot
Copy link
Contributor

sre-bot commented Dec 19, 2024

CLA assistant check
All committers have signed the CLA.

@CbcWestwolf CbcWestwolf force-pushed the add-index-metric branch 6 times, most recently from f93556a to e098237 Compare December 20, 2024 09:04
pkg/metrics/ddl.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 23, 2024
@CbcWestwolf
Copy link
Member Author

/retest

1 similar comment
@CbcWestwolf
Copy link
Member Author

/retest

Copy link

ti-chi-bot bot commented Dec 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fzzf678, tangenta

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 23, 2024
Copy link

ti-chi-bot bot commented Dec 23, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-23 05:12:59.049205662 +0000 UTC m=+1452169.138008198: ☑️ agreed by tangenta.
  • 2024-12-23 06:45:27.69767329 +0000 UTC m=+1457717.786475831: ☑️ agreed by fzzf678.

@CbcWestwolf
Copy link
Member Author

/retest

Copy link

tiprow bot commented Dec 23, 2024

@CbcWestwolf: 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
fast_test_tiprow 5b8a111 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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.

@ti-chi-bot ti-chi-bot bot merged commit 042a332 into pingcap:master Dec 23, 2024
26 of 27 checks passed
@CbcWestwolf CbcWestwolf deleted the add-index-metric branch December 23, 2024 09:14
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include index name in tidb_ddl_add_index_total metrics
4 participants