Skip to content

Commit

Permalink
follow comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Defined2014 committed Nov 4, 2021
1 parent fe442d0 commit ea7692c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
9 changes: 0 additions & 9 deletions ddl/serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,15 +1123,6 @@ func (s *testSerialSuite) TestTableLocksEnable(c *C) {
conf.EnableTableLock = false
})

tk.MustExec("SET tidb_enable_noop_functions='OFF'")
defer tk.MustExec("SET tidb_enable_noop_functions='OFF'")
tk.MustExec("lock tables t1 write")
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1235 LOCK TABLES is not supported. To enable this experimental feature, set 'enable-table-lock' in the configuration file."))
tk.MustExec("unlock tables")
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1235 UNLOCK TABLES is not supported. To enable this experimental feature, set 'enable-table-lock' in the configuration file."))
checkTableLock(c, tk.Se, "test", "t1", model.TableLockNone)

tk.MustExec("SET tidb_enable_noop_functions='WARN'")
tk.MustExec("lock tables t1 write")
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1235 LOCK TABLES is not supported. To enable this experimental feature, set 'enable-table-lock' in the configuration file."))
tk.MustExec("unlock tables")
Expand Down
14 changes: 2 additions & 12 deletions executor/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,7 @@ func (e *DDLExec) executeFlashbackTable(s *ast.FlashBackTableStmt) error {

func (e *DDLExec) executeLockTables(s *ast.LockTablesStmt) error {
if !config.TableLockEnabled() {
noopFuncsMode := e.ctx.GetSessionVars().NoopFuncsMode
// For compatibility with mysqldump, only return warning
// https://github.com/pingcap/tidb/pull/29301#discussion_r742083632
if noopFuncsMode == variable.WarnInt || noopFuncsMode == variable.OffInt {
e.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrFuncNotEnabled.GenWithStackByArgs("LOCK TABLES", "enable-table-lock"))
}
e.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrFuncNotEnabled.GenWithStackByArgs("LOCK TABLES", "enable-table-lock"))
return nil
}

Expand All @@ -812,12 +807,7 @@ func (e *DDLExec) executeLockTables(s *ast.LockTablesStmt) error {

func (e *DDLExec) executeUnlockTables(_ *ast.UnlockTablesStmt) error {
if !config.TableLockEnabled() {
noopFuncsMode := e.ctx.GetSessionVars().NoopFuncsMode
// For compatibility with mysqldump, only return warning
// https://github.com/pingcap/tidb/pull/29301#discussion_r742083632
if noopFuncsMode == variable.WarnInt || noopFuncsMode == variable.OffInt {
e.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrFuncNotEnabled.GenWithStackByArgs("UNLOCK TABLES", "enable-table-lock"))
}
e.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrFuncNotEnabled.GenWithStackByArgs("UNLOCK TABLES", "enable-table-lock"))
return nil
}
lockedTables := e.ctx.GetAllTableLocks()
Expand Down

0 comments on commit ea7692c

Please sign in to comment.