Skip to content

Commit

Permalink
Merge branch 'master' into ballast-pr-to-master
Browse files Browse the repository at this point in the history
  • Loading branch information
hnes committed Oct 26, 2021
2 parents db6d815 + 7b4ca57 commit b31be95
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion errno/errcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ const (
ErrPlacementPolicyNotExists = 8239
ErrPlacementPolicyWithDirectOption = 8240
ErrPlacementPolicyInUse = 8241

ErrOptOnCacheTable = 8242
// TiKV/PD/TiFlash errors.
ErrPDServerTimeout = 9001
ErrTiKVServerTimeout = 9002
Expand Down
2 changes: 1 addition & 1 deletion errno/errname.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ var MySQLErrName = map[uint16]*mysql.ErrMessage{
ErrPlacementPolicyNotExists: mysql.Message("Unknown placement policy '%-.192s'", nil),
ErrPlacementPolicyWithDirectOption: mysql.Message("Placement policy '%s' can't co-exist with direct placement options", nil),
ErrPlacementPolicyInUse: mysql.Message("Placement policy '%-.192s' is still in use", nil),

ErrOptOnCacheTable: mysql.Message("'%s' is unsupported on cache tables.", nil),
// TiKV/PD errors.
ErrPDServerTimeout: mysql.Message("PD server timeout", nil),
ErrTiKVServerTimeout: mysql.Message("TiKV server timeout", nil),
Expand Down
5 changes: 5 additions & 0 deletions errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,11 @@ error = '''
invalid as of timestamp: %s
'''

["planner:8242"]
error = '''
'%s' is unsupported on cache tables.
'''

["privilege:1141"]
error = '''
There is no such grant defined for user '%-.48s' on host '%-.255s'
Expand Down
30 changes: 29 additions & 1 deletion executor/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,35 @@ func (s *testSuite5) TestAdminCheckIndexInLocalTemporaryMode(c *C) {
c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table").Error())
tk.MustExec("drop table if exists local_temporary_admin_checksum_table_with_index_test,local_temporary_admin_checksum_table_without_index_test;")
}

func (s *testSuite5) TestAdminCheckIndexInCacheTable(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists cache_admin_test;")
tk.MustExec("create table cache_admin_test (c1 int, c2 int, c3 int default 1, index (c1), unique key(c2))")
tk.MustExec("insert cache_admin_test (c1, c2) values (1, 1), (2, 2), (5, 5), (10, 10), (11, 11)")
tk.MustExec("alter table cache_admin_test cache")
tk.MustExec("admin check table cache_admin_test;")
tk.MustExec("admin check index cache_admin_test c1;")
tk.MustExec("admin check index cache_admin_test c2;")
tk.MustExec(`drop table if exists check_index_test;`)
tk.MustExec(`create table check_index_test (a int, b varchar(10), index a_b (a, b), index b (b))`)
tk.MustExec(`insert check_index_test values (3, "ab"),(2, "cd"),(1, "ef"),(-1, "hi")`)
tk.MustExec("alter table check_index_test cache")
result := tk.MustQuery("admin check index check_index_test a_b (2, 4);")
result.Check(testkit.Rows("1 ef 3", "2 cd 2"))
result = tk.MustQuery("admin check index check_index_test a_b (3, 5);")
result.Check(testkit.Rows("-1 hi 4", "1 ef 3"))
tk.MustExec("drop table if exists cache_admin_test;")
tk.MustExec("drop table if exists cache_admin_table_with_index_test;")
tk.MustExec("drop table if exists cache_admin_table_without_index_test;")
tk.MustExec("create table cache_admin_table_with_index_test (id int, count int, PRIMARY KEY(id), KEY(count))")
tk.MustExec("create table cache_admin_table_without_index_test (id int, count int, PRIMARY KEY(id))")
tk.MustExec("alter table cache_admin_table_with_index_test cache")
tk.MustExec("alter table cache_admin_table_without_index_test cache")
tk.MustExec("admin checksum table cache_admin_table_with_index_test;")
tk.MustExec("admin checksum table cache_admin_table_without_index_test;")
tk.MustExec("drop table if exists cache_admin_table_with_index_test,cache_admin_table_without_index_test;")
}
func (s *testSuite5) TestAdminRecoverIndex(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
Expand Down
1 change: 1 addition & 0 deletions planner/core/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ var (
ErrNotSupportedWithSem = dbterror.ClassOptimizer.NewStd(mysql.ErrNotSupportedWithSem)
ErrAsOf = dbterror.ClassOptimizer.NewStd(mysql.ErrAsOf)
ErrOptOnTemporaryTable = dbterror.ClassOptimizer.NewStd(mysql.ErrOptOnTemporaryTable)
ErrOptOnCacheTable = dbterror.ClassOptimizer.NewStd(mysql.ErrOptOnCacheTable)
ErrDropTableOnTemporaryTable = dbterror.ClassOptimizer.NewStd(mysql.ErrDropTableOnTemporaryTable)
// ErrPartitionNoTemporary returns when partition at temporary mode
ErrPartitionNoTemporary = dbterror.ClassOptimizer.NewStd(mysql.ErrPartitionNoTemporary)
Expand Down

0 comments on commit b31be95

Please sign in to comment.