-
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
ddl, config: add a variable to control the max index length #15012
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15012 +/- ##
===========================================
Coverage ? 80.2819%
===========================================
Files ? 502
Lines ? 131458
Branches ? 0
===========================================
Hits ? 105537
Misses ? 17553
Partials ? 8368 |
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.
LGTM
config/config.go
Outdated
// DefMaxIndexLength is the maximum index length. This value is consistent with MySQL. | ||
DefMaxIndexLength = 3072 | ||
// DefTiDBMaxIndexLength is the maximum index length for TiDB v3.0.7 and previous version. | ||
DefTiDBMaxIndexLength = 3072 * 4 |
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.
In the old implementation, the index length was not in bytes, but in characters.
That means if we set max-index-length
to 12288 (3072 * 4), the following statement is valid in current PR but it is invalid in TiDB v3.0.7-.
create table t12 (a varchar(12288) character set ascii primary key);
Is it acceptable?
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.
It is acceptable.
We want to make the following statement is valid in current TiDB like in TiDB v3.0.7-.
create table t12 (a varchar(3072) character set utf8mb4 primary key);
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.
LGTM
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.
LGTM
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.
LGTM
/run-all-tests |
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-3.0 in PR #15057 |
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-4.0 in PR #15083 |
What problem does this PR solve?
Before #13727(v3.0.8):
After #13727:
Therefore, in v3.0.8 and after, such statements will report an error, which is not compatible with the behavior of versions before v3.0.8.
What is changed and how it works?
Add a variable to control the max index length. And the value range is [3072, 3072*4].
The default value is 3072, it is consistent with MySQL.
Check List
Tests
Related changes
Release note