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: fix the issue that the optimizer caches wrong TableDual plans under binary protocol #34709

Merged
merged 8 commits into from May 17, 2022

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented May 16, 2022

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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
Copy link
Member

ti-chi-bot commented May 16, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Reminiscent
  • winoros

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none do-not-merge/needs-triage-completed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2022
@qw4990 qw4990 added sig/planner SIG: Planner epic/plan-cache type/bug-fix This PR fixes a bug. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2022
@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Type: Need cherry pick to release-5.4 needs-cherry-pick-6.0 and removed do-not-merge/needs-triage-completed labels May 16, 2022
@qw4990
Copy link
Contributor Author

qw4990 commented May 16, 2022

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.

@sre-bot
Copy link
Contributor

sre-bot commented May 16, 2022

@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 17, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 17, 2022
Comment on lines +193 to +194
TxtProtoVars []expression.Expression // parsed variables under text protocol
BinProtoVars []types.Datum // parsed variables under binary protocol
Copy link
Contributor Author

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.

Comment on lines +460 to +468
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())
}
Copy link
Contributor Author

@qw4990 qw4990 May 17, 2022

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.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 17, 2022
@winoros
Copy link
Member

winoros commented May 17, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 0b1590a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 17, 2022
@qw4990
Copy link
Contributor Author

qw4990 commented May 17, 2022

/merge

@ti-chi-bot ti-chi-bot merged commit 0ac659b into pingcap:master May 17, 2022
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 17, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 in PR #34736

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 17, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.4 in PR #34737

@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 in PR #34738

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 17, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented May 17, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [1] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🟥 failed 1, success 33, total 34 1 hr 9 min New failing
idc-jenkins-ci-tidb/integration-common-test 🔴 failed 8, success 3, total 11 14 min Existing failure
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 40 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 13 min Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 13 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 10 min Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 8 min 4 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 6 min 6 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

ti-chi-bot pushed a commit that referenced this pull request Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/plan-cache needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Type: Need cherry pick to release-5.4 release-note-none sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enum column in binary protocol time column in binary protocol
6 participants