Skip to content

Commit

Permalink
ddl: add test case of show table regions / split table in local tempo…
Browse files Browse the repository at this point in the history
…rary … (#26901)
  • Loading branch information
sylzd authored Aug 9, 2021
1 parent 82173de commit 6720fcd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6720fcd

Please sign in to comment.