Commit a164203f authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Backport of revno: 2617.56.21

Bug #45066 FLUSH TABLES WITH READ LOCK deadlocks against LOCK TABLE

Test coverage for combinations of LOCK TABLE READ / WRITE and 
FLUSH TABLES / FLUSH TABLES WITH READ LOCK added to lock.test.
LOCK and FLUSH are executed sequentially from one connection.
parent ce5c87a3
......@@ -319,5 +319,27 @@ alter table t1 add column j int;
unlock tables;
drop table t1;
#
# Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
# LOCK TABLE
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
LOCK TABLE t1 READ;
FLUSH TABLES;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
LOCK TABLE t1 WRITE;
FLUSH TABLES;
#
# If you allow the next combination, you reintroduce bug Bug#45066
#
LOCK TABLE t1 READ;
FLUSH TABLES WITH READ LOCK;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
LOCK TABLE t1 WRITE;
FLUSH TABLES WITH READ LOCK;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
UNLOCK TABLES;
DROP TABLE t1;
#
# End of 6.0 tests.
#
......@@ -385,6 +385,38 @@ alter table t1 add column j int;
unlock tables;
drop table t1;
--echo #
--echo # Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
--echo # LOCK TABLE
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1(a INT);
LOCK TABLE t1 READ;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH TABLES;
LOCK TABLE t1 WRITE;
FLUSH TABLES;
--echo #
--echo # If you allow the next combination, you reintroduce bug Bug#45066
--echo #
LOCK TABLE t1 READ;
--error ER_LOCK_OR_ACTIVE_TRANSACTION
FLUSH TABLES WITH READ LOCK;
LOCK TABLE t1 WRITE;
--error ER_LOCK_OR_ACTIVE_TRANSACTION
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
DROP TABLE t1;
--echo #
--echo # End of 6.0 tests.
--echo #
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