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, variable: add system variable to control Clustered Index feature #17561

Merged
merged 6 commits into from
Jun 2, 2020

Conversation

coocood
Copy link
Member

@coocood coocood commented Jun 1, 2020

What problem does this PR solve?

Support the clustered index feature.

What is changed and how it works?

Add a global variable to control the clustered index feature.

Check List

Tests

  • Unit test

Side effects

Release note

  • add system variable to control Clustered Index feature

@coocood coocood added the sig/sql-infra SIG: SQL Infra label Jun 1, 2020
@coocood coocood requested a review from lysu June 1, 2020 09:03
@coocood coocood requested a review from wjhuang2016 June 1, 2020 09:07
@wshwsh12 wshwsh12 self-requested a review June 1, 2020 09:17
@codecov
Copy link

codecov bot commented Jun 1, 2020

Codecov Report

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

@@             Coverage Diff             @@
##             master     #17561   +/-   ##
===========================================
  Coverage   79.6443%   79.6443%           
===========================================
  Files           520        520           
  Lines        140806     140806           
===========================================
  Hits         112144     112144           
  Misses        19726      19726           
  Partials       8936       8936           

@@ -1112,3 +1112,39 @@ func (s *testSerialSuite) TestInvisibleIndex(c *C) {
tk.MustQuery("select * from t6").Check(testkit.Rows("1 2"))
tk.MustGetErrCode("alter table t6 drop primary key", errno.ErrPKIndexCantBeInvisible)
}

func (s *testSerialSuite) TestCreateClusteredIndex(c *C) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add some tests for CreateTableLike

ddl/ddl_api.go Outdated
@@ -1505,7 +1505,14 @@ func buildTableInfoWithStmt(ctx sessionctx.Context, s *ast.CreateTableStmt, dbCh
if err = handleTableOptions(s.Options, tbInfo); err != nil {
return nil, errors.Trace(err)
}

if ctx.GetSessionVars().EnableClusteredIndex && !tbInfo.PKIsHandle && !config.GetGlobalConfig().AlterPrimaryKey {
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to move to about L1267 if constr.Tp == ast.ConstraintPrimaryKey and deal with the invisible index checking.

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

Copy link
Contributor

@wshwsh12 wshwsh12 left a comment

Choose a reason for hiding this comment

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

LGTM

@coocood
Copy link
Member Author

coocood commented Jun 2, 2020

/run-all-tests

@coocood
Copy link
Member Author

coocood commented Jun 2, 2020

/run-unit-test

@coocood coocood merged commit 3adb557 into pingcap:master Jun 2, 2020
@coocood coocood deleted the clustered-index-global-var branch June 2, 2020 02:48
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants