~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
2
create table t1 (id int not null, f_id int not null, f int not null,
3
primary key(f_id, id)) engine = InnoDB;
4
create table t2 (id int not null,s_id int not null,s varchar(200),
5
primary key(id)) engine = InnoDB;
6
INSERT INTO t1 VALUES (8, 1, 3);
7
INSERT INTO t1 VALUES (1, 2, 1);
8
INSERT INTO t2 VALUES (1, 0, '');
9
INSERT INTO t2 VALUES (8, 1, '');
10
commit;
11
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
12
where mm.id is null lock in share mode;
13
id	f_id	f
14
drop table t1,t2;
15
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
16
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
17
commit;
18
set autocommit = 0;
19
select * from t1 lock in share mode;
20
a	b
21
1	1
22
2	2
23
3	1
24
4	2
25
5	1
26
6	2
27
7	3
28
update t1 set b = 5 where b = 1;
29
set autocommit = 0;
30
select * from t1 where a = 2 and b = 2 for update;
31
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
32
commit;
33
commit;
34
drop table t1;
35
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
36
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
37
commit;
38
set autocommit = 0;
39
update t1 set b = 5 where b = 1;
40
set autocommit = 0;
41
select * from t1 where a = 7 and b = 3 for update;
42
a	b
43
7	3
44
commit;
45
commit;
46
drop table t1;
47
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
48
insert into t1 values (1,2),(5,3),(4,2);
49
create table t2(d int not null, e int, primary key(d)) engine = InnoDB;
50
insert into t2 values (8,6),(12,1),(3,1);
51
commit;
52
set autocommit = 0;
53
select * from t2 for update;
54
d	e
55
3	1
56
8	6
57
12	1
58
set autocommit = 0;
59
insert into t1 select * from t2;
60
update t1 set b = (select e from t2 where a = d);
61
create table t3(d int not null, e int, primary key(d)) engine = InnoDB
62
select * from t2;
63
commit;
64
commit;
65
drop table t1, t2, t3;
66
SET SESSION STORAGE_ENGINE = InnoDB;
67
SET SESSION STORAGE_ENGINE = InnoDB;
68
SET SESSION STORAGE_ENGINE = InnoDB;
69
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
70
insert into t1 values (1,2),(5,3),(4,2);
71
create table t2(a int not null, b int, primary key(a)) engine = InnoDB;
72
insert into t2 values (8,6),(12,1),(3,1);
73
create table t3(d int not null, b int, primary key(d)) engine = InnoDB;
74
insert into t3 values (8,6),(12,1),(3,1);
75
create table t5(a int not null, b int, primary key(a)) engine = InnoDB;
76
insert into t5 values (1,2),(5,3),(4,2);
77
create table t6(d int not null, e int, primary key(d)) engine = InnoDB;
78
insert into t6 values (8,6),(12,1),(3,1);
79
create table t8(a int not null, b int, primary key(a)) engine = InnoDB;
80
insert into t8 values (1,2),(5,3),(4,2);
81
create table t9(d int not null, e int, primary key(d)) engine = InnoDB;
82
insert into t9 values (8,6),(12,1),(3,1);
83
commit;
84
set autocommit = 0;
85
select * from t2 for update;
86
a	b
87
3	1
88
8	6
89
12	1
90
set autocommit = 0;
91
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
92
insert into t1 select * from t2;
93
set autocommit = 0;
94
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
95
update t3 set b = (select b from t2 where a = d);
96
set autocommit = 0;
97
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
98
create table t4(a int not null, b int, primary key(a)) select * from t2;
99
set autocommit = 0;
100
insert into t5 (select * from t2 lock in share mode);
101
set autocommit = 0;
102
update t6 set e = (select b from t2 where a = d lock in share mode);
103
set autocommit = 0;
104
create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
105
set autocommit = 0;
106
insert into t8 (select * from t2 for update);
107
set autocommit = 0;
108
update t9 set e = (select b from t2 where a = d for update);
109
set autocommit = 0;
110
create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
111
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
112
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
113
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
114
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
115
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
116
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
117
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
118
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
119
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
120
commit;
121
drop table t1, t2, t3, t5, t6, t8, t9;