Skip to content

Commit

Permalink
ddl: add admin_check_index compatibility for temporary table (#26465)
Browse files Browse the repository at this point in the history
  • Loading branch information
Howie59 authored Aug 3, 2021
1 parent 6a84ce3 commit 352f609
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions executor/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ func (s *testSuite5) TestAdminCheckIndexInTemporaryMode(c *C) {
tk.MustExec("insert temporary_admin_test (c1, c2) values (1, 1), (2, 2), (3, 3);")
_, err := tk.Exec("admin check table temporary_admin_test;")
c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin check table").Error())
_, err = tk.Exec("admin check index temporary_admin_test c1;")
c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin check index").Error())
tk.MustExec("drop table if exists temporary_admin_test;")

tk.MustExec("drop table if exists non_temporary_admin_test;")
Expand Down
6 changes: 4 additions & 2 deletions planner/core/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,13 @@ func (p *preprocessor) checkAdminCheckTableGrammar(stmt *ast.AdminStmt) {
return
}
tempTableType := tableInfo.Meta().TempTableType
if (stmt.Tp == ast.AdminCheckTable || stmt.Tp == ast.AdminChecksumTable) && tempTableType != model.TempTableNone {
if (stmt.Tp == ast.AdminCheckTable || stmt.Tp == ast.AdminChecksumTable || stmt.Tp == ast.AdminCheckIndex) && tempTableType != model.TempTableNone {
if stmt.Tp == ast.AdminChecksumTable {
p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table")
} else {
} else if stmt.Tp == ast.AdminCheckTable {
p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin check table")
} else {
p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin check index")
}
return
}
Expand Down

0 comments on commit 352f609

Please sign in to comment.