-
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 the issue that the optimizer caches wrong TableDual plans under binary protocol #34709
Conversation
[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 submitting an approval review. |
This PR can be covered by our rand-gen tests and it's hard to add binary test cases as UTs, so I didn't add any UT for this PR. I also test this PR locally and it can pass #34678 and #34690. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/78b09f38ef6785c107203792d1411e10ab8a5783 |
TxtProtoVars []expression.Expression // parsed variables under text protocol | ||
BinProtoVars []types.Datum // parsed variables under binary protocol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just rename UsingVars -> TxtProtoVars
, PrepareParams -> BinProtoVars
.
var varsNum int | ||
var binVarTypes []byte | ||
var txtVarTypes []*types.FieldType | ||
isBinProtocol := len(e.BinProtoVars) > 0 | ||
if isBinProtocol { // binary protocol | ||
varsNum = len(e.BinProtoVars) | ||
for _, param := range e.BinProtoVars { | ||
binVarTypes = append(binVarTypes, param.Kind()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot parse variable types correctly under binary protocol before.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 0b1590a
|
/merge |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.3 in PR #34736 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.4 in PR #34737 |
cherry pick to release-6.0 in PR #34738 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
TiDB MergeCI notify🔴 Bad News! New failing [1] after this pr merged.
|
What problem does this PR solve?
Issue Number: close #34678, close #34690
Problem Summary: fix the issue that the optimizer caches wrong TableDual plans under binary protocol
What is changed and how it works?
We didn't consider binary protocol when checking whether variable types are changed in
getPhyscalPlan
before.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.