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

ddl: fix index length calculation (#13727) #13779

Merged
merged 1 commit into from
Dec 16, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Nov 27, 2019

cherry-pick #13727 to release-3.0


What problem does this PR solve?

In MySQL 8.0:

create table t12 (a varchar(1000) primary key);
Error 1071: Specified key was too long; max key length is 3072 bytes

In TiDB master:

create table t12 (a varchar(1000) primary key);
Query OK, 0 rows affected

The default charset is utf8mb4 with at most 4 bytes per character. However, TiDB assumes 1 byte per character by default, which is incorrect.

What is changed and how it works?

  • Rewrite getIndexColumnLength, taking charsets into consideration.
  • Add more tests.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test

Code changes

N/A

Side effects

  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release note

  • ddl: fix the index length calculation logic.

@sre-bot
Copy link
Contributor Author

sre-bot commented Nov 27, 2019

/run-all-tests

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please fix integration-test

@bb7133 bb7133 added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 27, 2019
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AilinKid
Copy link
Contributor

please fix common-test

@AilinKid AilinKid added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 27, 2019
@tangenta
Copy link
Contributor

/run-common-test -tidb-test=pr/958
/run-integration-common-test -tidb-test=pr/958

wjhuang2016
wjhuang2016 previously approved these changes Nov 28, 2019
Copy link
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ngaut ngaut added the status/can-merge Indicates a PR has been approved by a committer. label Nov 29, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Nov 29, 2019

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Nov 29, 2019

@sre-bot merge failed.

@sre-bot
Copy link
Contributor Author

sre-bot commented Nov 29, 2019

failed.

@tangenta
Copy link
Contributor

tangenta commented Dec 2, 2019

/run-common-test -tidb-test=pr/958
/run-integration-common-test -tidb-test=pr/958

@jackysp
Copy link
Member

jackysp commented Dec 6, 2019

Please resolve the conflicts @tangenta

1 similar comment
@zimulala
Copy link
Contributor

Please resolve the conflicts @tangenta

@tangenta
Copy link
Contributor

This PR should be merge together with pingcap/tidb-test#958

@tangenta
Copy link
Contributor

/run-common-test -tidb-test=pr/958
/run-integration-common-test -tidb-test=pr/958

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bb7133
Copy link
Member

bb7133 commented Dec 16, 2019

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Dec 16, 2019

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Dec 16, 2019

@sre-bot merge failed.

@tangenta
Copy link
Contributor

/run-common-test -tidb-test=pr/958
/run-integration-common-test -tidb-test=pr/958

@bb7133 bb7133 merged commit d312f8a into pingcap:release-3.0 Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants