Skip to content

Commit

Permalink
merge master & fix conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: shirly <AndreMouche@126.com>
  • Loading branch information
AndreMouche committed Jul 15, 2021
2 parents 9269a51 + 0516e36 commit bee358b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 69 deletions.
16 changes: 8 additions & 8 deletions ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
checkErr = err1
break
}
checkErr = checkResult(result, testkit.Rows("t 0 PRIMARY 1 c1 A 0 <nil> <nil> BTREE YES NULL NO"))
checkErr = checkResult(result, testkit.Rows("t 0 PRIMARY 1 c1 A 0 <nil> <nil> BTREE YES <nil> NO"))
}
}

Expand All @@ -957,8 +957,8 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
result, err := s.execQuery(tk, showIndexSQL)
c.Assert(err, IsNil)
err = checkResult(result, testkit.Rows(
"t 0 PRIMARY 1 c1 A 0 <nil> <nil> BTREE YES NULL NO",
"t 1 c2 1 c2 A 0 <nil> <nil> YES BTREE YES NULL NO",
"t 0 PRIMARY 1 c1 A 0 <nil> <nil> BTREE YES <nil> NO",
"t 1 c2 1 c2 A 0 <nil> <nil> YES BTREE YES <nil> NO",
))
c.Assert(err, IsNil)
d.(ddl.DDLForTest).SetHook(originalCallback)
Expand Down Expand Up @@ -986,7 +986,7 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
c.Assert(err, IsNil)
result, err = s.execQuery(tk, "show index from tr;")
c.Assert(err, IsNil)
err = checkResult(result, testkit.Rows("tr 1 idx1 1 purchased A 0 <nil> <nil> YES BTREE YES NULL NO"))
err = checkResult(result, testkit.Rows("tr 1 idx1 1 purchased A 0 <nil> <nil> YES BTREE YES <nil> NO"))
c.Assert(err, IsNil)

_, err = s.se.Execute(context.Background(), "drop table if exists tr")
Expand All @@ -995,7 +995,7 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
c.Assert(err, IsNil)
result, err = s.execQuery(tk, "show index from tr")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES", "tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES NULL NO")), IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES", "tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES <nil> NO")), IsNil)
result, err = s.execQuery(tk, "select key_name, clustered from information_schema.tidb_indexes where table_name = 'tr' order by key_name")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("PRIMARY YES", "vv NO")), IsNil)
Expand All @@ -1006,7 +1006,7 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
c.Assert(err, IsNil)
result, err = s.execQuery(tk, "show index from tr")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES NULL NO", "tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO")), IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES <nil> NO", "tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO")), IsNil)
result, err = s.execQuery(tk, "select key_name, clustered from information_schema.tidb_indexes where table_name = 'tr' order by key_name")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("PRIMARY NO", "vv NO")), IsNil)
Expand All @@ -1017,7 +1017,7 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
c.Assert(err, IsNil)
result, err = s.execQuery(tk, "show index from tr")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES NULL NO", "tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES")), IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES <nil> NO", "tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES")), IsNil)
result, err = s.execQuery(tk, "select key_name, clustered from information_schema.tidb_indexes where table_name = 'tr' order by key_name")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("PRIMARY YES", "vv NO")), IsNil)
Expand All @@ -1028,7 +1028,7 @@ func (s *testStateChangeSuite) TestShowIndex(c *C) {
c.Assert(err, IsNil)
result, err = s.execQuery(tk, "show index from tr")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES NULL NO", "tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO")), IsNil)
c.Assert(checkResult(result, testkit.Rows("tr 1 vv 1 v A 0 <nil> <nil> YES BTREE YES <nil> NO", "tr 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO")), IsNil)
result, err = s.execQuery(tk, "select key_name, clustered from information_schema.tidb_indexes where table_name = 'tr' order by key_name")
c.Assert(err, IsNil)
c.Assert(checkResult(result, testkit.Rows("PRIMARY NO", "vv NO")), IsNil)
Expand Down
8 changes: 4 additions & 4 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (w *worker) typeStr() string {
case generalWorker:
str = "general"
case addIdxWorker:
str = model.AddIndexStr
str = "add index"
default:
str = "unknown"
}
Expand Down Expand Up @@ -444,8 +444,8 @@ func isDependencyJobDone(t *meta.Meta, job *model.Job) (bool, error) {
return true, nil
}

func newMetaWithQueueTp(txn kv.Transaction, tp string) *meta.Meta {
if tp == model.AddIndexStr || tp == model.AddPrimaryKeyStr {
func newMetaWithQueueTp(txn kv.Transaction, tp workerType) *meta.Meta {
if tp == addIdxWorker {
return meta.NewMeta(txn, meta.AddIndexJobListKey)
}
return meta.NewMeta(txn)
Expand Down Expand Up @@ -473,7 +473,7 @@ func (w *worker) handleDDLJobQueue(d *ddlCtx) error {
}

var err error
t := newMetaWithQueueTp(txn, w.typeStr())
t := newMetaWithQueueTp(txn, w.tp)
// We become the owner. Get the first job and run it.
job, err = w.getFirstDDLJob(t)
if job == nil || err != nil {
Expand Down
22 changes: 11 additions & 11 deletions executor/seqtest/seq_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,17 @@ func (s *seqTestSuite) TestShow(c *C) {
tk.MustExec(`create index expr_idx on show_index ((id*2+1))`)
testSQL = "SHOW index from show_index;"
tk.MustQuery(testSQL).Check(testutil.RowsWithSep("|",
"show_index|0|PRIMARY|1|id|A|0|<nil>|<nil>||BTREE| |YES|NULL|YES",
"show_index|1|cIdx|1|c|A|0|<nil>|<nil>|YES|HASH||index_comment_for_cIdx|YES|NULL|NO",
"show_index|1|idx1|1|id|A|0|<nil>|<nil>||HASH| |YES|NULL|NO",
"show_index|1|idx2|1|id|A|0|<nil>|<nil>||BTREE||idx|YES|NULL|NO",
"show_index|1|idx3|1|id|A|0|<nil>|<nil>||HASH||idx|YES|NULL|NO",
"show_index|1|idx4|1|id|A|0|<nil>|<nil>||BTREE||idx|YES|NULL|NO",
"show_index|1|idx5|1|id|A|0|<nil>|<nil>||BTREE||idx|YES|NULL|NO",
"show_index|1|idx6|1|id|A|0|<nil>|<nil>||HASH| |YES|NULL|NO",
"show_index|1|idx7|1|id|A|0|<nil>|<nil>||BTREE| |YES|NULL|NO",
"show_index|1|idx8|1|id|A|0|<nil>|<nil>||BTREE| |YES|NULL|NO",
"show_index|1|idx9|1|id|A|0|<nil>|<nil>||BTREE| |NO|NULL|NO",
"show_index|0|PRIMARY|1|id|A|0|<nil>|<nil>||BTREE| |YES|<nil>|YES",
"show_index|1|cIdx|1|c|A|0|<nil>|<nil>|YES|HASH||index_comment_for_cIdx|YES|<nil>|NO",
"show_index|1|idx1|1|id|A|0|<nil>|<nil>||HASH| |YES|<nil>|NO",
"show_index|1|idx2|1|id|A|0|<nil>|<nil>||BTREE||idx|YES|<nil>|NO",
"show_index|1|idx3|1|id|A|0|<nil>|<nil>||HASH||idx|YES|<nil>|NO",
"show_index|1|idx4|1|id|A|0|<nil>|<nil>||BTREE||idx|YES|<nil>|NO",
"show_index|1|idx5|1|id|A|0|<nil>|<nil>||BTREE||idx|YES|<nil>|NO",
"show_index|1|idx6|1|id|A|0|<nil>|<nil>||HASH| |YES|<nil>|NO",
"show_index|1|idx7|1|id|A|0|<nil>|<nil>||BTREE| |YES|<nil>|NO",
"show_index|1|idx8|1|id|A|0|<nil>|<nil>||BTREE| |YES|<nil>|NO",
"show_index|1|idx9|1|id|A|0|<nil>|<nil>||BTREE| |NO|<nil>|NO",
"show_index|1|expr_idx|1|NULL|A|0|<nil>|<nil>|YES|BTREE| |YES|(`id` * 2 + 1)|NO",
))

Expand Down
4 changes: 2 additions & 2 deletions executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func (e *ShowExec) fetchShowIndex() error {
"", // Comment
"", // Index_comment
"YES", // Index_visible
"NULL", // Expression
nil, // Expression
"YES", // Clustered
})
}
Expand Down Expand Up @@ -611,7 +611,7 @@ func (e *ShowExec) fetchShowIndex() error {
}

colName := col.Name.O
expression := "NULL"
var expression interface{}
if tblCol.Hidden {
colName = "NULL"
expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString)
Expand Down
24 changes: 12 additions & 12 deletions executor/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1308,20 +1308,20 @@ func (s *testSuite5) TestIssue19507(c *C) {
tk.MustExec("use test")
tk.MustExec("CREATE TABLE t2(a int primary key, b int unique, c int not null, unique index (c));")
tk.MustQuery("SHOW INDEX IN t2;").Check(
testutil.RowsWithSep("|", "t2|0|PRIMARY|1|a|A|0|<nil>|<nil>||BTREE|||YES|NULL|YES",
"t2|0|c|1|c|A|0|<nil>|<nil>||BTREE|||YES|NULL|NO",
"t2|0|b|1|b|A|0|<nil>|<nil>|YES|BTREE|||YES|NULL|NO"))
testutil.RowsWithSep("|", "t2|0|PRIMARY|1|a|A|0|<nil>|<nil>||BTREE|||YES|<nil>|YES",
"t2|0|c|1|c|A|0|<nil>|<nil>||BTREE|||YES|<nil>|NO",
"t2|0|b|1|b|A|0|<nil>|<nil>|YES|BTREE|||YES|<nil>|NO"))

tk.MustExec("CREATE INDEX t2_b_c_index ON t2 (b, c);")
tk.MustExec("CREATE INDEX t2_c_b_index ON t2 (c, b);")
tk.MustQuery("SHOW INDEX IN t2;").Check(
testutil.RowsWithSep("|", "t2|0|PRIMARY|1|a|A|0|<nil>|<nil>||BTREE|||YES|NULL|YES",
"t2|0|c|1|c|A|0|<nil>|<nil>||BTREE|||YES|NULL|NO",
"t2|0|b|1|b|A|0|<nil>|<nil>|YES|BTREE|||YES|NULL|NO",
"t2|1|t2_b_c_index|1|b|A|0|<nil>|<nil>|YES|BTREE|||YES|NULL|NO",
"t2|1|t2_b_c_index|2|c|A|0|<nil>|<nil>||BTREE|||YES|NULL|NO",
"t2|1|t2_c_b_index|1|c|A|0|<nil>|<nil>||BTREE|||YES|NULL|NO",
"t2|1|t2_c_b_index|2|b|A|0|<nil>|<nil>|YES|BTREE|||YES|NULL|NO"))
testutil.RowsWithSep("|", "t2|0|PRIMARY|1|a|A|0|<nil>|<nil>||BTREE|||YES|<nil>|YES",
"t2|0|c|1|c|A|0|<nil>|<nil>||BTREE|||YES|<nil>|NO",
"t2|0|b|1|b|A|0|<nil>|<nil>|YES|BTREE|||YES|<nil>|NO",
"t2|1|t2_b_c_index|1|b|A|0|<nil>|<nil>|YES|BTREE|||YES|<nil>|NO",
"t2|1|t2_b_c_index|2|c|A|0|<nil>|<nil>||BTREE|||YES|<nil>|NO",
"t2|1|t2_c_b_index|1|c|A|0|<nil>|<nil>||BTREE|||YES|<nil>|NO",
"t2|1|t2_c_b_index|2|b|A|0|<nil>|<nil>|YES|BTREE|||YES|<nil>|NO"))
}

// TestShowPerformanceSchema tests for Issue 19231
Expand All @@ -1331,8 +1331,8 @@ func (s *testSuite5) TestShowPerformanceSchema(c *C) {
// However, its not possible to create a new performance_schema table since its a special in memory table.
// Instead the test below uses the default index on the table.
tk.MustQuery("SHOW INDEX FROM performance_schema.events_statements_summary_by_digest").Check(
testkit.Rows("events_statements_summary_by_digest 0 SCHEMA_NAME 1 SCHEMA_NAME A 0 <nil> <nil> YES BTREE YES NULL NO",
"events_statements_summary_by_digest 0 SCHEMA_NAME 2 DIGEST A 0 <nil> <nil> YES BTREE YES NULL NO"))
testkit.Rows("events_statements_summary_by_digest 0 SCHEMA_NAME 1 SCHEMA_NAME A 0 <nil> <nil> YES BTREE YES <nil> NO",
"events_statements_summary_by_digest 0 SCHEMA_NAME 2 DIGEST A 0 <nil> <nil> YES BTREE YES <nil> NO"))
}

func (s *testSuite5) TestShowTemporaryTable(c *C) {
Expand Down
64 changes: 32 additions & 32 deletions session/clustered_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ func (s *testClusteredSerialSuite) TestCreateClusteredTable(c *C) {
tk.MustExec("create table t6(id varchar(10) primary key nonclustered, v int)")
tk.MustExec("create table t7(id varchar(10), v int, primary key (id) /*T![clustered_index] CLUSTERED */)")
tk.MustExec("create table t8(id varchar(10), v int, primary key (id) /*T![clustered_index] NONCLUSTERED */)")
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))

tk.MustExec("set @@tidb_enable_clustered_index = 'off';")
tk.MustExec("drop table if exists t1, t2, t3, t4, t5, t6, t7, t8")
Expand All @@ -349,14 +349,14 @@ func (s *testClusteredSerialSuite) TestCreateClusteredTable(c *C) {
tk.MustExec("create table t6(id varchar(10) primary key nonclustered, v int)")
tk.MustExec("create table t7(id varchar(10), v int, primary key (id) /*T![clustered_index] CLUSTERED */)")
tk.MustExec("create table t8(id varchar(10), v int, primary key (id) /*T![clustered_index] NONCLUSTERED */)")
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))

tk.MustExec("set @@tidb_enable_clustered_index = 'on';")
tk.MustExec("drop table if exists t1, t2, t3, t4, t5, t6, t7, t8")
Expand All @@ -368,14 +368,14 @@ func (s *testClusteredSerialSuite) TestCreateClusteredTable(c *C) {
tk.MustExec("create table t6(id varchar(10) primary key nonclustered, v int)")
tk.MustExec("create table t7(id varchar(10), v int, primary key (id) /*T![clustered_index] CLUSTERED */)")
tk.MustExec("create table t8(id varchar(10), v int, primary key (id) /*T![clustered_index] NONCLUSTERED */)")
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))

tk.MustExec("set @@tidb_enable_clustered_index = 'int_only';")
defer config.RestoreFunc()()
Expand All @@ -391,14 +391,14 @@ func (s *testClusteredSerialSuite) TestCreateClusteredTable(c *C) {
tk.MustExec("create table t6(id varchar(10) primary key nonclustered, v int)")
tk.MustExec("create table t7(id varchar(10), v int, primary key (id) /*T![clustered_index] CLUSTERED */)")
tk.MustExec("create table t8(id varchar(10), v int, primary key (id) /*T![clustered_index] NONCLUSTERED */)")
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES NULL NO"))
tk.MustQuery("show index from t1").Check(testkit.Rows("t1 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t2").Check(testkit.Rows("t2 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t3").Check(testkit.Rows("t3 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t4").Check(testkit.Rows("t4 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t5").Check(testkit.Rows("t5 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t6").Check(testkit.Rows("t6 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
tk.MustQuery("show index from t7").Check(testkit.Rows("t7 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> YES"))
tk.MustQuery("show index from t8").Check(testkit.Rows("t8 0 PRIMARY 1 id A 0 <nil> <nil> BTREE YES <nil> NO"))
}

// Test for union scan in prefixed clustered index table.
Expand Down

0 comments on commit bee358b

Please sign in to comment.