~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to mysql-test/t/flush_block_commit_notembedded.test

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
 
2
# transactions.
 
3
# We verify that we did not introduce a deadlock.
 
4
# This is intended to mimick how mysqldump and innobackup work.
 
5
 
 
6
--source include/have_log_bin.inc
 
7
 
 
8
# And it requires InnoDB
 
9
--source include/have_log_bin.inc
 
10
--source include/have_innodb.inc
 
11
 
 
12
--echo # Save the initial number of concurrent sessions
 
13
--source include/count_sessions.inc
 
14
 
 
15
 
 
16
--echo # Establish connection con1 (user=root)
 
17
connect (con1,localhost,root,,);
 
18
--echo # Establish connection con2 (user=root)
 
19
connect (con2,localhost,root,,);
 
20
 
 
21
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
 
22
--echo # Switch to connection con1
 
23
connection con1;
 
24
CREATE TABLE t1 (a INT) ENGINE=innodb;
 
25
RESET MASTER;
 
26
SET AUTOCOMMIT=0;
 
27
SELECT 1;
 
28
--echo # Switch to connection con2
 
29
connection con2;
 
30
FLUSH TABLES WITH READ LOCK;
 
31
--source include/show_binlog_events.inc
 
32
--echo # Switch to connection con1
 
33
connection con1;
 
34
send INSERT INTO t1 VALUES (1);
 
35
--echo # Switch to connection con2
 
36
connection con2;
 
37
sleep 1;
 
38
--source include/show_binlog_events.inc
 
39
UNLOCK TABLES;
 
40
--echo # Switch to connection con1
 
41
connection con1;
 
42
reap;
 
43
DROP TABLE t1;
 
44
SET AUTOCOMMIT=1;
 
45
 
 
46
# GLR blocks new transactions
 
47
create table t1 (a int) engine=innodb;
 
48
connection con1;
 
49
flush tables with read lock;
 
50
connection con2;
 
51
begin;
 
52
--send insert into t1 values (1);
 
53
connection con1;
 
54
let $wait_condition=
 
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
 
59
unlock tables;
 
60
connection con2;
 
61
--reap
 
62
commit;
 
63
drop table t1;
 
64
 
 
65
--echo # Switch to connection default and close connections con1 and con2
 
66
connection default;
 
67
disconnect con1;
 
68
disconnect con2;
 
69
 
 
70
--echo # Wait till all disconnects are completed
 
71
--source include/wait_until_count_sessions.inc
 
72