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

planner: Removed check for prepared stmt during partition pruning #55631

Merged

Conversation

mjonss
Copy link
Contributor

@mjonss mjonss commented Aug 23, 2024

What problem does this PR solve?

Issue Number: close #55630

Problem Summary:
Prepared statements would always fail partition pruning due to being a prepared statement and parameters not being considered to be constant.

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.

Manual test, see #55630, i.e. using sysbench.

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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/invalid-title do-not-merge/needs-triage-completed sig/planner SIG: Planner size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 23, 2024
Copy link

tiprow bot commented Aug 23, 2024

Hi @mjonss. 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 Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.2899%. Comparing base (ae59dfe) to head (fc3877c).
Report is 175 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55631         +/-   ##
=================================================
- Coverage   72.9705%   59.2899%   -13.6807%     
=================================================
  Files          1581       1766        +185     
  Lines        442751     661944     +219193     
=================================================
+ Hits         323078     392466      +69388     
- Misses        99897     245973     +146076     
- Partials      19776      23505       +3729     
Flag Coverage Δ
integration 40.6178% <ø> (?)
unit 75.3289% <ø> (+3.2759%) ⬆️

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

Components Coverage Δ
dumpling 54.5253% <ø> (+1.5686%) ⬆️
parser ∅ <ø> (∅)
br 54.8419% <ø> (+8.8893%) ⬆️

@mjonss mjonss changed the title Removed check for prepared stmt during partition pruning planner: Removed check for prepared stmt during partition pruning Aug 23, 2024
@mjonss
Copy link
Contributor Author

mjonss commented Aug 24, 2024

Some investigation results:
The removed code was added in #22452 and then in #22953 a related changed required to only allow a single column in the partitioning expression for pruning (COLUMNS partitioning still allows multiple columns, but not as expressions, just direct column references). And in #49161 the partitioning column will be updated for each execution of prepared statements, so it is safe even for executing from the plan cache.
So all-in-all removing this piece of code should be safe (and passes all tests).

@mjonss
Copy link
Contributor Author

mjonss commented Aug 27, 2024

Any tips on how to create a test for this? EXPLAIN FOR CONNECTION will not show partitioning pruning (#55669).

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. and removed do-not-merge/needs-triage-completed labels Aug 28, 2024
@Defined2014 Defined2014 requested a review from qw4990 September 13, 2024 09:06
Copy link

ti-chi-bot bot commented Sep 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, qw4990

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

ti-chi-bot bot commented Sep 20, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-28 09:42:59.867873391 +0000 UTC m=+949775.002323708: ☑️ agreed by Defined2014.
  • 2024-09-20 06:30:25.242793814 +0000 UTC m=+1201894.983217754: ☑️ agreed by qw4990.

Copy link

tiprow bot commented Sep 20, 2024

@mjonss: 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 fc3877c link true /test tidb_parser_test
fast_test_tiprow fc3877c 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.

@ti-chi-bot ti-chi-bot bot merged commit cf954e2 into pingcap:master Sep 20, 2024
21 of 23 checks passed
@mjonss mjonss deleted the fix-pruning-prepared-stmt-not-point-get branch September 20, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prepared statements results fails partition pruning if not PointGet
3 participants