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

executor: fix issue that some query execution stats was omitted when execution was interrupted #51787

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #51660

Problem Summary: fix issue that some query execution stats was omitted when execution was interrupted.

What changed and how does it work?

This PR:

Execute query with max_execution_time, and make the query execution was interrupted, cause by maximum statement execution time exceeded. Then the slow query info still have executor stats.

image

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.

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

…was interrupted

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@ti-chi-bot ti-chi-bot bot added 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 Mar 14, 2024
Copy link

tiprow bot commented Mar 14, 2024

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

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@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 Mar 14, 2024
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Merging #51787 (71883b2) into master (c95a54c) will decrease coverage by 15.7991%.
Report is 48 commits behind head on master.
The diff coverage is 87.2340%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #51787         +/-   ##
=================================================
- Coverage   70.7160%   54.9169%   -15.7991%     
=================================================
  Files          1476       1583        +107     
  Lines        437502     614366     +176864     
=================================================
+ Hits         309384     337391      +28007     
- Misses       108721     254685     +145964     
- Partials      19397      22290       +2893     
Flag Coverage Δ
integration 36.8904% <78.7234%> (?)
unit 70.9877% <87.2340%> (+0.4560%) ⬆️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 51.4732% <ø> (+5.5695%) ⬆️

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Mar 14, 2024
@crazycs520
Copy link
Contributor Author

/test check-dev2

Copy link

tiprow bot commented Mar 14, 2024

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

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

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

ti-chi-bot bot commented Mar 15, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-14 11:13:44.723444974 +0000 UTC m=+943251.745691363: ☑️ agreed by you06.
  • 2024-03-15 05:25:44.805228422 +0000 UTC m=+1008771.827474809: ☑️ agreed by lcwangchao.

@crazycs520
Copy link
Contributor Author

/test fast_test_tiprow

Copy link

ti-chi-bot bot commented Mar 15, 2024

@crazycs520: 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_integration_ddl_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test fast_test_tiprow

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 Mar 15, 2024

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

In response to this:

/test fast_test_tiprow

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.

@crazycs520
Copy link
Contributor Author

/retest-required

Copy link

tiprow bot commented Mar 15, 2024

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

In response to this:

/retest-required

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.

@crazycs520
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Mar 15, 2024
@crazycs520
Copy link
Contributor Author

/retest

@crazycs520
Copy link
Contributor Author

@Benjamin2037 PTAL

Copy link
Collaborator

@Benjamin2037 Benjamin2037 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Mar 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, lcwangchao, you06

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 Mar 18, 2024
@crazycs520
Copy link
Contributor Author

/merge

Copy link

ti-chi-bot bot commented Mar 18, 2024

@crazycs520: We have migrated to builtin LGTM and approve plugins for reviewing.

Please use /approve when you want approve this pull request.

The changes announcement: LGTM plugin changes

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot merged commit 7056209 into pingcap:master Mar 18, 2024
23 checks passed
@crazycs520 crazycs520 deleted the fix-stats-omit2 branch March 18, 2024 15:07
@Rustin170506
Copy link
Member

I think this PR introduced a panic:

[2024/03/19 09:52:29.783 +08:00] [ERROR] [analyze.go:520] ["analyze worker panicked"] [recover="runtime error: invalid memory address or nil pointer dereference"] [stack="github.com/pingcap/tidb/pkg/executor.(*AnalyzeExec).analyzeWorker.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze.go:520\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:914\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:261\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:861\ngithub.com/pingcap/tidb/pkg/distsql.(*selectResult).Close\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/distsql/select_result.go:610\ngithub.com/pingcap/tidb/pkg/executor.closeAll\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/distsql.go:138\ngithub.com/pingcap/tidb/pkg/executor.(*AnalyzeIndexExec).buildStats.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_idx.go:102\ngithub.com/pingcap/tidb/pkg/executor.(*AnalyzeIndexExec).buildStats\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_idx.go:109\ngithub.com/pingcap/tidb/pkg/executor.analyzeIndexPushdown\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze_idx.go:59\ngithub.com/pingcap/tidb/pkg/executor.(*AnalyzeExec).analyzeWorker\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze.go:547\ngithub.com/pingcap/tidb/pkg/executor.(*AnalyzeExec).Next.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/analyze.go:119\ngithub.com/pingcap/tidb/pkg/util.(*WaitGroupPool).Run.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/util/wait_group_wrapper.go:213\ngithub.com/tiancaiamao/gp.worker\n\t/go/pkg/mod/github.com/tiancaiamao/gp@v0.0.0-20221230034425-4025bc8a4d4a/gp.go:37"]

crazycs520 added a commit to crazycs520/tidb that referenced this pull request May 16, 2024
…execution was interrupted (pingcap#51787)

close pingcap#51660

Signed-off-by: crazycs520 <crazycs520@gmail.com>
cfzjywxk pushed a commit that referenced this pull request May 21, 2024
* sessionctx: add sysvar to control exp feats of replica selector

Signed-off-by: zyguan <zhongyangguan@gmail.com>

* *: add rpc error stats and refine log (#52810)

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

* store: refine coprocessor error log (#52729)

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

* *: improve log about stale-read query (#52494)

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

* *: refine tikv/client-go log to print context information(such as conn id) as much as possible (#45559)

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

* add leader peer id log

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

* update log

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

* executor: fix issue that some query execution stats was omitted when execution was interrupted (#51787)

close #51660

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

* update go.mod

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

---------

Signed-off-by: zyguan <zhongyangguan@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Co-authored-by: zyguan <zhongyangguan@gmail.com>
mittalrishabh pushed a commit to mittalrishabh/tidb that referenced this pull request May 30, 2024
…#53335) (pingcap#96)

* *: add rpc error stats and refine log for diagnose (pingcap#53335)

* sessionctx: add sysvar to control exp feats of replica selector

Signed-off-by: zyguan <zhongyangguan@gmail.com>

* *: add rpc error stats and refine log (pingcap#52810)

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

* store: refine coprocessor error log (pingcap#52729)

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

* *: improve log about stale-read query (pingcap#52494)

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

* *: refine tikv/client-go log to print context information(such as conn id) as much as possible (pingcap#45559)

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

* add leader peer id log

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

* update log

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

* executor: fix issue that some query execution stats was omitted when execution was interrupted (pingcap#51787)

close pingcap#51660

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

* update go.mod

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

---------

Signed-off-by: zyguan <zhongyangguan@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Co-authored-by: zyguan <zhongyangguan@gmail.com>

* Update go.sum

* Update go.mod

---------

Signed-off-by: zyguan <zhongyangguan@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Co-authored-by: crazycs <crazycs520@gmail.com>
Co-authored-by: zyguan <zhongyangguan@gmail.com>
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-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.

some query execution stats was omitted when execution was interrupted
5 participants