-
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
*: use CLUSTERED and NONCLUSTERED to control primary key type #22409
Conversation
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
e06eb40
to
eda4d82
Compare
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
2 similar comments
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
bdc313b
to
46fad2f
Compare
46fad2f
to
34fb11a
Compare
tbInfo.IsCommonHandle = true | ||
} | ||
case model.PrimaryKeyTypeDefault: | ||
if isSingleIntPK(constr, lastCol) { | ||
tbInfo.PKIsHandle = !alterPKConf |
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.
Add && ctx.GetSessionVars().EnableClusteredIndex
either to make it consistent with common handle?
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.
A lot of tests will be broken. Let's do this in another PR when it is decided.
Please fix CI. |
LGTM |
if isSingleIntPK(constr, lastCol) { | ||
tbInfo.PKIsHandle = !alterPKConf | ||
} else { | ||
tbInfo.IsCommonHandle = !alterPKConf && ctx.GetSessionVars().EnableClusteredIndex |
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.
Shall we return a warning if model.PrimaryKeyTypeClustered && !ctx.GetSessionVars().EnableClusteredIndex
?
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.
No, the variable has lower priority.
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
LGTM |
/merge |
/run-all-tests |
@tangenta merge failed. |
/run-common-test tidb-test=pr/1161 |
/run-integration-ddl-test |
/merge |
/merge |
/run-all-tests |
@tangenta merge failed. |
/run-all-tests |
What problem does this PR solve?
Issue Number: close #22346
Problem Summary:
As mentioned in #22346, it is not intuitive to set the session variable before creating a table. What’s more, it is also inconvenient to change the variable back and forth in the case of mix usage.
What is changed and how it works?
What's Changed:
CLUSTERED
andNONCLUSTERED
keywords).tidb_enable_clustered_index
and the config optionalter-primary-key
./*!T[clustered_index] xxx */
is added in the output from binlog andSHOW CREATE TABLE
.tidb_pk_type
ininformation_schema.tables
to{CLUSTERED, NON_CLUSTERED}
.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
N/A
Release note
CLUSTERED
andNONCLUSTERED
keywords to specify the primary key type inCREATE TABLE
statements.