ddl: add test case of show table regions / split table in local temporary … (#26901)

This commit is contained in:
sylzd
2021-08-09 11:17:14 +08:00
committed by GitHub
parent 82173dec13
commit 6720fcd40f

View File

@ -5234,6 +5234,23 @@ func (s *testSplitTable) TestShowTableRegion(c *C) {
_, err = tk.Exec("create global temporary table temporary_table_pre_split(id int ) pre_split_regions=2 ON COMMIT DELETE ROWS;")
c.Assert(err.Error(), Equals, ddl.ErrOptOnTemporaryTable.GenWithStackByArgs("pre split regions").Error())
// Test show table regions and split table on local temporary table
tk.MustExec("drop table if exists t_regions_local_temporary_table")
tk.MustExec("set @@tidb_enable_noop_functions=1;")
tk.MustExec("create temporary table t_regions_local_temporary_table (a int key, b int, c int, index idx(b), index idx2(c));")
// Test show table regions.
_, err = tk.Exec("show table t_regions_local_temporary_table regions")
c.Assert(err.Error(), Equals, plannercore.ErrOptOnTemporaryTable.GenWithStackByArgs("show table regions").Error())
// Test split table.
_, err = tk.Exec("split table t_regions_local_temporary_table between (-10000) and (10000) regions 4;")
c.Assert(err.Error(), Equals, plannercore.ErrOptOnTemporaryTable.GenWithStackByArgs("split table").Error())
_, err = tk.Exec("split partition table t_regions_local_temporary_table partition (p1,p2) index idx between (0) and (20000) regions 2;")
c.Assert(err.Error(), Equals, plannercore.ErrOptOnTemporaryTable.GenWithStackByArgs("split table").Error())
tk.MustExec("drop table if exists t_regions_local_temporary_table")
// Test pre split regions
_, err = tk.Exec("create temporary table local_temporary_table_pre_split(id int ) pre_split_regions=2;")
c.Assert(err.Error(), Equals, ddl.ErrOptOnTemporaryTable.GenWithStackByArgs("pre split regions").Error())
rows := re.Rows()
// Table t_regions should have 5 regions now.
// 4 regions to store record data.