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

Got updateBindinfo error when upgrade from 4.x to 5.x #27064

Closed
guo-shaoge opened this issue Aug 10, 2021 · 8 comments
Closed

Got updateBindinfo error when upgrade from 4.x to 5.x #27064

guo-shaoge opened this issue Aug 10, 2021 · 8 comments
Assignees
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug. wontfix This issue will not be fixed.

Comments

@guo-shaoge
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. In a cluster v4.0.14, use the following SQL to create bind

    drop table if exists t;
    create table t(a int primary key);
    select * from ( (select * from t) as x), t;
    create global binding for select * from ( (select * from t) as x) inner join t on x.a = t.a using select /*+ hash_join(x, t) */ * from ( (select * from t) as x) inner join t on x.a = t.a;

  2. upgrade to v5.0.3, we got the following errors:

    [FATAL] [bootstrap.go:1419] ["updateBindInfo error"] [error="line 1 column 72 near "AS x) JOIN test.t ON x.a = t.a" "] [stack="github.com/pingcap/tidb/session.updateBindInfo\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/bootstrap.go:1419\ngithub.com/pingcap/tidb/session.upgradeToVer67\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/bootstrap.go:1387\ngithub.com/pingcap/tidb/session.upgrade\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/bootstrap.go:639\ngithub.com/pingcap/tidb/session.runInBootstrapSession\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/session.go:2304\ngithub.com/pingcap/tidb/session.BootstrapSession\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/session.go:2175\nmain.createStoreAndDomain\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/tidb-server/main.go:269\nmain.main\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/tidb-server/main.go:183\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"]

2. What did you expect to see? (Required)

upgrade successfully.

3. What did you see instead (Required)

upgrade failed.

4. What is your TiDB version? (Required)

v5.x

suggestion:

In v4.x select * from ( (select * from t) as x), t; is valid. But we got parser error in v5.x. That's why upgrade is failed. But this behavior is compatible with MySQL8.0. So may be we should record the orginal sql instead of the sql parsed by AST Tree.

@guo-shaoge guo-shaoge added the type/bug The issue is confirmed as a bug. label Aug 10, 2021
@guo-shaoge
Copy link
Collaborator Author

Looks like same problem with asktug.

@Reminiscent
Copy link
Contributor

/assign

@Reminiscent
Copy link
Contributor

Reminiscent commented Aug 11, 2021

The behavior here is expected. If SQL fails to pass the parser check in the new version, an error will be generated when the corresponding binding is first loaded after the upgrade. We need to manually delete the binding that corresponds to the error so that it can be started after the upgrade. So, please check whether the bind_sql's syntax is right before the upgrade. This will be added to the upgrade checklist.
Besides, if you find some SQL stmt can pass to the parser check, but it failed to upgrade success or its bind_sql can not pass the parser check. Please open an issue and connect me.

@Reminiscent
Copy link
Contributor

/close

@ti-chi-bot
Copy link
Member

@Reminiscent: Closing this issue.

In response to this:

/close

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/test-infra repository.

@ti-srebot
Copy link
Contributor

ti-srebot commented Aug 12, 2021

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

[4.0.0:4.0.14],[5.0.0:5.0.3],[5.1.0:5.1.1]

6. Fixed versions

@guo-shaoge
Copy link
Collaborator Author

Do we have link of the checklist?

@ti-srebot
Copy link
Contributor

( FixedVersions ) fields are empty.

@tisonkun tisonkun added the wontfix This issue will not be fixed. label Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug. wontfix This issue will not be fixed.
Projects
None yet
Development

No branches or pull requests

8 participants