~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
set global innodb_table_locks=1;
2
select @@innodb_table_locks;
3
@@innodb_table_locks
4
1
5
drop table if exists t1;
6
set @@innodb_table_locks=1;
7
create table t1 (id integer, x integer) engine=INNODB;
8
insert into t1 values(0, 0);
9
set autocommit=0;
10
SELECT * from t1 where id = 0 FOR UPDATE;
11
id	x
12
0	0
13
set autocommit=0;
14
lock table t1 write;
15
update t1 set x=1 where id = 0;
16
select * from t1;
17
id	x
18
0	1
19
commit;
20
update t1 set x=2 where id = 0;
21
commit;
22
unlock tables;
23
select * from t1;
24
id	x
25
0	2
26
commit;
27
drop table t1;
28
set @@innodb_table_locks=0;
29
create table t1 (id integer primary key, x integer) engine=INNODB;
30
insert into t1 values(0, 0),(1,1),(2,2);
31
commit;
32
SELECT * from t1 where id = 0 FOR UPDATE;
33
id	x
34
0	0
35
set autocommit=0;
36
set @@innodb_table_locks=0;
37
lock table t1 write;
38
update t1 set x=10 where id = 2;
39
SELECT * from t1 where id = 2;
40
id	x
41
2	2
42
UPDATE t1 set x=3 where id = 2;
43
commit;
44
SELECT * from t1;
45
id	x
46
0	0
47
1	1
48
2	3
49
commit;
50
unlock tables;
51
commit;
52
select * from t1;
53
id	x
54
0	0
55
1	1
56
2	10
57
drop table t1;