1
# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
3
# We verify that we did not introduce a deadlock.
4
# This is intended to mimick how mysqldump and innobackup work.
6
--source include/have_log_bin.inc
8
# And it requires InnoDB
9
--source include/have_log_bin.inc
10
--source include/have_innodb.inc
12
--echo # Save the initial number of concurrent sessions
13
--source include/count_sessions.inc
16
--echo # Establish connection con1 (user=root)
17
connect (con1,localhost,root,,);
18
--echo # Establish connection con2 (user=root)
19
connect (con2,localhost,root,,);
21
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
22
--echo # Switch to connection con1
24
CREATE TABLE t1 (a INT) ENGINE=innodb;
28
--echo # Switch to connection con2
30
FLUSH TABLES WITH READ LOCK;
31
--source include/show_binlog_events.inc
32
--echo # Switch to connection con1
34
send INSERT INTO t1 VALUES (1);
35
--echo # Switch to connection con2
38
--source include/show_binlog_events.inc
40
--echo # Switch to connection con1
46
# GLR blocks new transactions
47
create table t1 (a int) engine=innodb;
49
flush tables with read lock;
52
--send insert into t1 values (1);
55
select count(*) = 1 from information_schema.processlist
56
where state = "Waiting for global read lock" and
57
info = "insert into t1 values (1)";
58
--source include/wait_condition.inc
65
--echo # Switch to connection default and close connections con1 and con2
70
--echo # Wait till all disconnects are completed
71
--source include/wait_until_count_sessions.inc