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