summaryrefslogtreecommitdiff
path: root/mysql-test/t/flush_block_commit.test
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-08-20 17:16:03 +0200
committerunknown <guilhem@mysql.com>2004-08-20 17:16:03 +0200
commit4f0e2da3169968b826f0b180dfe5de0ca99b40b9 (patch)
treede67afcfd6aef3bce9e8c4c46b510723f3e582bd /mysql-test/t/flush_block_commit.test
parent7c3e8f62f50836e5a3a698415736e1ea342af62a (diff)
parentcd8054d4318077827bcf20e640af6fcddf1d9525 (diff)
downloadmariadb-git-4f0e2da3169968b826f0b180dfe5de0ca99b40b9.tar.gz
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
Diffstat (limited to 'mysql-test/t/flush_block_commit.test')
-rw-r--r--mysql-test/t/flush_block_commit.test49
1 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test
new file mode 100644
index 00000000000..20ecec1361c
--- /dev/null
+++ b/mysql-test/t/flush_block_commit.test
@@ -0,0 +1,49 @@
+# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
+# transactions.
+# We verify that we did not introduce a deadlock.
+
+-- source include/have_innodb.inc
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connect (con3,localhost,root,,);
+connection con1;
+drop table if exists t1;
+create table t1 (a int) type=innodb;
+
+# blocks COMMIT ?
+
+begin;
+insert into t1 values(1);
+connection con2;
+flush tables with read lock;
+select * from t1;
+connection con1;
+send commit; # blocked by con2
+sleep 1;
+connection con2;
+select * from t1; # verify con1 was blocked and data did not move
+unlock tables;
+connection con1;
+reap;
+
+# No deadlock ?
+
+connection con1;
+begin;
+select * from t1 for update;
+connection con2;
+begin;
+send select * from t1 for update; # blocked by con1
+sleep 1;
+connection con3;
+send flush tables with read lock; # blocked by con2
+connection con1;
+commit; # should not be blocked by con3
+connection con2;
+reap;
+connection con3;
+reap;
+unlock tables;
+connection con1;
+drop table t1;