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

ddl: support tracing adding index #38110

Closed
wants to merge 26 commits into from

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Sep 22, 2022

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What is changed and how it works?

This PR adds a summary to the log:

tidb> set global tidb_ddl_enable_fast_reorg = 0;
tidb> alter table sbtest1 add index idx_k(k);

Query OK, 0 rows affected (36.37 sec)
[2022/09/22 19:49:17.184 +08:00] [INFO] [index.go:685] ["[ddl] finish add index job"] [job="ID:181, Type:add index, State:done, SchemaState:public, SchemaID:70, TableID:72, RowCount:1000000, ArgLen:3,start time: 2022-09-22 19:48:40.919 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:436167592199585797"] ["time details"="{add-index-worker:36.235535542s, create-records:{sum: 3.323698943s, min: 7.75µs, max: 17.046083ms, avg: 849.833µs}, delete-only:3.561625ms, fetch-create-txn:{sum: 1m30.234648553s, min: 1.737958ms, max: 159.44675ms, avg: 23.072014ms}, fetch-rows:{sum: 11.203536406s, min: 291.125µs, max: 26.522083ms, avg: 2.864621ms}, none:3.084458ms, write-only:31.627917ms, write-reorg:32.622674707s}"]
{
    add-index-worker:36.235535542s, 
    create-records:{sum: 3.323698943s, min: 7.75µs, max: 17.046083ms, avg: 849.833µs}, 
    delete-only:3.561625ms, 
    fetch-create-txn:{sum: 1m30.234648553s, min: 1.737958ms, max: 159.44675ms, avg: 23.072014ms}, 
    fetch-rows:{sum: 11.203536406s, min: 291.125µs, max: 26.522083ms, avg: 2.864621ms}, 
    none:3.084458ms, 
    write-only:31.627917ms, 
    write-reorg:32.622674707s
}
tidb> set global tidb_ddl_enable_fast_reorg = 1;
tidb> alter table sbtest1 add index idx_k(k);

Query OK, 0 rows affected (10.46 sec)
[2022/09/22 19:56:36.285 +08:00] [INFO] [index.go:685] ["[ddl] finish add index job"] [job="ID:183, Type:add index, State:done, SchemaState:public, SchemaID:70, TableID:72, RowCount:1000000, ArgLen:3,start time: 2022-09-22 19:56:25.965 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:436167716035624965"] ["time details"="{add-index-worker:10.272489459s, create-records:{sum: 196.59863ms, min: 708ns, max: 1.009042ms, avg: 50.268µs}, delete-only:3.813333ms, fetch-create-txn:{sum: 5.122028924s, min: 197µs, max: 8.051709ms, avg: 1.309646ms}, fetch-rows:{sum: 4.614772601s, min: 136.416µs, max: 7.926625ms, avg: 1.179946ms}, none:8.527708ms, write-only:40.635459ms, write-reorg:7.186017333s, write-reorg-backfill:7.179895208s, write-reorg-merging:2.514079333s, write-reorg-ready-to-merge:4.8215ms}"]
{
    add-index-worker:10.272489459s, 
    create-records:{sum: 196.59863ms, min: 708ns, max: 1.009042ms, avg: 50.268µs}, 
    delete-only:3.813333ms, 
    fetch-create-txn:{sum: 5.122028924s, min: 197µs, max: 8.051709ms, avg: 1.309646ms}, 
    fetch-rows:{sum: 4.614772601s, min: 136.416µs, max: 7.926625ms, avg: 1.179946ms}, 
    none:8.527708ms, 
    write-only:40.635459ms, 
    write-reorg:7.186017333s, 
    write-reorg-backfill:7.179895208s, 
    write-reorg-merging:2.514079333s, 
    write-reorg-ready-to-merge:4.8215ms
}

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 22, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 23, 2022
@ti-chi-bot
Copy link
Member

@tangenta: PR needs rebase.

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/test-infra repository.

@ti-chi-bot ti-chi-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 Oct 10, 2022
@tangenta tangenta force-pushed the add-index-record-time branch 5 times, most recently from a4181ce to 2e14e04 Compare October 11, 2022 08:34
@tangenta
Copy link
Contributor Author

tangenta commented Dec 1, 2022

All the changes has been merged to master, so I will close this PR.

@tangenta tangenta closed this Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants