tidb
tidb copied to clipboard
planner: Removed check for prepared stmt during partition pruning
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
- [x] 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
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.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
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%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 54.5253% <ø> (+1.5686%) |
:arrow_up: |
| parser | ∅ <ø> (∅) |
|
| br | 54.8419% <ø> (+8.8893%) |
:arrow_up: |
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).
Any tips on how to create a test for this? EXPLAIN FOR CONNECTION will not show partitioning pruning (#55669).
[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
- ~~pkg/planner/OWNERS~~ [qw4990]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
[LGTM Timeline notifier]
Timeline:
2024-08-28 09:42:59.867873391 +0000 UTC m=+949775.002323708: :ballot_box_with_check: agreed by Defined2014.2024-09-20 06:30:25.242793814 +0000 UTC m=+1201894.983217754: :ballot_box_with_check: agreed by qw4990.
@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 | fc3877cee1957391872a3130343f98569f2c66b3 | link | true | /test tidb_parser_test |
| fast_test_tiprow | fc3877cee1957391872a3130343f98569f2c66b3 | 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.