summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/flush_table.result3
-rw-r--r--mysql-test/t/flush_table.test7
-rw-r--r--sql/lock.cc2
3 files changed, 11 insertions, 1 deletions
diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result
index 2ef4ab5b52b..db54d2e53ef 100644
--- a/mysql-test/r/flush_table.result
+++ b/mysql-test/r/flush_table.result
@@ -101,3 +101,6 @@ table_id
Record-02
handler t1 close;
drop table t1;
+FLUSH TABLES WITH READ LOCK ;
+FLUSH TABLES WITH READ LOCK ;
+UNLOCK TABLES;
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
index 0330582bc34..e46b67ad3d0 100644
--- a/mysql-test/t/flush_table.test
+++ b/mysql-test/t/flush_table.test
@@ -73,4 +73,11 @@ handler t1 read next limit 1;
handler t1 close;
drop table t1;
+#
+# Bug #11934 Two sequential FLUSH TABLES WITH READ LOCK hangs client
+#
+FLUSH TABLES WITH READ LOCK ;
+FLUSH TABLES WITH READ LOCK ;
+UNLOCK TABLES;
+
# End of 4.1 tests
diff --git a/sql/lock.cc b/sql/lock.cc
index d51d9083058..568ca2b68af 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -990,7 +990,7 @@ bool make_global_read_lock_block_commit(THD *thd)
make_global_read_lock_block_commit(), do nothing.
*/
if (thd->global_read_lock != GOT_GLOBAL_READ_LOCK)
- DBUG_RETURN(1);
+ DBUG_RETURN(0);
pthread_mutex_lock(&LOCK_global_read_lock);
/* increment this BEFORE waiting on cond (otherwise race cond) */
global_read_lock_blocks_commit++;