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 query hang when sorted column is constant #55418

Merged
merged 12 commits into from
Aug 20, 2024

Conversation

xzhangxian1008
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #55344

Problem Summary:

What changed and how does it work?

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.

Fix the issue that parallel sort may be stuck when sorted column is constant

@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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 14, 2024
Copy link

tiprow bot commented Aug 14, 2024

Hi @xzhangxian1008. 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.

@xzhangxian1008
Copy link
Contributor Author

/cc @hawkingrei @wshwsh12

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

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 72.72727% with 9 lines in your changes missing coverage. Please review.

Project coverage is 74.9805%. Comparing base (afd7b97) to head (6a6ebec).
Report is 41 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55418        +/-   ##
================================================
+ Coverage   72.8661%   74.9805%   +2.1144%     
================================================
  Files          1576       1579         +3     
  Lines        440781     445642      +4861     
================================================
+ Hits         321180     334145     +12965     
+ Misses        99838      91150      -8688     
- Partials      19763      20347       +584     
Flag Coverage Δ
integration 49.1880% <24.2424%> (?)
unit 71.8695% <72.7272%> (-0.0527%) ⬇️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 52.5030% <ø> (+6.5257%) ⬆️

pkg/executor/sortexec/parallel_sort_spill_test.go Outdated Show resolved Hide resolved
pkg/executor/sortexec/sort.go Outdated Show resolved Hide resolved
pkg/executor/sortexec/sort.go Show resolved Hide resolved
@xzhangxian1008
Copy link
Contributor Author

/cc @windtalker

@ti-chi-bot ti-chi-bot bot requested a review from windtalker August 15, 2024 03:06
switch col := by.Expr.(type) {
case *expression.Column:
e.keyColumns = append(e.keyColumns, col.Index)
case *expression.Constant:
Copy link
Contributor

Choose a reason for hiding this comment

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

add some comment here to explain why constant don't need to add to keyColumns

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add some comment here to explain why constant don't need to add to keyColumns

done

// Should not be panic
tk.MustQuery("SELECT t0.c0 FROM t0 WHERE 0 ORDER BY -646041453 ASC;")

tk.MustExec("delete from mysql.opt_rule_blacklist;")
Copy link
Contributor

Choose a reason for hiding this comment

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

should only delete predicate_pushd_down and column_prune

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should only delete predicate_pushd_down and column_prune

done

pkg/executor/sortexec/sort.go Show resolved Hide resolved
pkg/executor/sortexec/sort.go Show resolved Hide resolved
@xzhangxian1008
Copy link
Contributor Author

/cc @windtalker

@ti-chi-bot ti-chi-bot bot requested a review from windtalker August 15, 2024 08:08
@xzhangxian1008
Copy link
Contributor Author

/cc @windtalker

@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 19, 2024
@xzhangxian1008
Copy link
Contributor Author

/cc @windtalker

@ti-chi-bot ti-chi-bot bot requested a review from windtalker August 19, 2024 06:04
@xzhangxian1008
Copy link
Contributor Author

/cc @windtalker

@ti-chi-bot ti-chi-bot bot requested a review from windtalker August 20, 2024 02:30
Copy link
Contributor

@windtalker windtalker 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 Aug 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, windtalker

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:
  • OWNERS [hawkingrei,windtalker]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 20, 2024
Copy link

ti-chi-bot bot commented Aug 20, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-14 14:29:06.061493056 +0000 UTC m=+364630.764962698: ☑️ agreed by hawkingrei.
  • 2024-08-20 02:35:03.660655684 +0000 UTC m=+232898.795105799: ☑️ agreed by windtalker.

@ti-chi-bot ti-chi-bot bot merged commit 07f7d7b into pingcap:master Aug 20, 2024
21 checks passed
@xzhangxian1008 xzhangxian1008 deleted the fix-55344 branch August 20, 2024 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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.

Query is stuck after disabling some optimization rules
3 participants