summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/r/rpl_slave_skip.result
blob: 6148de5d954fb5c4c8d9963d1eebf227ab763d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** On Slave ****
STOP SLAVE;
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (c INT, d INT);
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (c INT, d INT)
master-bin.000001	#	Query	#	#	BEGIN
master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Query	#	#	COMMIT
master-bin.000001	#	Query	#	#	BEGIN
master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Query	#	#	COMMIT
master-bin.000001	#	Query	#	#	BEGIN
master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
master-bin.000001	#	Update_rows	#	#	table_id: #
master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Query	#	#	COMMIT
SELECT * FROM t1;
a	b
1	1
2	8
3	27
SELECT * FROM t2;
c	d
1	2
2	8
3	18
**** On Slave ****
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_PORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	1115
Relay_Log_File	#
Relay_Log_Pos	#
Relay_Master_Log_File	master-bin.000001
Slave_IO_Running	Yes
Slave_SQL_Running	No
Replicate_Do_DB	
Replicate_Ignore_DB	
Replicate_Do_Table	
Replicate_Ignore_Table	
Replicate_Wild_Do_Table	
Replicate_Wild_Ignore_Table	
Last_Errno	0
Last_Error	
Skip_Counter	0
Exec_Master_Log_Pos	762
Relay_Log_Space	#
Until_Condition	Master
Until_Log_File	master-bin.000001
Until_Log_Pos	762
Master_SSL_Allowed	No
Master_SSL_CA_File	
Master_SSL_CA_Path	
Master_SSL_Cert	
Master_SSL_Cipher	
Master_SSL_Key	
Seconds_Behind_Master	#
Master_SSL_Verify_Server_Cert	No
Last_IO_Errno	#
Last_IO_Error	#
Last_SQL_Errno	0
Last_SQL_Error	
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
a	b
1	1
2	4
3	9
SELECT * FROM t2;
c	d
1	1
2	8
3	27
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET @foo = 12;
INSERT INTO t1 VALUES(@foo, 2*@foo);
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	User var	#	#	@`foo`=12
master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(@foo, 2*@foo)
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_PORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	248
Relay_Log_File	#
Relay_Log_Pos	#
Relay_Master_Log_File	master-bin.000001
Slave_IO_Running	Yes
Slave_SQL_Running	Yes
Replicate_Do_DB	
Replicate_Ignore_DB	
Replicate_Do_Table	
Replicate_Ignore_Table	
Replicate_Wild_Do_Table	
Replicate_Wild_Ignore_Table	
Last_Errno	0
Last_Error	
Skip_Counter	0
Exec_Master_Log_Pos	248
Relay_Log_Space	#
Until_Condition	None
Until_Log_File	
Until_Log_Pos	0
Master_SSL_Allowed	No
Master_SSL_CA_File	
Master_SSL_CA_Path	
Master_SSL_Cert	
Master_SSL_Cipher	
Master_SSL_Key	
Seconds_Behind_Master	#
Master_SSL_Verify_Server_Cert	No
Last_IO_Errno	#
Last_IO_Error	#
Last_SQL_Errno	0
Last_SQL_Error	
**** On Master ****
DROP TABLE t1, t2;
SET SESSION BINLOG_FORMAT=ROW;
SET AUTOCOMMIT=0;
CREATE TABLE t1 (a INT, b VARCHAR(20)) ENGINE=myisam;
CREATE TABLE t2 (a INT, b VARCHAR(20)) ENGINE=myisam;
CREATE TABLE t3 (a INT, b VARCHAR(20)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,'master/slave');
INSERT INTO t2 VALUES (1,'master/slave');
INSERT INTO t3 VALUES (1,'master/slave');
CREATE TRIGGER tr1 AFTER UPDATE on t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES (NEW.a,NEW.b);
DELETE FROM t2 WHERE a < NEW.a;
END|
CREATE TRIGGER tr2 AFTER INSERT on t2 FOR EACH ROW
BEGIN
UPDATE t3 SET a =2, b = 'master only';
END|
**** On Slave ****
include/stop_slave.inc
**** On Master ****
UPDATE t1 SET a = 2, b = 'master only' WHERE a = 1;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
INSERT INTO t1 VALUES (3,'master/slave');
INSERT INTO t2 VALUES (3,'master/slave');
INSERT INTO t3 VALUES (3,'master/slave');
COMMIT;
SELECT * FROM t1 ORDER BY a;
a	b
2	master only
3	master/slave
SELECT * FROM t2 ORDER BY a;
a	b
2	master only
3	master/slave
SELECT * FROM t3 ORDER BY a;
a	b
2	master only
3	master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a	b
1	master/slave
3	master/slave
SELECT * FROM t2 ORDER BY a;
a	b
1	master/slave
3	master/slave
SELECT * FROM t3 ORDER BY a;
a	b
1	master/slave
3	master/slave
DROP TABLE t1, t2, t3;
**** Case 2: Row binlog format and transactional tables ****
*** On Master ***
CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
**** On Slave ****
include/stop_slave.inc
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (2, 'master only');
INSERT INTO t5 VALUES (2, 'master only');
INSERT INTO t6 VALUES (2, 'master only');
COMMIT;
BEGIN;
INSERT INTO t4 VALUES (3, 'master/slave');
INSERT INTO t5 VALUES (3, 'master/slave');
INSERT INTO t6 VALUES (3, 'master/slave');
COMMIT;
SELECT * FROM t4 ORDER BY a;
a	b
2	master only
3	master/slave
SELECT * FROM t5 ORDER BY a;
a	b
2	master only
3	master/slave
SELECT * FROM t6 ORDER BY a;
a	b
2	master only
3	master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a	b
3	master/slave
SELECT * FROM t5 ORDER BY a;
a	b
3	master/slave
SELECT * FROM t6 ORDER BY a;
a	b
3	master/slave
**** On Slave ****
include/stop_slave.inc
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (6, 'master only');
INSERT INTO t5 VALUES (6, 'master only');
INSERT INTO t6 VALUES (6, 'master only');
COMMIT;
BEGIN;
INSERT INTO t4 VALUES (7, 'master only');
INSERT INTO t5 VALUES (7, 'master only');
INSERT INTO t6 VALUES (7, 'master only');
COMMIT;
SELECT * FROM t4 ORDER BY a;
a	b
2	master only
3	master/slave
6	master only
7	master only
SELECT * FROM t5 ORDER BY a;
a	b
2	master only
3	master/slave
6	master only
7	master only
SELECT * FROM t6 ORDER BY a;
a	b
2	master only
3	master/slave
6	master only
7	master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a	b
3	master/slave
SELECT * FROM t5 ORDER BY a;
a	b
3	master/slave
SELECT * FROM t6 ORDER BY a;
a	b
3	master/slave
include/stop_slave.inc
SET AUTOCOMMIT=0;
INSERT INTO t4 VALUES (4, 'master only');
INSERT INTO t5 VALUES (4, 'master only');
INSERT INTO t6 VALUES (4, 'master only');
COMMIT;
INSERT INTO t4 VALUES (5, 'master/slave');
INSERT INTO t5 VALUES (5, 'master/slave');
INSERT INTO t6 VALUES (5, 'master/slave');
COMMIT;
SELECT * FROM t4 ORDER BY a;
a	b
2	master only
3	master/slave
4	master only
5	master/slave
6	master only
7	master only
SELECT * FROM t5 ORDER BY a;
a	b
2	master only
3	master/slave
4	master only
5	master/slave
6	master only
7	master only
SELECT * FROM t6 ORDER BY a;
a	b
2	master only
3	master/slave
4	master only
5	master/slave
6	master only
7	master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a	b
3	master/slave
5	master/slave
SELECT * FROM t5 ORDER BY a;
a	b
3	master/slave
5	master/slave
SELECT * FROM t6 ORDER BY a;
a	b
3	master/slave
5	master/slave
DROP TABLE t4, t5, t6;
**** Case 3: Statement logging format and LOAD DATA with non-transactional table ****
*** On Master ***
CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
*** On Slave ***
include/stop_slave.inc
*** On Master ***
SET SESSION BINLOG_FORMAT=STATEMENT;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
SELECT * FROM t10 ORDER BY a;
a	b
1	master only
2	master only
3	master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
SELECT * FROM t10 ORDER BY a;
a	b
DROP TABLE t10;