~drizzle-trunk/drizzle/development

1 by brian
clean slate
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
# And it requires InnoDB
7
-- source include/have_innodb.inc
8
9
connect (con1,localhost,root,,);
10
connect (con2,localhost,root,,);
11
connect (con3,localhost,root,,);
12
connection con1;
13
14
--disable_warnings
15
drop table if exists t1;
16
--enable_warnings
17
create table t1 (a int) engine=innodb;
18
19
# blocks COMMIT ?
20
21
begin;
22
insert into t1 values(1);
23
connection con2;
24
flush tables with read lock;
25
select * from t1;
26
connection con1;
27
send commit; # blocked by con2
28
sleep 1;
29
connection con2;
30
select * from t1; # verify con1 was blocked and data did not move
31
unlock tables;
32
connection con1;
33
reap;
34
35
# No deadlock ?
36
37
connection con1;
38
begin;
39
select * from t1 for update;
40
connection con2;
41
begin;
42
send select * from t1 for update; # blocked by con1
43
sleep 1;
44
connection con3;
45
send flush tables with read lock; # blocked by con2
46
connection con1;
47
commit; # should not be blocked by con3
48
connection con2;
49
reap;
50
connection con3;
51
reap;
52
unlock tables;
53
54
# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
55
# WITH READ LOCK
56
57
connection con2;
58
commit; # unlock InnoDB row locks to allow insertions
59
connection con1;
60
begin;
61
insert into t1 values(10);
62
flush tables with read lock;
63
commit;
64
unlock tables;
65
connection con2;
66
flush tables with read lock; # bug caused hang here
67
unlock tables;
68
69
# BUG#7358 SHOW CREATE DATABASE fails if open transaction
70
71
begin;
72
select * from t1;
73
show create database test;
74
75
drop table t1;
76
77
# End of 4.1 tests