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
|
###############################
# Test Setup
###############################
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 @@session.server_id= 2;
CREATE TABLE t2 (a int);
INSERT INTO t2 values (3);
SET @@session.gtid_domain_id= 1;
SET @@session.server_id= 1;
CREATE TABLE t3 (a int);
INSERT INTO t3 values (4);
SET @@session.server_id= 3;
SET timestamp=@a+1;
CREATE TABLE t4 (a int);
SET timestamp=@a+2;
INSERT INTO t4 values (5);
SET @@session.gtid_domain_id= 0;
SET @@session.server_id= 1;
INSERT INTO t1 values (1);
SET @@session.gtid_domain_id= 2;
SET @@session.server_id= 1;
CREATE TABLE t5 (a int);
INSERT INTO t5 values (6);
SET @@session.gtid_domain_id= 0;
SET @@session.server_id= 1;
INSERT INTO t1 values (2);
FLUSH LOGS;
SET @@session.gtid_domain_id= 0;
SET @@session.server_id= 2;
CREATE TABLE t6 (a int);
INSERT INTO t6 values (1);
FLUSH LOGS;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
DROP TABLE t5;
DROP TABLE t6;
RESET MASTER;
###############################
# Test Cases
###############################
#
# Test Case 1) --do-server-ids with a single server id limits output
# to that single server
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 | MYSQL
DROP TABLE t2;
#
# Test Case 2) --do-server-ids with multiple server ids limits output
# to the provided servers
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2,3 | MYSQL
DROP TABLE t2;
DROP TABLE t4;
#
# Test Case 3) --do-server-ids when combined with --do-domain-ids should
# intersect the results
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | MYSQL
DROP TABLE t1;
#
# Test Case 4) --do-server-ids when combined with --ignore-domain-ids should
# intersect the results
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | MYSQL
DROP TABLE t3;
DROP TABLE t5;
#
# Test Case 5) --do-server-ids when combined with a GTID range should
# intersect the results
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | MYSQL
DROP TABLE t1;
#
# Test Case 6) --do-server-ids when combined with both --ignore-domain-ids
# and a GTID range should intersect all results
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | MYSQL
DROP TABLE t3;
DROP TABLE t5;
#
# Test Case 7) --do-server-ids when combined with both --do-domain-ids and
# a GTID range should intersect all results
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | MYSQL
DROP TABLE t2;
#
# Test Case 8) --do-server-ids and --offset=<n> skips n events after the
# first GTID is found
CREATE TABLE t4 (a int);
# MYSQL_BINLOG BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | MYSQL
DROP TABLE t4;
#
# Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs
# after the first GTID is found results in no events before T
CREATE TABLE t4 (a int);
# MYSQL_BINLOG BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | MYSQL
DROP TABLE t4;
#
# Test Case 10) --do-server-ids works with --read-from-remote-server
# Setup test specific data
RESET MASTER;
SET @@session.gtid_domain_id= 0;
SET @@session.server_id= 1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1);
SET @@session.server_id= 2;
CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES (1);
SET @@session.server_id= 1;
DROP TABLE t1;
DROP TABLE t2;
# MYSQL_BINLOG BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | MYSQL
DROP TABLE t2;
#
# Test Case 11) --do-server-ids works over multiple binary log input
# files
# MYSQL_BINLOG BINLOG_FILE_PARAM BINLOG_FILE_PARAM2 --do-server-ids=2 | MYSQL
DROP TABLE t2;
DROP TABLE t6;
#
# Test Case 12) --do-server-ids re-specifications should override
# previous ones
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | MYSQL
DROP TABLE t2;
#
# Test Case 13) --do-server-ids and --server-id should be aliases and
# a re-specification of one should override the former
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | MYSQL
DROP TABLE t2;
#
# Test Case 14) --ignore-server-ids re-specifications should override
# previous ones
# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | MYSQL
DROP TABLE t2;
#
# Test Case 15) --do-domain-ids re-specifications should override
# previous ones
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | MYSQL
DROP TABLE t1,t2;
#
# Test Case 16) --ignore-domain-ids re-specifications should override
# previous ones
# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | MYSQL
DROP TABLE t1,t2;
##############################
# Error Cases
##############################
#
# Error Case 1:
# --ignore-server-ids and --do-server-ids both specified
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2
#
# Error Case 2:
# Invalid server ID number provided
# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=-1
##############################
# Cleanup
##############################
SET @@global.gtid_domain_id= 0;
SET @@global.server_id= 1;
# End of tests
|