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

*: add execution retry time in slow log and slow_query and statement_summary #19625

Merged
merged 7 commits into from
Sep 1, 2020

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Aug 31, 2020

Signed-off-by: crazycs520 crazycs520@gmail.com

What problem does this PR solve?

Continue to the previous #19487.

This PR do 2 things:

  1. adds Exec_retry_time to indicate the time consuming on retry.
  • Exec_retry_time means the useless retry time consuming. Such retry 10 times, total exec_time is 10 seconds, the last successful execution time is 1 second, so the Exec_retry_time is 9 seconds. The last execution time can be found in the Plan field in the slow log.
# Time: 2020-08-31T17:43:07.162845+08:00
# Exec_retry_time: 1.337662279 Exec_retry_count: 2
# Query_time: 1.908441749
# Parse_time: 0.020197318
# Compile_time: 0.02073548
  1. adds exec_retry_count and exec_retry_time into system table statement_sammary:
information_schema> select DIGEST_TEXT,SUM_LATENCY,SUM_EXEC_RETRY_TIME,EXEC_COUNT,SUM_EXEC_RETRY from `STATEMENTS_SUMMARY` where SUM_EXEC_RETRY > 0;
+-------------------------------------------+--------------+---------------------+------------+----------------+
| DIGEST_TEXT                               | SUM_LATENCY  | SUM_EXEC_RETRY_TIME | EXEC_COUNT | SUM_EXEC_RETRY |
+-------------------------------------------+--------------+---------------------+------------+----------------+
| select * from t1 where a < ? for update ; | 381395110811 | 263244426899        | 130        | 257            |
+-------------------------------------------+--------------+---------------------+------------+----------------+

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Manual test

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM

Release note

  • Add execution retry time in slow log and slow_query.

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520 crazycs520 requested a review from a team as a code owner August 31, 2020 12:44
@crazycs520 crazycs520 requested review from lzmhhh123 and removed request for a team August 31, 2020 12:44
@github-actions github-actions bot added sig/sql-infra SIG: SQL Infra sig/execution SIG execution labels Aug 31, 2020
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520 crazycs520 changed the title *: add execution retry count in slow log and slow_query *: add execution retry count in slow log and slow_query and statement_sumarry Aug 31, 2020
@ghost ghost changed the title *: add execution retry count in slow log and slow_query and statement_sumarry *: add execution retry count in slow log and slow_query and statement_summary Aug 31, 2020
@crazycs520 crazycs520 changed the title *: add execution retry count in slow log and slow_query and statement_summary *: add execution retry time in slow log and slow_query and statement_summary Sep 1, 2020
infoschema/tables.go Outdated Show resolved Hide resolved
Co-authored-by: djshow832 <zhangming@pingcap.com>
Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 1, 2020
Copy link
Contributor

@djshow832 djshow832 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Sep 1, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Sep 1, 2020
@djshow832
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 1, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-integration-copr-test

1 similar comment
@crazycs520
Copy link
Contributor Author

/run-integration-copr-test

@ti-srebot ti-srebot merged commit 5d3cdf5 into pingcap:master Sep 1, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #20495

crazycs520 added a commit to ti-srebot/tidb that referenced this pull request Oct 19, 2020
crazycs520 added a commit to ti-srebot/tidb that referenced this pull request Oct 19, 2020
…summary (pingcap#19625)

Signed-off-by: crazycs520 <crazycs520@gmail.com>
ti-srebot added a commit that referenced this pull request Oct 21, 2020
…summary (#19625) (#20495)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor epic/slow-query sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants