summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result')
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result468
1 files changed, 468 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result
new file mode 100644
index 00000000000..63af0d20cc6
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_gtid_window.result
@@ -0,0 +1,468 @@
+###############################
+# Test Setup
+###############################
+RESET MASTER;
+######################################
+# Test Group 1
+# Run test cases on local log file
+######################################
+set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22");
+SET timestamp=@a;
+RESET MASTER;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+SET timestamp=@a+1;
+INSERT INTO t1 values (1), (2);
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 2;
+SET timestamp=@a+2;
+CREATE TABLE t2 (a int);
+SET timestamp=@a+3;
+INSERT INTO t2 values (1);
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+SET timestamp=@a+4;
+INSERT INTO t1 values (3), (4);
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 2;
+INSERT INTO t2 values (2);
+SET @@session.server_id= 3;
+INSERT INTO t2 values (3);
+SET @@session.server_id= 2;
+INSERT INTO t2 values (4);
+FLUSH LOGS;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 VALUES (1);
+FLUSH LOGS;
+# Gtid list event of the 2nd binlog file whose content is
+# matched against --start-position in the following tests:
+show binlog events in 'master-bin.000002' limit 1,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Gtid_list 1 # [1-3-4,1-2-5,0-1-3]
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+#
+# Test Case 1:
+# The end of the binlog file resets the server and domain id of the
+# session
+SET @@session.gtid_domain_id= 10;
+SET @@session.server_id= 20;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
+include/assert.inc [session gtid_domain_id should not change when reading binlog in GTID mode]
+include/assert.inc [session server_id should not change when reading binlog in GTID mode]
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+DROP TABLE t1;
+#
+# Test Case 2:
+# Single GTID range specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 3:
+# Single GTID range with different server_ids
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-0 --stop-position=1-3-4 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 4:
+# Multiple GTID ranges specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 --stop-position=0-1-3,1-2-3 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 5:
+# Multiple GTID ranges specified where the domain ids are listed in
+# different orders between start/stop position
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-3,1-2-3 --start-position=1-2-0,0-1-0 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 6:
+# Only start position specified
+CREATE TABLE t1 (a int);
+INSERT INTO t1 values (3), (4);
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 7:
+# Only stop position specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 8:
+# Seq_no=0 in --start-position includes all events for a domain
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 9:
+# Seq_no=0 in --stop-position excludes all events for a domain
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-0,1-2-0 | MYSQL
+#
+# Test Case 10:
+# Output stops for all domain ids when all --stop-position GTID values
+# have been hit.
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 11:
+# All GTID events from other domains are printed until the
+# --stop-position values are hit
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 12:
+# Scalar and GTID values can be used together for stop or start
+# position
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=empty_binlog_pos --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=t1_final_checksum_pos | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 13:
+# If the start position is delayed within the binlog, events occurring
+# before that position are ignored
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 14:
+# If start position is repeated, the last specification overrides all
+# previous ones
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 15:
+# If stop position is repeated, the last specification overrides all
+# previous ones
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-1 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 16:
+# Start position with --offset=<n> skips n events after the first
+# GTID is found
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 --offset=5 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 17:
+# Start position with --start-datetime=<T> where T occurs after the
+# specified GTID results in no events before T
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=1-2-2 --start-datetime="1970-01-21 15:32:24" | MYSQL
+DROP TABLE t2;
+#
+# Test Case 18:
+# If --stop-position is specified, domains which are not present
+# in its list should be excluded from output
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 19:
+# If the start and stop GTIDs in any domain are equal, the domain
+# should not have any output
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 --stop-position=0-1-2 | MYSQL
+#
+# Test Case 20:
+# If --start-position and --stop-position have different domain ids,
+# only events from GTIDs in the --stop-position list are output
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-2 --stop-position=0-1-3 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 21:
+# Successive binary logs (e.g. logs with previous logs that have been
+# purged) will write events when the --start-position matches their
+# Gtid_list_log_event state
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3,1-2-5 | MYSQL
+DROP TABLE t3;
+#
+# Test Case 22:
+# Successive binary logs can be called with --stop-position and
+# without --start-position
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --stop-position=0-1-4 | MYSQL
+DROP TABLE t3;
+# At the following error cases analysis
+# note incompatible --start-position with the value of
+# Gtid list event of the 2nd binlog file printed above.
+#
+# Error Case 1:
+# A GTID --start-position that does not mention all domains that make
+# up the binary log state should error
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3 > tmp_out_ 2> err_out_
+FOUND 2 /ERROR: Starting GTID position list does not specify an initial value/ in err.out
+#
+# Error Case 2:
+# A GTID --start-position with any sequence numbers which occur before
+# the binary log state should result in error
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-2,1-2-5 > tmp_out_ 2> err_out_
+FOUND 1 /ERROR: Binary logs are missing data for domain 0/ in err.out
+#
+# Error Case 3:
+# A GTID --start-position with any sequence numbers that are not
+# eventually processed results in error
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-8,1-2-6 > tmp_out_ 2> err_out_
+FOUND 2 /ERROR: Binary logs never reached expected GTID state/ in err.out
+######################################
+# Test Group 2
+# Run test cases on remote host
+######################################
+set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22");
+SET timestamp=@a;
+RESET MASTER;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+SET timestamp=@a+1;
+INSERT INTO t1 values (1), (2);
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 2;
+SET timestamp=@a+2;
+CREATE TABLE t2 (a int);
+SET timestamp=@a+3;
+INSERT INTO t2 values (1);
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+SET timestamp=@a+4;
+INSERT INTO t1 values (3), (4);
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 2;
+INSERT INTO t2 values (2);
+SET @@session.server_id= 3;
+INSERT INTO t2 values (3);
+SET @@session.server_id= 2;
+INSERT INTO t2 values (4);
+FLUSH LOGS;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 VALUES (1);
+FLUSH LOGS;
+# Gtid list event of the 2nd binlog file whose content is
+# matched against --start-position in the following tests:
+show binlog events in 'master-bin.000002' limit 1,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Gtid_list 1 # [1-3-4,1-2-5,0-1-3]
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+#
+# Test Case 1:
+# The end of the binlog file resets the server and domain id of the
+# session
+SET @@session.gtid_domain_id= 10;
+SET @@session.server_id= 20;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
+include/assert.inc [session gtid_domain_id should not change when reading binlog in GTID mode]
+include/assert.inc [session server_id should not change when reading binlog in GTID mode]
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+DROP TABLE t1;
+#
+# Test Case 2:
+# Single GTID range specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 3:
+# Single GTID range with different server_ids
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-0 --stop-position=1-3-4 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 4:
+# Multiple GTID ranges specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 --stop-position=0-1-3,1-2-3 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 5:
+# Multiple GTID ranges specified where the domain ids are listed in
+# different orders between start/stop position
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-3,1-2-3 --start-position=1-2-0,0-1-0 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 6:
+# Only start position specified
+CREATE TABLE t1 (a int);
+INSERT INTO t1 values (3), (4);
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 7:
+# Only stop position specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 8:
+# Seq_no=0 in --start-position includes all events for a domain
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0,1-2-0 | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 9:
+# Seq_no=0 in --stop-position excludes all events for a domain
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-0,1-2-0 | MYSQL
+#
+# Test Case 10:
+# Output stops for all domain ids when all --stop-position GTID values
+# have been hit.
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 11:
+# All GTID events from other domains are printed until the
+# --stop-position values are hit
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 12:
+# Scalar and GTID values can be used together for stop or start
+# position
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=empty_binlog_pos --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=t1_final_checksum_pos | MYSQL
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Test Case 13:
+# If the start position is delayed within the binlog, events occurring
+# before that position are ignored
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 14:
+# If start position is repeated, the last specification overrides all
+# previous ones
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --start-position=0-1-1 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 15:
+# If stop position is repeated, the last specification overrides all
+# previous ones
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-1 --stop-position=0-1-2 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 16:
+# Start position with --offset=<n> skips n events after the first
+# GTID is found
+CREATE TABLE t1 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=0-1-2 --offset=5 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 17:
+# Start position with --start-datetime=<T> where T occurs after the
+# specified GTID results in no events before T
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --stop-position=1-2-2 --start-datetime="1970-01-21 15:32:24" | MYSQL
+DROP TABLE t2;
+#
+# Test Case 18:
+# If --stop-position is specified, domains which are not present
+# in its list should be excluded from output
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-3-4 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 19:
+# If the start and stop GTIDs in any domain are equal, the domain
+# should not have any output
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-2 --stop-position=0-1-2 | MYSQL
+#
+# Test Case 20:
+# If --start-position and --stop-position have different domain ids,
+# only events from GTIDs in the --stop-position list are output
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-2-2 --stop-position=0-1-3 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 21:
+# Successive binary logs (e.g. logs with previous logs that have been
+# purged) will write events when the --start-position matches their
+# Gtid_list_log_event state
+#
+# Reset server state
+RESET MASTER;
+FLUSH LOGS;
+FLUSH LOGS;
+PURGE BINARY LOGS TO "master-bin.000002";
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3,1-2-5 | MYSQL
+DROP TABLE t3;
+#
+# Test Case 22:
+# Successive binary logs can be called with --stop-position and
+# without --start-position
+#
+# Reset server state
+RESET MASTER;
+FLUSH LOGS;
+FLUSH LOGS;
+PURGE BINARY LOGS TO "master-bin.000002";
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --stop-position=0-1-4 | MYSQL
+DROP TABLE t3;
+#
+# Remote-only setup for error cases
+RESET MASTER;
+FLUSH LOGS;
+FLUSH LOGS;
+PURGE BINARY LOGS TO "master-bin.000002";
+# At the following error cases analysis
+# note incompatible --start-position with the value of
+# Gtid list event of the 2nd binlog file printed above.
+#
+# Error Case 1:
+# A GTID --start-position that does not mention all domains that make
+# up the binary log state should error
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-3 > tmp_out_ 2> err_out_
+FOUND 1 /ERROR: Got error reading packet from server/ in err.out
+#
+# Error Case 2:
+# A GTID --start-position with any sequence numbers which occur before
+# the binary log state should result in error
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-2,1-2-5 > tmp_out_ 2> err_out_
+FOUND 1 /ERROR: Got error reading packet from server/ in err.out
+#
+# Error Case 3:
+# A GTID --start-position with any sequence numbers that are not
+# eventually processed results in error
+# MYSQL_BINLOG BINLOG_FILE_PARAM2 --start-position=0-1-8,1-2-6 > tmp_out_ 2> err_out_
+FOUND 1 /ERROR: Got error reading packet from server/ in err.out
+#
+# Remote-only cleanup from error cases
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+RESET MASTER;
+#
+# Error Case 4:
+# User provides invalid positions
+# MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=z
+# MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=1-
+# MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=1-2
+# MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=1-2-
+# MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=-1
+#
+# Error Case 5:
+# User provides GTID ranges with repeated domain ids
+# MYSQL_BINLOG MYSQLD_DATADIR/master-bin.000001 --start-position=0-1-1,0-1-8 --stop-position=0-1-4,0-1-12
+##############################
+# Cleanup
+##############################
+SET @@global.gtid_domain_id= 0;
+SET @@global.server_id= 1;
+# End of the tests