~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/r/rpl_idempotency.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
stop slave;
 
2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
3
reset master;
 
4
reset slave;
 
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
6
start slave;
 
7
CREATE TABLE t1 (a INT PRIMARY KEY);
 
8
CREATE TABLE t2 (a INT);
 
9
INSERT INTO t1 VALUES (-1),(-2),(-3);
 
10
INSERT INTO t2 VALUES (-1),(-2),(-3);
 
11
DELETE FROM t1 WHERE a = -2;
 
12
DELETE FROM t2 WHERE a = -2;
 
13
DELETE FROM t1 WHERE a = -2;
 
14
DELETE FROM t2 WHERE a = -2;
 
15
SELECT * FROM t1 ORDER BY a;
 
16
a
 
17
-3
 
18
-1
 
19
SELECT * FROM t2 ORDER BY a;
 
20
a
 
21
-3
 
22
-1
 
23
SELECT * FROM t1 ORDER BY a;
 
24
a
 
25
-3
 
26
-1
 
27
SELECT * FROM t2 ORDER BY a;
 
28
a
 
29
-3
 
30
-1
 
31
Last_SQL_Error
 
32
0
 
33
INSERT IGNORE INTO t1 VALUES (-2);
 
34
INSERT IGNORE INTO t1 VALUES (-2);
 
35
SELECT * FROM t1 ORDER BY a;
 
36
a
 
37
-3
 
38
-2
 
39
-1
 
40
SELECT * FROM t1 ORDER BY a;
 
41
a
 
42
-3
 
43
-2
 
44
-1
 
45
Last_SQL_Error
 
46
0
 
47
UPDATE t1 SET a = 1 WHERE a = -1;
 
48
UPDATE t2 SET a = 1 WHERE a = -1;
 
49
UPDATE t1 SET a = 1 WHERE a = -1;
 
50
UPDATE t2 SET a = 1 WHERE a = -1;
 
51
SELECT * FROM t1 ORDER BY a;
 
52
a
 
53
-3
 
54
-2
 
55
1
 
56
SELECT * FROM t2 ORDER BY a;
 
57
a
 
58
-3
 
59
1
 
60
SELECT * FROM t1 ORDER BY a;
 
61
a
 
62
-3
 
63
-2
 
64
1
 
65
SELECT * FROM t2 ORDER BY a;
 
66
a
 
67
-3
 
68
1
 
69
Last_SQL_Error
 
70
0
 
71
DROP TABLE t1, t2;
 
72
select @@global.slave_exec_mode /* must be IDEMPOTENT */;
 
73
@@global.slave_exec_mode
 
74
IDEMPOTENT
 
75
create table ti1 (b int primary key) engine = innodb;
 
76
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
 
77
engine = innodb;
 
78
set foreign_key_checks=1 /* ensure the check */;
 
79
insert into ti1 values (1),(2),(3);
 
80
insert into ti2 set a=2, b=2;
 
81
select * from ti1 order by b /* must be (1),(2),(3) */;
 
82
b
 
83
1
 
84
2
 
85
3
 
86
insert into ti2 set a=1, b=1;
 
87
select * from ti2 order by b /* must be (1,1) (2,2) */;
 
88
a       b
 
89
1       1
 
90
2       2
 
91
set @save_binlog_format= @@session.binlog_format;
 
92
set @@session.binlog_format= row;
 
93
delete from ti1 where b=1;
 
94
select * from ti1 order by b /* must be (2),(3) */;
 
95
b
 
96
2
 
97
3
 
98
select * from ti1 order by b /* must stays as were on master (1),(2),(3) */;
 
99
b
 
100
1
 
101
2
 
102
3
 
103
delete from ti1 where b=3;
 
104
insert into ti2 set a=3, b=3;
 
105
select * from ti2 order by b /* must be (1,1),(2,2) - not inserted */;
 
106
a       b
 
107
1       1
 
108
2       2
 
109
set global slave_exec_mode='IDEMPOTENT';
 
110
set global slave_exec_mode='STRICT';
 
111
set global slave_exec_mode='IDEMPOTENT,STRICT';
 
112
ERROR HY000: Ambiguous slave modes combination. 
 
113
select @@global.slave_exec_mode /* must be STRICT */;
 
114
@@global.slave_exec_mode
 
115
STRICT
 
116
*** foreign keys errors as above now forces to stop
 
117
set foreign_key_checks=0;
 
118
drop table ti2, ti1;
 
119
create table ti1 (b int primary key) engine = innodb;
 
120
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
 
121
engine = innodb;
 
122
set foreign_key_checks=1 /* ensure the check */;
 
123
insert into ti1 values (1),(2),(3);
 
124
insert into ti2 set a=2, b=2;
 
125
select * from ti1 order by b /* must be (1),(2),(3) */;
 
126
b
 
127
1
 
128
2
 
129
3
 
130
*** conspire future problem
 
131
insert into ti2 set a=1, b=1;
 
132
select * from ti2 order by b /* must be (1,1) (2,2) */;
 
133
a       b
 
134
1       1
 
135
2       2
 
136
delete from ti1 where b=1 /* offending delete event */;
 
137
select * from ti1 order by b /* must be (2),(3) */;
 
138
b
 
139
2
 
140
3
 
141
*** slave must stop
 
142
Last_SQL_Error
 
143
0
 
144
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
 
145
b
 
146
1
 
147
2
 
148
3
 
149
set foreign_key_checks= 0;
 
150
delete from ti2 where b=1;
 
151
set foreign_key_checks= 1;
 
152
set global slave_exec_mode='IDEMPOTENT';
 
153
start slave sql_thread;
 
154
set global slave_exec_mode='STRICT';
 
155
*** conspire the following insert failure
 
156
*** conspire future problem
 
157
delete from ti1 where b=3;
 
158
insert into ti2 set a=3, b=3 /* offending write event */;
 
159
*** slave must stop
 
160
Last_SQL_Error
 
161
1452
 
162
select * from ti2 order by b /* must be (2,2) */;
 
163
a       b
 
164
2       2
 
165
set foreign_key_checks= 0;
 
166
insert into ti1 set b=3;
 
167
set foreign_key_checks= 1;
 
168
set global slave_exec_mode='IDEMPOTENT';
 
169
start slave sql_thread;
 
170
set global slave_exec_mode='STRICT';
 
171
select * from ti2 order by b /* must be (2,2),(3,3) */;
 
172
a       b
 
173
2       2
 
174
3       3
 
175
*** other errors
 
176
*** conspiring query
 
177
insert into ti1 set b=1;
 
178
insert into ti1 set b=1 /* offending write event */;
 
179
*** slave must stop
 
180
Last_SQL_Error
 
181
1062
 
182
set foreign_key_checks= 0;
 
183
delete from ti1 where b=1;
 
184
set foreign_key_checks= 1;
 
185
set global slave_exec_mode='IDEMPOTENT';
 
186
start slave sql_thread;
 
187
set global slave_exec_mode='STRICT';
 
188
CREATE TABLE t1 (a INT PRIMARY KEY);
 
189
CREATE TABLE t2 (a INT);
 
190
INSERT INTO t1 VALUES (-1),(-2),(-3);
 
191
INSERT INTO t2 VALUES (-1),(-2),(-3);
 
192
DELETE FROM t1 WHERE a = -2;
 
193
DELETE FROM t2 WHERE a = -2;
 
194
DELETE FROM t1 WHERE a = -2;
 
195
*** slave must stop
 
196
Last_SQL_Error
 
197
1032
 
198
set global slave_exec_mode='IDEMPOTENT';
 
199
start slave sql_thread;
 
200
set global slave_exec_mode='STRICT';
 
201
DELETE FROM t2 WHERE a = -2;
 
202
*** slave must stop
 
203
Last_SQL_Error
 
204
0
 
205
set global slave_exec_mode='IDEMPOTENT';
 
206
start slave sql_thread;
 
207
set global slave_exec_mode='STRICT';
 
208
UPDATE t1 SET a = 1 WHERE a = -1;
 
209
UPDATE t2 SET a = 1 WHERE a = -1;
 
210
UPDATE t1 SET a = 1 WHERE a = -1;
 
211
*** slave must stop
 
212
Last_SQL_Error
 
213
1032
 
214
set global slave_exec_mode='IDEMPOTENT';
 
215
start slave sql_thread;
 
216
set global slave_exec_mode='STRICT';
 
217
UPDATE t2 SET a = 1 WHERE a = -1;
 
218
*** slave must stop
 
219
Last_SQL_Error
 
220
0
 
221
set global slave_exec_mode='IDEMPOTENT';
 
222
start slave sql_thread;
 
223
set global slave_exec_mode='STRICT';
 
224
set @@session.binlog_format= @save_binlog_format;
 
225
drop table t1,t2,ti2,ti1;
 
226
*** end of tests