~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/r/deadlock_innodb.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Establish connection con1 (user=root)
 
2
# Establish connection con2 (user=root)
 
3
drop table if exists t1,t2;
 
4
# Switch to connection con1
 
5
create table t1 (id integer, x integer) engine = InnoDB;
 
6
insert into t1 values(0, 0);
 
7
set autocommit=0;
 
8
SELECT * from t1 where id = 0 FOR UPDATE;
 
9
id      x
 
10
0       0
 
11
# Switch to connection con2
 
12
set autocommit=0;
 
13
update t1 set x=2 where id = 0;
 
14
# Switch to connection con1
 
15
update t1 set x=1 where id = 0;
 
16
select * from t1;
 
17
id      x
 
18
0       1
 
19
commit;
 
20
# Switch to connection con2
 
21
commit;
 
22
# Switch to connection con1
 
23
select * from t1;
 
24
id      x
 
25
0       2
 
26
commit;
 
27
drop table t1;
 
28
# Switch to connection con1
 
29
create table t1 (id integer, x integer) engine = InnoDB;
 
30
create table t2 (b integer, a integer) engine = InnoDB;
 
31
insert into t1 values(0, 0), (300, 300);
 
32
insert into t2 values(0, 10), (1, 20), (2, 30);
 
33
commit;
 
34
set autocommit=0;
 
35
select * from t2;
 
36
b       a
 
37
0       10
 
38
1       20
 
39
2       30
 
40
update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
 
41
select * from t2;
 
42
b       a
 
43
0       100
 
44
1       20
 
45
2       30
 
46
select * from t1;
 
47
id      x
 
48
0       0
 
49
300     300
 
50
# Switch to connection con2
 
51
set autocommit=0;
 
52
update t1 set x=2 where id = 0;
 
53
# Switch to connection con1
 
54
update t1 set x=1 where id = 0;
 
55
select * from t1;
 
56
id      x
 
57
0       1
 
58
300     300
 
59
commit;
 
60
# Switch to connection con2
 
61
commit;
 
62
# Switch to connection con1
 
63
select * from t1;
 
64
id      x
 
65
0       2
 
66
300     300
 
67
commit;
 
68
drop table t1, t2;
 
69
create table t1 (id integer, x integer) engine = InnoDB;
 
70
create table t2 (b integer, a integer) engine = InnoDB;
 
71
insert into t1 values(0, 0), (300, 300);
 
72
insert into t2 values(0, 0), (1, 20), (2, 30);
 
73
commit;
 
74
# Switch to connection con1
 
75
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
 
76
a       b
 
77
0       0
 
78
20      1
 
79
30      2
 
80
300     300
 
81
select * from t2;
 
82
b       a
 
83
0       0
 
84
1       20
 
85
2       30
 
86
select * from t1;
 
87
id      x
 
88
0       0
 
89
300     300
 
90
# Switch to connection con2
 
91
update t2 set a=2 where b = 0;
 
92
select * from t2;
 
93
b       a
 
94
0       2
 
95
1       20
 
96
2       30
 
97
update t1 set x=2 where id = 0;
 
98
# Switch to connection con1
 
99
update t1 set x=1 where id = 0;
 
100
select * from t1;
 
101
id      x
 
102
0       1
 
103
300     300
 
104
commit;
 
105
# Switch to connection con2
 
106
commit;
 
107
# Switch to connection con1
 
108
select * from t1;
 
109
id      x
 
110
0       2
 
111
300     300
 
112
commit;
 
113
# Switch to connection default + disconnect con1 and con2
 
114
drop table t1, t2;
 
115
End of 4.1 tests
 
116
set storage_engine=innodb;
 
117
drop table if exists a;
 
118
drop table if exists A;
 
119
create table A (c int);
 
120
insert into A (c) values (0);
 
121
create table a as select * from A;
 
122
drop table A;
 
123
drop table if exists a;
 
124
set storage_engine=default;
 
125
End of 5.0 tests.