Commit 5c7ac4aa authored by Konstantin Osipov's avatar Konstantin Osipov

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"
parent 8ce6e98a
......@@ -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;
......@@ -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;
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