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: add check for max index key length when alter modify/change column #11220

Merged
merged 17 commits into from
Jul 23, 2019

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

create table t1 (a varchar(10),b varchar(100),c tinyint,index(a),index(a,b),index (b,c));
alter table t1 modify column a varchar(3000); -- should return error.

MySQL

create table t1 (a varchar(10),b varchar(100),c tinyint,index(a),index(a,b),index (b,c));
alter table t1 modify column a varchar(3000);
(1071, u'Specified key was too long; max key length is 3072 bytes')

TiDB

create table t1 (a varchar(10),b varchar(100),c tinyint,index(a),index(a,b),index (b,c));
alter table t1 modify column a varchar(3000); -- execute sucessfully.

What is changed and how it works?

  • add check for max index key length when alter modify/change column

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch

@crazycs520
Copy link
Contributor Author

/run-all-tests

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #11220 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #11220   +/-   ##
===========================================
  Coverage   81.6297%   81.6297%           
===========================================
  Files           423        423           
  Lines         91719      91719           
===========================================
  Hits          74870      74870           
  Misses        11549      11549           
  Partials       5300       5300

@crazycs520 crazycs520 added type/compatibility and removed type/bugfix This PR fixes a bug. labels Jul 11, 2019
@crazycs520
Copy link
Contributor Author

/run-all-tests

1 similar comment
@crazycs520
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@winkyao
Copy link
Contributor

winkyao commented Jul 12, 2019

/rebuild

@crazycs520
Copy link
Contributor Author

/run-all-tests

@lysu
Copy link
Contributor

lysu commented Jul 15, 2019

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests tidb-test=pr/858

@crazycs520
Copy link
Contributor Author

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

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

ddl/index.go Show resolved Hide resolved
@sre-bot sre-bot mentioned this pull request Jul 19, 2019
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests tidb-test=pr/858

@crazycs520
Copy link
Contributor Author

/run-all-tests tidb-test=pr/858

@crazycs520
Copy link
Contributor Author

/run-common-test tidb-test=pr/858

@crazycs520
Copy link
Contributor Author

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

@crazycs520 crazycs520 added the status/LGT2 Indicates that a PR has LGTM 2. label Jul 22, 2019
@tangenta
Copy link
Contributor

What is the negative result of exceeding the max length(3072) in TiDB? Do we need to be compatible with MySQL's weakness?

Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

Rest LGTM

ddl/ddl_api.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

LGTM

@crazycs520 crazycs520 added status/LGT3 The PR has already had 3 LGTM. status/all tests passed and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jul 23, 2019
@crazycs520 crazycs520 merged commit eb9e749 into pingcap:master Jul 23, 2019
@imtbkcat
Copy link

@crazycs520 Please cherry-pick this pr to release-3.0.

@sre-bot
Copy link
Contributor

sre-bot commented Jul 23, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Jul 23, 2019

cherry pick to release-3.0 in PR #11395

sre-bot added a commit that referenced this pull request Jul 24, 2019
@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

It seems that, not for sure, we failed to cherry-pick this commit to release-2.1. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @crazycs520 PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra status/LGT3 The PR has already had 3 LGTM. type/bugfix This PR fixes a bug. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants