You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tk.MustExec(`CREATE TABLE test_t1 ( a int(11) DEFAULT NULL, b int(11) DEFAULT NULL, c int(11) DEFAULT NULL)`)
325
-
tk.MustQuery("select REGION_ID, DB_NAME, TABLE_NAME, IS_INDEX, INDEX_ID, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t1'").Check(testkit.Rows(
326
-
"1 test test_t1 0 <nil> <nil> 0 <nil>",
353
+
tk.MustQuery("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_ID, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t1'").Check(testkit.Rows(
354
+
"test test_t1 0 <nil> <nil> 0 <nil>",
327
355
))
328
356
329
357
tk.MustExec("alter table test_t1 add index p_a (a)")
330
-
tk.MustQuery("select REGION_ID, DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t1' order by IS_INDEX").Check(testkit.Rows(
331
-
"1 test test_t1 0 <nil> 0 <nil>",
332
-
"1 test test_t1 1 p_a 0 <nil>",
358
+
tk.MustQuery("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t1' order by IS_INDEX").Check(testkit.Rows(
359
+
"test test_t1 0 <nil> 0 <nil>",
360
+
"test test_t1 1 p_a 0 <nil>",
361
+
))
362
+
tableID:=tk.MustQuery("select TIDB_TABLE_ID from information_schema.tables where TABLE_SCHEMA = 'test' and TABLE_NAME = 'test_t1'").Rows()[0][0]
363
+
tk.MustQuery(fmt.Sprintf("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where TABLE_ID = %v order by IS_INDEX", tableID)).Check(testkit.Rows(
tk.MustQuery("select REGION_ID, DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t1' order by IS_INDEX, INDEX_NAME").Check(testkit.Rows(
337
-
"1 test test_t1 0 <nil> 0 <nil>",
338
-
"1 test test_t1 1 p_a 0 <nil>",
339
-
"1 test test_t1 1 p_b 0 <nil>",
369
+
tk.MustQuery("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t1' order by IS_INDEX, INDEX_NAME").Check(testkit.Rows(
370
+
"test test_t1 0 <nil> 0 <nil>",
371
+
"test test_t1 1 p_a 0 <nil>",
372
+
"test test_t1 1 p_b 0 <nil>",
340
373
))
341
374
342
375
tk.MustExec("drop table if exists test_t2")
343
376
tk.MustExec(`CREATE TABLE test_t2 ( a int(11) DEFAULT NULL, b int(11) DEFAULT NULL, c int(11) DEFAULT NULL)
344
377
PARTITION BY RANGE (c) (
345
378
PARTITION p0 VALUES LESS THAN (10),
346
379
PARTITION p1 VALUES LESS THAN (MAXVALUE))`)
347
-
tk.MustQuery("select REGION_ID, DB_NAME, TABLE_NAME, IS_INDEX, INDEX_ID, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t2' order by PARTITION_NAME").Check(testkit.Rows(
348
-
"1 test test_t2 0 <nil> <nil> 1 p0",
349
-
"1 test test_t2 0 <nil> <nil> 1 p1",
380
+
tk.MustQuery("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_ID, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t2' order by PARTITION_NAME").Check(testkit.Rows(
381
+
"test test_t2 0 <nil> <nil> 1 p0",
382
+
"test test_t2 0 <nil> <nil> 1 p1",
350
383
))
351
384
352
385
tk.MustExec("alter table test_t2 add index p_a (a)")
353
-
tk.MustQuery("select REGION_ID, DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t2' order by IS_INDEX, PARTITION_NAME").Check(testkit.Rows(
354
-
"1 test test_t2 0 <nil> 1 p0",
355
-
"1 test test_t2 0 <nil> 1 p1",
356
-
"1 test test_t2 1 p_a 1 p0",
357
-
"1 test test_t2 1 p_a 1 p1",
386
+
tk.MustQuery("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t2' order by IS_INDEX, PARTITION_NAME").Check(testkit.Rows(
tk.MustQuery("select REGION_ID, DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t2' order by IS_INDEX, IS_PARTITION desc, PARTITION_NAME").Check(testkit.Rows(
362
-
"1 test test_t2 0 <nil> 1 p0",
363
-
"1 test test_t2 0 <nil> 1 p1",
364
-
"1 test test_t2 1 p_a 1 p0",
365
-
"1 test test_t2 1 p_a 1 p1",
366
-
"1 test test_t2 1 p_b 0 <nil>",
394
+
tk.MustQuery("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where DB_NAME = 'test' and TABLE_NAME = 'test_t2' order by IS_INDEX, IS_PARTITION desc, PARTITION_NAME").Check(testkit.Rows(
395
+
"test test_t2 0 <nil> 1 p0",
396
+
"test test_t2 0 <nil> 1 p1",
397
+
"test test_t2 1 p_a 1 p0",
398
+
"test test_t2 1 p_a 1 p1",
399
+
"test test_t2 1 p_b 0 <nil>",
400
+
))
401
+
tableID=tk.MustQuery("select TIDB_TABLE_ID from information_schema.tables where TABLE_SCHEMA = 'test' and TABLE_NAME = 'test_t2'").Rows()[0][0]
402
+
tk.MustQuery(fmt.Sprintf("select DB_NAME, TABLE_NAME, IS_INDEX, INDEX_NAME, IS_PARTITION, PARTITION_NAME from information_schema.TIKV_REGION_STATUS where TABLE_ID = %v order by IS_INDEX, IS_PARTITION desc, PARTITION_NAME", tableID)).Check(testkit.Rows(
403
+
"test test_t2 0 <nil> 1 p0",
404
+
"test test_t2 0 <nil> 1 p1",
405
+
"test test_t2 1 p_a 1 p0",
406
+
"test test_t2 1 p_a 1 p1",
407
+
"test test_t2 1 p_b 0 <nil>",
367
408
))
368
409
369
410
// Run the query to ensure virtual schemas are excluded and expect no rows to be returned
tk.MustQuery("SELECT TABLE_NAME,TABLE_TYPE,AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND (TABLE_TYPE='BASE TABLE')").Check(testkit.Rows("t BASE TABLE 0"))
0 commit comments