tidb icon indicating copy to clipboard operation
tidb copied to clipboard

ddl: support tracing adding index

Open tangenta opened this issue 2 years ago • 1 comments

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

tangenta avatar Sep 22 '22 12:09 tangenta

[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 avatar Sep 22 '22 12:09 ti-chi-bot

@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 avatar Sep 23 '22 09:09 ti-chi-bot

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

tangenta avatar Dec 01 '22 06:12 tangenta