Debian Codegraph @

mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result

raw
1 ###############################
2 # Test Setup
3 ###############################
4 RESET MASTER;
5 ######################################
6 # Test Group 1
7 # Run test cases on local log file
8 ######################################
9 set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22");
10 SET timestamp=@a;
11 RESET MASTER;
12 SET @@session.gtid_domain_id= 0;
13 SET @@session.server_id= 1;
14 CREATE TABLE t1 (a int);
15 SET timestamp=@a+1;
16 INSERT INTO t1 values (1), (2);
17 SET @@session.gtid_domain_id= 1;
18 SET @@session.server_id= 2;
19 SET timestamp=@a+2;
20 CREATE TABLE t2 (a int);
21 SET timestamp=@a+3;
22 INSERT INTO t2 values (1);
23 SET @@session.gtid_domain_id= 0;
24 SET @@session.server_id= 1;
25 SET timestamp=@a+4;
26 INSERT INTO t1 values (3), (4);
27 SET @@session.gtid_domain_id= 1;
28 SET @@session.server_id= 2;
29 INSERT INTO t2 values (2);
30 SET @@session.server_id= 3;
31 INSERT INTO t2 values (3);
32 SET @@session.server_id= 2;
33 INSERT INTO t2 values (4);
34 FLUSH LOGS;
35 SET @@session.gtid_domain_id= 0;
36 SET @@session.server_id= 1;
37 CREATE TABLE t3 (a int);
38 INSERT INTO t3 VALUES (1);
39 FLUSH LOGS;
40 # Gtid list event of the 2nd binlog file whose content is
41 # matched against --start-position in the following tests:
42 show binlog events in 'master-bin.000002' limit 1,1;
43 Log_name Pos Event_type Server_id End_log_pos Info
44 master-bin.000002 # Gtid_list 1 # [0-1-3,1-3-4,1-2-5]
45 DROP TABLE t1;
46 DROP TABLE t2;
47 DROP TABLE t3;
48 #
49 # Test Case 1:
50 # The end of the binlog file resets the server and domain id of the
51 # session
52 SET @@session.gtid_domain_id= 10;
53 SET @@session.server_id= 20;
54 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
55 include/assert.inc [session gtid_domain_id should not change when reading binlog in GTID mode]
56 include/assert.inc [session server_id should not change when reading binlog in GTID mode]
57 SET @@session.gtid_domain_id= 0;
58 SET @@session.server_id= 1;
59 DROP TABLE t1;
60 #
61 # Test Case 2:
62 # Single GTID range specified
63 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
64 DROP TABLE t1;
65 #
66 # Test Case 3:
67 # Single GTID range with different server_ids
68 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-0 --stop-position=1-3-4 | MYSQL
69 DROP TABLE t2;
70 #
71 # Test Case 4:
72 # Multiple GTID ranges specified
73 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 --stop-position=0-1-3,1-2-3 | MYSQL
74 DROP TABLE t1;
75 DROP TABLE t2;
76 #
77 # Test Case 5:
78 # Multiple GTID ranges specified where the domain ids are listed in
79 # different orders between start/stop position
80 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-3,1-2-3 --start-position=1-2-0,0-1-0 | MYSQL
81 DROP TABLE t1;
82 DROP TABLE t2;
83 #
84 # Test Case 6:
85 # Only start position specified
86 CREATE TABLE t1 (a int);
87 INSERT INTO t1 values (3), (4);
88 DROP TABLE t1;
89 CREATE TABLE t1 (a int);
90 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 | MYSQL
91 DROP TABLE t1;
92 DROP TABLE t2;
93 #
94 # Test Case 7:
95 # Only stop position specified
96 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
97 DROP TABLE t1;
98 #
99 # Test Case 8:
100 # Seq_no=0 in --start-position includes all events for a domain
101 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 | MYSQL
102 DROP TABLE t1;
103 DROP TABLE t2;
104 #
105 # Test Case 9:
106 # Seq_no=0 in --stop-position excludes all events for a domain
107 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-0,1-2-0 | MYSQL
108 #
109 # Test Case 10:
110 # Output stops for all domain ids when all --stop-position GTID values
111 # have been hit.
112 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
113 DROP TABLE t1;
114 #
115 # Test Case 11:
116 # All GTID events from other domains are printed until the
117 # --stop-position values are hit
118 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
119 DROP TABLE t2;
120 #
121 # Test Case 12:
122 # Scalar and GTID values can be used together for stop or start
123 # position
124 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=empty_binlog_pos --stop-position=0-1-2 | MYSQL
125 DROP TABLE t1;
126 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=t1_final_checksum_pos | MYSQL
127 DROP TABLE t1;
128 DROP TABLE t2;
129 #
130 # Test Case 13:
131 # If the start position is delayed within the binlog, events occurring
132 # before that position are ignored
133 CREATE TABLE t1 (a int);
134 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
135 DROP TABLE t1;
136 #
137 # Test Case 14:
138 # If start position is repeated, the last specification overrides all
139 # previous ones
140 CREATE TABLE t1 (a int);
141 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
142 DROP TABLE t1;
143 #
144 # Test Case 15:
145 # If stop position is repeated, the last specification overrides all
146 # previous ones
147 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-1 --stop-position=0-1-2 | MYSQL
148 DROP TABLE t1;
149 #
150 # Test Case 16:
151 # Start position with --offset=<n> skips n events after the first
152 # GTID is found
153 CREATE TABLE t1 (a int);
154 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 --offset=5 | MYSQL
155 DROP TABLE t1;
156 #
157 # Test Case 17:
158 # Start position with --start-datetime=<T> where T occurs after the
159 # specified GTID results in no events before T
160 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=1-2-2 --start-datetime="1970-01-21 15:32:24" | MYSQL
161 DROP TABLE t2;
162 #
163 # Test Case 18:
164 # If --stop-position is specified, domains which are not present
165 # in its list should be excluded from output
166 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
167 DROP TABLE t2;
168 #
169 # Test Case 19:
170 # If the start and stop GTIDs in any domain are equal, the domain
171 # should not have any output
172 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 --stop-position=0-1-2 | MYSQL
173 #
174 # Test Case 20:
175 # If --start-position and --stop-position have different domain ids,
176 # only events from GTIDs in the --stop-position list are output
177 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-2 --stop-position=0-1-3 | MYSQL
178 DROP TABLE t1;
179 #
180 # Test Case 21:
181 # Successive binary logs (e.g. logs with previous logs that have been
182 # purged) will write events when the --start-position matches their
183 # Gtid_list_log_event state
184 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3,1-2-5 | MYSQL
185 DROP TABLE t3;
186 #
187 # Test Case 22:
188 # Successive binary logs can be called with --stop-position and
189 # without --start-position
190 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --stop-position=0-1-4 | MYSQL
191 DROP TABLE t3;
192 # At the following error cases analysis
193 # note incompatible --start-position with the value of
194 # Gtid list event of the 2nd binlog file printed above.
195 #
196 # Error Case 1:
197 # A GTID --start-position that does not mention all domains that make
198 # up the binary log state should error
199 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3 > tmp_out_ 2> err_out_
200 FOUND 2 /ERROR: Starting GTID position list does not specify an initial value/ in err.out
201 #
202 # Error Case 2:
203 # A GTID --start-position with any sequence numbers which occur before
204 # the binary log state should result in error
205 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-2,1-2-5 > tmp_out_ 2> err_out_
206 FOUND 1 /ERROR: Binary logs are missing data for domain 0/ in err.out
207 #
208 # Error Case 3:
209 # A GTID --start-position with any sequence numbers that are not
210 # eventually processed results in error
211 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-8,1-2-6 > tmp_out_ 2> err_out_
212 FOUND 2 /ERROR: Binary logs never reached expected GTID state/ in err.out
213 ######################################
214 # Test Group 2
215 # Run test cases on remote host
216 ######################################
217 set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22");
218 SET timestamp=@a;
219 RESET MASTER;
220 SET @@session.gtid_domain_id= 0;
221 SET @@session.server_id= 1;
222 CREATE TABLE t1 (a int);
223 SET timestamp=@a+1;
224 INSERT INTO t1 values (1), (2);
225 SET @@session.gtid_domain_id= 1;
226 SET @@session.server_id= 2;
227 SET timestamp=@a+2;
228 CREATE TABLE t2 (a int);
229 SET timestamp=@a+3;
230 INSERT INTO t2 values (1);
231 SET @@session.gtid_domain_id= 0;
232 SET @@session.server_id= 1;
233 SET timestamp=@a+4;
234 INSERT INTO t1 values (3), (4);
235 SET @@session.gtid_domain_id= 1;
236 SET @@session.server_id= 2;
237 INSERT INTO t2 values (2);
238 SET @@session.server_id= 3;
239 INSERT INTO t2 values (3);
240 SET @@session.server_id= 2;
241 INSERT INTO t2 values (4);
242 FLUSH LOGS;
243 SET @@session.gtid_domain_id= 0;
244 SET @@session.server_id= 1;
245 CREATE TABLE t3 (a int);
246 INSERT INTO t3 VALUES (1);
247 FLUSH LOGS;
248 # Gtid list event of the 2nd binlog file whose content is
249 # matched against --start-position in the following tests:
250 show binlog events in 'master-bin.000002' limit 1,1;
251 Log_name Pos Event_type Server_id End_log_pos Info
252 master-bin.000002 # Gtid_list 1 # [0-1-3,1-3-4,1-2-5]
253 DROP TABLE t1;
254 DROP TABLE t2;
255 DROP TABLE t3;
256 #
257 # Test Case 1:
258 # The end of the binlog file resets the server and domain id of the
259 # session
260 SET @@session.gtid_domain_id= 10;
261 SET @@session.server_id= 20;
262 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
263 include/assert.inc [session gtid_domain_id should not change when reading binlog in GTID mode]
264 include/assert.inc [session server_id should not change when reading binlog in GTID mode]
265 SET @@session.gtid_domain_id= 0;
266 SET @@session.server_id= 1;
267 DROP TABLE t1;
268 #
269 # Test Case 2:
270 # Single GTID range specified
271 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
272 DROP TABLE t1;
273 #
274 # Test Case 3:
275 # Single GTID range with different server_ids
276 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-0 --stop-position=1-3-4 | MYSQL
277 DROP TABLE t2;
278 #
279 # Test Case 4:
280 # Multiple GTID ranges specified
281 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 --stop-position=0-1-3,1-2-3 | MYSQL
282 DROP TABLE t1;
283 DROP TABLE t2;
284 #
285 # Test Case 5:
286 # Multiple GTID ranges specified where the domain ids are listed in
287 # different orders between start/stop position
288 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-3,1-2-3 --start-position=1-2-0,0-1-0 | MYSQL
289 DROP TABLE t1;
290 DROP TABLE t2;
291 #
292 # Test Case 6:
293 # Only start position specified
294 CREATE TABLE t1 (a int);
295 INSERT INTO t1 values (3), (4);
296 DROP TABLE t1;
297 CREATE TABLE t1 (a int);
298 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 | MYSQL
299 DROP TABLE t1;
300 DROP TABLE t2;
301 #
302 # Test Case 7:
303 # Only stop position specified
304 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
305 DROP TABLE t1;
306 #
307 # Test Case 8:
308 # Seq_no=0 in --start-position includes all events for a domain
309 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 | MYSQL
310 DROP TABLE t1;
311 DROP TABLE t2;
312 #
313 # Test Case 9:
314 # Seq_no=0 in --stop-position excludes all events for a domain
315 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-0,1-2-0 | MYSQL
316 #
317 # Test Case 10:
318 # Output stops for all domain ids when all --stop-position GTID values
319 # have been hit.
320 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
321 DROP TABLE t1;
322 #
323 # Test Case 11:
324 # All GTID events from other domains are printed until the
325 # --stop-position values are hit
326 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
327 DROP TABLE t2;
328 #
329 # Test Case 12:
330 # Scalar and GTID values can be used together for stop or start
331 # position
332 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=empty_binlog_pos --stop-position=0-1-2 | MYSQL
333 DROP TABLE t1;
334 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=t1_final_checksum_pos | MYSQL
335 DROP TABLE t1;
336 DROP TABLE t2;
337 #
338 # Test Case 13:
339 # If the start position is delayed within the binlog, events occurring
340 # before that position are ignored
341 CREATE TABLE t1 (a int);
342 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
343 DROP TABLE t1;
344 #
345 # Test Case 14:
346 # If start position is repeated, the last specification overrides all
347 # previous ones
348 CREATE TABLE t1 (a int);
349 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
350 DROP TABLE t1;
351 #
352 # Test Case 15:
353 # If stop position is repeated, the last specification overrides all
354 # previous ones
355 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-1 --stop-position=0-1-2 | MYSQL
356 DROP TABLE t1;
357 #
358 # Test Case 16:
359 # Start position with --offset=<n> skips n events after the first
360 # GTID is found
361 CREATE TABLE t1 (a int);
362 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 --offset=5 | MYSQL
363 DROP TABLE t1;
364 #
365 # Test Case 17:
366 # Start position with --start-datetime=<T> where T occurs after the
367 # specified GTID results in no events before T
368 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=1-2-2 --start-datetime="1970-01-21 15:32:24" | MYSQL
369 DROP TABLE t2;
370 #
371 # Test Case 18:
372 # If --stop-position is specified, domains which are not present
373 # in its list should be excluded from output
374 # MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
375 DROP TABLE t2;
376 #
377 # Test Case 19:
378 # If the start and stop GTIDs in any domain are equal, the domain
379 # should not have any output
380 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 --stop-position=0-1-2 | MYSQL
381 #
382 # Test Case 20:
383 # If --start-position and --stop-position have different domain ids,
384 # only events from GTIDs in the --stop-position list are output
385 # MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-2 --stop-position=0-1-3 | MYSQL
386 DROP TABLE t1;
387 #
388 # Test Case 21:
389 # Successive binary logs (e.g. logs with previous logs that have been
390 # purged) will write events when the --start-position matches their
391 # Gtid_list_log_event state
392 #
393 # Reset server state
394 RESET MASTER;
395 FLUSH LOGS;
396 FLUSH LOGS;
397 PURGE BINARY LOGS TO "master-bin.000002";
398 DROP TABLE t1;
399 DROP TABLE t2;
400 DROP TABLE t3;
401 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3,1-2-5 | MYSQL
402 DROP TABLE t3;
403 #
404 # Test Case 22:
405 # Successive binary logs can be called with --stop-position and
406 # without --start-position
407 #
408 # Reset server state
409 RESET MASTER;
410 FLUSH LOGS;
411 FLUSH LOGS;
412 PURGE BINARY LOGS TO "master-bin.000002";
413 DROP TABLE t1;
414 DROP TABLE t2;
415 DROP TABLE t3;
416 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --stop-position=0-1-4 | MYSQL
417 DROP TABLE t3;
418 #
419 # Remote-only setup for error cases
420 RESET MASTER;
421 FLUSH LOGS;
422 FLUSH LOGS;
423 PURGE BINARY LOGS TO "master-bin.000002";
424 # At the following error cases analysis
425 # note incompatible --start-position with the value of
426 # Gtid list event of the 2nd binlog file printed above.
427 #
428 # Error Case 1:
429 # A GTID --start-position that does not mention all domains that make
430 # up the binary log state should error
431 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3 > tmp_out_ 2> err_out_
432 FOUND 1 /ERROR: Got error reading packet from server/ in err.out
433 #
434 # Error Case 2:
435 # A GTID --start-position with any sequence numbers which occur before
436 # the binary log state should result in error
437 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-2,1-2-5 > tmp_out_ 2> err_out_
438 FOUND 1 /ERROR: Got error reading packet from server/ in err.out
439 #
440 # Error Case 3:
441 # A GTID --start-position with any sequence numbers that are not
442 # eventually processed results in error
443 # MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-8,1-2-6 > tmp_out_ 2> err_out_
444 FOUND 1 /ERROR: Got error reading packet from server/ in err.out
445 #
446 # Remote-only cleanup from error cases
447 DROP TABLE t1;
448 DROP TABLE t2;
449 DROP TABLE t3;
450 RESET MASTER;
451 #
452 # Error Case 4:
453 # User provides invalid positions
454 # MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=z
455 # MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=1-
456 # MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=1-2
457 # MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=1-2-
458 # MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=-1
459 #
460 # Error Case 5:
461 # User provides GTID ranges with repeated domain ids
462 # MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=0-1-1,0-1-8 --stop-position=0-1-4,0-1-12
463 ##############################
464 # Cleanup
465 ##############################
466 SET @@global.gtid_domain_id= 0;
467 SET @@global.server_id= 1;
468 # End of the tests