Skip to content

Commit

Permalink
Changed FTWRL to produce error (#7712)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo authored and winkyao committed Oct 12, 2018
1 parent e442d9a commit 508a836
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion executor/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ func (e *SimpleExec) executeKillStmt(s *ast.KillStmt) error {
func (e *SimpleExec) executeFlush(s *ast.FlushStmt) error {
switch s.Tp {
case ast.FlushTables:
// TODO: A dummy implement
if s.ReadLock {
return errors.New("FLUSH TABLES WITH READ LOCK is not supported. Please use @@tidb_snapshot")
}
case ast.FlushPrivileges:
dom := domain.GetDomain(e.ctx)
sysSessionPool := dom.SysSessionPool()
Expand Down
11 changes: 11 additions & 0 deletions executor/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,14 @@ func (s *testSuite) TestDropStats(c *C) {
c.Assert(statsTbl.Pseudo, IsTrue)
h.Lease = 0
}

func (s *testSuite) TestFlushTables(c *C) {
tk := testkit.NewTestKit(c, s.store)

_, err := tk.Exec("FLUSH TABLES")
c.Check(err, IsNil)

_, err = tk.Exec("FLUSH TABLES WITH READ LOCK")
c.Check(err, NotNil)

}

0 comments on commit 508a836

Please sign in to comment.