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

runaway: add runaway tidb-side time checker #54987

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

HuSharp
Copy link
Contributor

@HuSharp HuSharp commented Jul 29, 2024

What problem does this PR solve?

mark runaway query when processing time on tidb side exceed executed time

Issue Number: close #51325

Problem Summary:

What changed and how does it work?

mysql> ALTER RESOURCE GROUP default QUERY_LIMIT=(EXEC_ELAPSED='2s', ACTION=KILL,  WATCH=EXACT DURATION='10m');
Query OK, 0 rows affected (0.07 sec)

mysql> select sleep(3) from t;
ERROR 8253 (HY000): Query execution was interrupted, identified as runaway query

can find log

[2024/08/07 16:54:49.501 +08:00] [WARN] [expensivequery.go:109] ["runaway query timeout"] [costTime=2.06010825s] [groupName=default] [rule=execElapsedTimeMs:2s] [processInfo="{id:295698438, user:root, host:127.0.0.1:52409, db:test, command:Query, time:2, state:autocommit, info:select sleep(3) from t}"]
[2024/08/07 16:54:49.502 +08:00] [INFO] [server.go:896] [kill] [conn=295698438] [query=true] [maxExecutionTime=false] [runawayExceed=true]
[2024/08/07 16:54:49.502 +08:00] [WARN] [sqlkiller.go:61] ["kill initiated"] ["connection ID"=295698438] [reason="[executor:8253]Query execution was interrupted, identified as runaway query"]
[2024/08/07 16:54:49.503 +08:00] [WARN] [sqlkiller.go:137] ["kill finished"] [conn=295698438]

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.

Release note

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

Fix the bug that runaway only counts the time consumed by coprocessor, and add the time checker on the tidb side.

Copy link

ti-chi-bot bot commented Jul 29, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked do-not-merge/needs-triage-completed 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 Jul 29, 2024
Copy link

tiprow bot commented Jul 29, 2024

Hi @HuSharp. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 69.04762% with 13 lines in your changes missing coverage. Please review.

Project coverage is 75.6461%. Comparing base (98b7858) to head (6d85975).
Report is 189 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #54987        +/-   ##
================================================
+ Coverage   74.7144%   75.6461%   +0.9316%     
================================================
  Files          1558       1589        +31     
  Lines        363836     467174    +103338     
================================================
+ Hits         271838     353399     +81561     
- Misses        72290      92365     +20075     
- Partials      19708      21410      +1702     
Flag Coverage Δ
integration 50.8965% <16.6666%> (?)
unit 71.7922% <66.6666%> (-1.8307%) ⬇️

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

Components Coverage Δ
dumpling 52.9567% <ø> (-2.2428%) ⬇️
parser ∅ <ø> (∅)
br 61.3570% <ø> (+13.6789%) ⬆️

@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 Aug 7, 2024
@HuSharp
Copy link
Contributor Author

HuSharp commented Aug 7, 2024

/test all

Copy link

tiprow bot commented Aug 7, 2024

@HuSharp: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test all

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.

@HuSharp
Copy link
Contributor Author

HuSharp commented Aug 7, 2024

/test all

Copy link

tiprow bot commented Aug 7, 2024

@HuSharp: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test all

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.

@HuSharp
Copy link
Contributor Author

HuSharp commented Aug 7, 2024

/test check_dev

Copy link

ti-chi-bot bot commented Aug 7, 2024

@HuSharp: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pull-br-integration-test
  • /test pull-integration-ddl-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test canary-notify-when-compatibility-sections-changed
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test
  • pingcap/tidb/pull_br_integration_test
  • pingcap/tidb/pull_integration_ddl_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test check_dev

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.

Copy link

tiprow bot commented Aug 7, 2024

@HuSharp: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check_dev

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.

@HuSharp
Copy link
Contributor Author

HuSharp commented Aug 7, 2024

/test check-dev

Copy link

tiprow bot commented Aug 7, 2024

@HuSharp: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev

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.

Signed-off-by: husharp <[email protected]>
@HuSharp HuSharp marked this pull request as ready for review August 7, 2024 09:47
@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 Aug 7, 2024
@HuSharp
Copy link
Contributor Author

HuSharp commented Aug 7, 2024

@nolouch @JmPotato @glorv PTAL, thx!

@glorv
Copy link
Contributor

glorv commented Aug 8, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed do-not-merge/needs-tests-checked labels Aug 8, 2024
Copy link
Contributor

@glorv glorv left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/domain/resourcegroup/runaway.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 8, 2024
Signed-off-by: husharp <[email protected]>
@HuSharp
Copy link
Contributor Author

HuSharp commented Aug 9, 2024

/test check-dev2

Copy link

tiprow bot commented Aug 9, 2024

@HuSharp: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

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.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 9, 2024
Copy link

ti-chi-bot bot commented Aug 9, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-08 09:49:29.675021468 +0000 UTC m=+518299.542120555: ☑️ agreed by glorv.
  • 2024-08-09 09:50:02.956341627 +0000 UTC m=+604732.823440713: ☑️ agreed by nolouch.

@nolouch
Copy link
Member

nolouch commented Aug 9, 2024

/test check-dev2

Copy link

tiprow bot commented Aug 9, 2024

@nolouch: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

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.

@nolouch
Copy link
Member

nolouch commented Aug 9, 2024

/retest-required

Copy link

tiprow bot commented Aug 9, 2024

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

Test name Commit Details Required Rerun command
tidb_parser_test 6d85975 link true /test tidb_parser_test
fast_test_tiprow 6d85975 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.

Copy link

ti-chi-bot bot commented Aug 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: glorv, nolouch, 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 the approved label Aug 12, 2024
@ti-chi-bot ti-chi-bot bot merged commit d6dda3d into pingcap:master Aug 12, 2024
22 of 24 checks passed
@HuSharp HuSharp deleted the add_tidb_runaway_check branch August 12, 2024 04:03
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

cannot mark runaway query if most of the processing time on tidb side
4 participants