Commit c2ebe814 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-25837 Assertion `thd->locked_tables_mode == LTM_NONE' failed in...

MDEV-25837 Assertion `thd->locked_tables_mode == LTM_NONE' failed in Locked_tables_list::init_locked_tables.

don't do prelocking for the FLUSH command.
parent 0237e9bb
......@@ -606,6 +606,17 @@ drop view v1, v2;
drop table t1;
disconnect con1;
#
# MDEV-25837 Assertion `thd->locked_tables_mode == LTM_NONE' failed in Locked_tables_list::init_locked_tables.
#
CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
CREATE TABLE t (a INT);
CREATE VIEW v AS SELECT 2 FROM t WHERE f() < 3;
FLUSH TABLE v WITH READ LOCK;
UNLOCK TABLES;
DROP VIEW v;
DROP FUNCTION f;
DROP TABLE t;
#
# Test FLUSH THREADS
#
set @save_thread_cache_size=@@global.thread_cache_size;
......
......@@ -722,6 +722,19 @@ drop view v1, v2;
drop table t1;
disconnect con1;
--echo #
--echo # MDEV-25837 Assertion `thd->locked_tables_mode == LTM_NONE' failed in Locked_tables_list::init_locked_tables.
--echo #
CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
CREATE TABLE t (a INT);
CREATE VIEW v AS SELECT 2 FROM t WHERE f() < 3;
FLUSH TABLE v WITH READ LOCK;
UNLOCK TABLES;
DROP VIEW v;
DROP FUNCTION f;
DROP TABLE t;
--echo #
--echo # Test FLUSH THREADS
......
......@@ -5553,7 +5553,8 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count, uint flags)
DEBUG_SYNC(thd, "after_lock_tables_takes_lock");
if (thd->lex->requires_prelocking() &&
thd->lex->sql_command != SQLCOM_LOCK_TABLES)
thd->lex->sql_command != SQLCOM_LOCK_TABLES &&
thd->lex->sql_command != SQLCOM_FLUSH)
{
/*
We just have done implicit LOCK TABLES, and now we have
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment