-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: Fix rebuild range for prepared plan #23316
Conversation
Please follow PR Title Format:
Or if the count of mainly changed packages are more than 3, use
|
we need to cherry-pick this critical bug-fix to release 3.0, 4.0, and 5.0 |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
@zz-jason this PR will not works with master branch. But it may work in 4.0 branch. The root cause for fail at master branch still need investigating. |
If comments tidb/planner/core/common_plans.go Line 413 in e56ef47
|
If this commit can also fix #23290, we may also add this issue number in the PR description. @blacktear23 |
@zz-jason After review release-4.0 branch, the code is not same as current master, I think we should create a new PR for other release branches. And I found the code for special process PointGetPlan cache maybe the base cause for those Bugs. The cached PointGetPlan cannot update AccessConditions, so it will generate wrong ranges when variables changes. So I think disable special PointGetPlan cache logic maybe the best way to fix. And I found UseCache is always |
@eurekaka After read your PR, it will fix not cache PointGetPlan, but if enable prepared plan cache and BatchPointGet plan got cached, I think |
After I do the test on your feature branch, yes bugs cannot reproduce now. But your PR just disables PreparedPlanCache for statements with variables. Is that what we expected? |
How does this come? #23238 prevents plans with aggressive optimizations from being cached, because those aggressive optimizations may depend on the user variables. |
In my test I see Anyway the |
I'm going to close this PR since it hasn't been updated for a long time. Feel free to reopen it once you wish to advance this PR in the future. |
What problem does this PR solve?
Issue Number: close #23304 close #23290
Problem Summary:
What is changed and how it works?
What's Changed:
Rebuild ranges for the prepared plan may get the wrong result. This PR will fix the BatchPointGet plan's Handle array to fix newly variables bind and will try to convert BatchPointGet to PointGet when newly variables will only have one handle, and it also can transform PointGet convert to BatchPointGet when variables may generate more than 1 handle.
How it Works:
Related changes
Check List
Tests
Side effects
Release note