Commit 7a6c36b5 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Fixed main.flush_read_lock sporadic failure

With MDEV-19384 fixed FTWRL releases HANDLER locks early, which allows
concurrent threads to go. Test case may get stuck on FTWRL waiting for
LOCK TABLES.
parent 341c3379
......@@ -1736,6 +1736,7 @@ SET DEBUG_SYNC= 'RESET';
# MDEV-19384 Deadlock between FTWRL under open HANDLER, LOCK TABLE
# and DROP DATABASE
#
SET DEBUG_SYNC= 'ftwrl_before_lock SIGNAL ready WAIT_FOR go';
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.t1(a INT);
HANDLER mysqltest.t1 OPEN as t1;
......@@ -1748,14 +1749,17 @@ SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
DROP DATABASE mysqltest;
connect con3,localhost,root,,;
SET DEBUG_SYNC= 'now WAIT_FOR ready';
disconnect con3;
connection default;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con3;
SET DEBUG_SYNC= 'now WAIT_FOR ready';
disconnect con3;
connection con1;
UNLOCK TABLES;
SET DEBUG_SYNC= 'now SIGNAL go';
disconnect con1;
connection default;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con2;
disconnect con2;
connection default;
......
......@@ -2100,6 +2100,7 @@ SET DEBUG_SYNC= 'RESET';
--echo # and DROP DATABASE
--echo #
SET DEBUG_SYNC= 'ftwrl_before_lock SIGNAL ready WAIT_FOR go';
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.t1(a INT);
HANDLER mysqltest.t1 OPEN as t1;
......@@ -2114,18 +2115,24 @@ SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
connect (con3,localhost,root,,);
SET DEBUG_SYNC= 'now WAIT_FOR ready';
disconnect con3;
connection default;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con1;
send FLUSH TABLES WITH READ LOCK;
connection con3;
SET DEBUG_SYNC= 'now WAIT_FOR ready';
disconnect con3;
connection con1;
--error 0,ER_NO_SUCH_TABLE
reap;
UNLOCK TABLES;
SET DEBUG_SYNC= 'now SIGNAL go';
disconnect con1;
connection default;
reap;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con2;
reap;
disconnect con2;
......
......@@ -1034,6 +1034,7 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
if another thread is trying to simultaneous drop the table
*/
mysql_ha_cleanup_no_free(thd);
DEBUG_SYNC(thd, "ftwrl_before_lock");
DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
MDL_BACKUP_FTWRL1));
......
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