summaryrefslogtreecommitdiff
path: root/mysql-test/t/flush.test
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-08-05 15:37:24 +0200
committerunknown <ingo@mysql.com>2005-08-05 15:37:24 +0200
commit2977a3a4b15e282517ebf958445c218ae1d71bd5 (patch)
tree320bd255e908b957697ec7d21126f178c1592b52 /mysql-test/t/flush.test
parent75c06af27784e6fa6ba23f4cd6803bc7574f8253 (diff)
downloadmariadb-git-2977a3a4b15e282517ebf958445c218ae1d71bd5.tar.gz
Bug#9459 - deadlock with flush with lock, and lock table write
Added a check before taking a global read lock if the own thread has a write locked table. mysql-test/r/flush.result: Bug#9459 - deadlock with flush with lock, and lock table write The test result. mysql-test/t/flush.test: Bug#9459 - deadlock with flush with lock, and lock table write The test case.
Diffstat (limited to 'mysql-test/t/flush.test')
-rw-r--r--mysql-test/t/flush.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 5a9ab8db740..21ba9e8e9e7 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -70,4 +70,35 @@ insert into t1 values (345);
select * from t1;
drop table t1;
+#
+# Bug#9459 - deadlock with flush with lock, and lock table write
+#
+create table t1 (c1 int);
+lock table t1 write;
+# Cannot get the global read lock with write locked tables.
+--error 1192
+flush tables with read lock;
+lock table t1 read;
+# Can get the global read lock with read locked tables.
+flush tables with read lock;
+--error 1223
+lock table t1 write;
+lock table t1 read;
+--error 1223
+lock table t1 write;
+# Release all table locks and the global read lock.
+unlock tables;
+create table t2 (c1 int);
+create table t3 (c1 int);
+lock table t1 read, t2 read, t3 write;
+# Cannot get the global read lock with write locked tables.
+--error 1192
+flush tables with read lock;
+lock table t1 read, t2 read, t3 read;
+# Can get the global read lock with read locked tables.
+flush tables with read lock;
+# Release all table locks and the global read lock.
+unlock tables;
+drop table t1, t2, t3;
+
# End of 4.1 tests