summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-08-13 18:14:36 +0400
committerKonstantin Osipov <kostja@sun.com>2010-08-13 18:14:36 +0400
commit5c7ac4aa7abcc41f09e226162e3c03faa6207c94 (patch)
tree787afc718416745126d8ca1a9db3a4734fb2ee14
parent8ce6e98aa335590d18dbb4f9d453ad4c67bd1a2b (diff)
downloadmariadb-git-5c7ac4aa7abcc41f09e226162e3c03faa6207c94.tar.gz
Bug#52117 "Pending FLUSH TALBES <list> aborts transactions unnecessarily"
The bug was fixed by the patch for Bug 52044. Add a test case. mysql-test/r/flush.result: Update results (Bug#52117) mysql-test/t/flush.test: Add a test case for Bug#52117 "Pending FLUSH TALBES <list> aborts transactions unnecessarily"
-rw-r--r--mysql-test/r/flush.result69
-rw-r--r--mysql-test/t/flush.test116
2 files changed, 185 insertions, 0 deletions
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index f2b562db478..aee18d91edf 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -304,3 +304,72 @@ a
1
handler t1 close;
drop table t1;
+#
+# Bug#52117 Pending FLUSH TALBES <list> aborts
+# transactions unnecessarily.
+#
+drop table if exists t1;
+# --> conection default
+create table t1 (a int);
+begin;
+select * from t1;
+a
+# --> connection con1
+#
+# Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
+# or a long-running select -- anything that
+# prevents FLUSH TABLE t1 from immediate completion would do.
+#
+lock table t1 read;
+# --> connection con2
+#
+# FLUSH TABLE expels the table definition from the cache.
+# Sending 'flush table t1'...
+flush table t1;
+# --> connection default
+# Let flush table sync in.
+select * from t1;
+# --> connection con1
+select * from t1;
+a
+unlock tables;
+# --> connection con2
+# Reaping 'flush table t1'...
+# --> connection default
+# Reaping 'select * from t1'...
+a
+commit;
+#
+# Repeat the same test but with FLUSH TABLES
+#
+begin;
+select * from t1;
+a
+# --> connection con1
+#
+# Issue a LOCK TABLE t1 READ.
+#
+lock table t1 read;
+# --> connection con2
+#
+# FLUSH TABLES expels the table definition from the cache.
+# Sending 'flush tables'...
+flush tables;
+# --> connection default
+# Let flush table sync in.
+select * from t1;
+# --> connection con1
+select * from t1;
+a
+unlock tables;
+# --> connection con2
+# Reaping 'flush tables'...
+# --> connection default
+# Reaping 'select * from t1'...
+a
+commit;
+# Cleanup
+# --> connection con1
+# --> connection con2
+# --> connection default
+drop table t1;
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 9996c98de9a..d4c3533847d 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -430,3 +430,119 @@ unlock tables;
handler t1 read a next;
handler t1 close;
drop table t1;
+
+--echo #
+--echo # Bug#52117 Pending FLUSH TALBES <list> aborts
+--echo # transactions unnecessarily.
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+--echo # --> conection default
+connection default;
+
+create table t1 (a int);
+begin;
+select * from t1;
+--echo # --> connection con1
+connection con1;
+--echo #
+--echo # Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
+--echo # or a long-running select -- anything that
+--echo # prevents FLUSH TABLE t1 from immediate completion would do.
+--echo #
+lock table t1 read;
+--echo # --> connection con2
+connection con2;
+--echo #
+--echo # FLUSH TABLE expels the table definition from the cache.
+--echo # Sending 'flush table t1'...
+send flush table t1;
+--echo # --> connection default
+connection default;
+--echo # Let flush table sync in.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "flush table t1";
+--source include/wait_condition.inc
+send select * from t1;
+--echo # --> connection con1
+connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "select * from t1";
+select * from t1;
+unlock tables;
+--echo # --> connection con2
+connection con2;
+--echo # Reaping 'flush table t1'...
+reap;
+--echo # --> connection default
+connection default;
+--echo # Reaping 'select * from t1'...
+reap;
+commit;
+
+--echo #
+--echo # Repeat the same test but with FLUSH TABLES
+--echo #
+
+begin;
+select * from t1;
+--echo # --> connection con1
+connection con1;
+--echo #
+--echo # Issue a LOCK TABLE t1 READ.
+--echo #
+lock table t1 read;
+--echo # --> connection con2
+connection con2;
+--echo #
+--echo # FLUSH TABLES expels the table definition from the cache.
+--echo # Sending 'flush tables'...
+send flush tables;
+--echo # --> connection default
+connection default;
+--echo # Let flush table sync in.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "flush tables";
+--source include/wait_condition.inc
+send select * from t1;
+--echo # --> connection con1
+connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "select * from t1";
+select * from t1;
+unlock tables;
+--echo # --> connection con2
+connection con2;
+--echo # Reaping 'flush tables'...
+reap;
+--echo # --> connection default
+connection default;
+--echo # Reaping 'select * from t1'...
+reap;
+commit;
+
+--echo # Cleanup
+
+--echo # --> connection con1
+connection con1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+--echo # --> connection con2
+connection con2;
+disconnect con2;
+--source include/wait_until_disconnected.inc
+--echo # --> connection default
+connection default;
+drop table t1;
+