| 1 |
# This file provides the structure to run a single test that ensures the |
| 2 |
# mariadb-binlog command line tool is consistent with replicas for event |
| 3 |
# filtering. The test is configured using the following input parameters, where |
| 4 |
# each is nullable (i.e. it will not be used to configure mariadb-binlog or |
| 5 |
# the replica). |
| 6 |
# |
| 7 |
# param $do_domain_ids : A list of domain ids to include in replication |
| 8 |
# param $ignore_domain_ids : A list of domain ids to exclude from replication |
| 9 |
# param $ignore_server_ids : A list of server ids to exclude from replication |
| 10 |
# param $start_position : The GTID positions to begin replication from in |
| 11 |
# the specified domains |
| 12 |
# param $stop_position : The GTID positions that mark the end of an event |
| 13 |
# stream in a particular domain |
| 14 |
# |
| 15 |
# param $con1 : The connection name of the primary server |
| 16 |
# param $con2 : The connection name of the replica server |
| 17 |
# param $strict_mode : Uses input and checks for out of order GTIDs |
| 18 |
# param $strict_mode_err : A boolean that provides expectations for strict |
| 19 |
# mode to error |
| 20 |
# param $slave_sql_errno : Expected error number of the slave SQL thread |
| 21 |
|
| 22 |
|
| 23 |
--let $include_filename= mysqlbinlog_slave_consistency.inc |
| 24 |
--source include/begin_include_file.inc |
| 25 |
|
| 26 |
--enable_query_log |
| 27 |
|
| 28 |
if (!$con1) |
| 29 |
{ |
| 30 |
--let $con1=master |
| 31 |
} |
| 32 |
if (!$con2) |
| 33 |
{ |
| 34 |
--let $con2=slave |
| 35 |
} |
| 36 |
|
| 37 |
if (!$strict_mode) |
| 38 |
{ |
| 39 |
--connection $con2 |
| 40 |
set @@global.gtid_strict_mode=0; |
| 41 |
--let $sql_input_file=include/sql_multisource.inc |
| 42 |
} |
| 43 |
|
| 44 |
if ($strict_mode) |
| 45 |
{ |
| 46 |
--connection $con2 |
| 47 |
set @@global.gtid_strict_mode=1; |
| 48 |
--let $sql_input_file=include/sql_out_of_order_gtid.inc |
| 49 |
} |
| 50 |
|
| 51 |
--connection $con2 |
| 52 |
--source include/stop_slave.inc |
| 53 |
|
| 54 |
--connection $con1 |
| 55 |
--echo # Populating $con1 data |
| 56 |
--source $sql_input_file |
| 57 |
--source include/save_master_gtid.inc |
| 58 |
|
| 59 |
--let $MYSQLD_DATADIR=`select @@datadir` |
| 60 |
--let $MYSQLBINLOG_STDERR=$MYSQLD_DATADIR/mysqlbinlog_stderr.out |
| 61 |
--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1) |
| 62 |
--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig |
| 63 |
--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME $BINLOG_FILE_PARAM |
| 64 |
|
| 65 |
--connection $con2 |
| 66 |
--let $msbl_args= |
| 67 |
if (`SELECT strcmp("$start_position","") != 0`) |
| 68 |
{ |
| 69 |
eval set global gtid_slave_pos="$start_position"; |
| 70 |
--let $msbl_args= $msbl_args --start-position=$start_position |
| 71 |
} |
| 72 |
|
| 73 |
--let $cm_args= MASTER_USE_GTID=slave_pos |
| 74 |
if (`SELECT strcmp("$do_domain_ids","") != 0`) |
| 75 |
{ |
| 76 |
--let $cm_args= $cm_args, DO_DOMAIN_IDS=($do_domain_ids) |
| 77 |
--let $msbl_args= $msbl_args --do-domain-ids=$do_domain_ids |
| 78 |
} |
| 79 |
if (`SELECT strcmp("$ignore_domain_ids","") != 0`) |
| 80 |
{ |
| 81 |
--let $cm_args= $cm_args, IGNORE_DOMAIN_IDS=($ignore_domain_ids) |
| 82 |
--let $msbl_args= $msbl_args --ignore-domain-ids=$ignore_domain_ids |
| 83 |
} |
| 84 |
if (`SELECT strcmp("$ignore_server_ids","") != 0`) |
| 85 |
{ |
| 86 |
--let $cm_args= $cm_args, IGNORE_SERVER_IDS=($ignore_server_ids) |
| 87 |
--let $msbl_args= $msbl_args --ignore-server-ids=$ignore_server_ids |
| 88 |
} |
| 89 |
if ($strict_mode) |
| 90 |
{ |
| 91 |
--let $msbl_args= $msbl_args --gtid-strict-mode |
| 92 |
} |
| 93 |
eval CHANGE MASTER TO $cm_args; |
| 94 |
|
| 95 |
--let $start_slave_args= |
| 96 |
if (`SELECT strcmp("$stop_position","") != 0`) |
| 97 |
{ |
| 98 |
--let $start_slave_args= UNTIL master_gtid_pos="$stop_position" |
| 99 |
--let $msbl_args= $msbl_args --stop-position=$stop_position |
| 100 |
} |
| 101 |
|
| 102 |
eval START SLAVE $start_slave_args; |
| 103 |
|
| 104 |
if ($slave_sql_errno) |
| 105 |
{ |
| 106 |
--echo # $con2 SQL Thread error expected - waiting for errno $slave_sql_errno |
| 107 |
--source include/wait_for_slave_sql_error.inc |
| 108 |
} |
| 109 |
|
| 110 |
# If we are not expecting an error, wait for con2 to catch up |
| 111 |
if (!$slave_sql_errno) |
| 112 |
{ |
| 113 |
--echo # No $con2 error expecting - waiting for $con2 to catch up to $con1 |
| 114 |
|
| 115 |
# Stop position was not specified |
| 116 |
if (`SELECT strcmp("$stop_position","") = 0`) |
| 117 |
{ |
| 118 |
--source include/sync_with_master_gtid.inc |
| 119 |
} |
| 120 |
|
| 121 |
# Stop position was specified |
| 122 |
if (`SELECT strcmp("$stop_position","") != 0`) |
| 123 |
{ |
| 124 |
--echo # Because there is a stop position we wait for all events to process |
| 125 |
--echo # and $con2 to automatically stop |
| 126 |
--source include/wait_for_slave_to_stop.inc |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
--echo # Stop $con2 so it stops receiving $con1 events. |
| 131 |
--let $rpl_allow_error= 1 |
| 132 |
--source include/stop_slave.inc |
| 133 |
|
| 134 |
--connection $con1 |
| 135 |
DROP TABLE IF EXISTS t1, t2, t3, t4, t5; |
| 136 |
RESET MASTER; |
| 137 |
--echo # MYSQL_BINLOG BINLOG_FILE_PARAM $msbl_args 2> MYSQLBINLOG_STDERR | MYSQL |
| 138 |
--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM $msbl_args 2> $MYSQLBINLOG_STDERR | $MYSQL |
| 139 |
|
| 140 |
--source include/rpl_check_table_consistency.inc |
| 141 |
|
| 142 |
if ($strict_mode) |
| 143 |
{ |
| 144 |
--echo # Strict mode enabled - checking mysqlbinlog error output for out |
| 145 |
--echo # of order GTIDs |
| 146 |
--let SEARCH_FILE=$MYSQLBINLOG_STDERR |
| 147 |
--let SEARCH_PATTERN=Found out of order GTID |
| 148 |
if ($strict_mode_err) |
| 149 |
{ |
| 150 |
--echo # Expecting to find out of order GTID error.. |
| 151 |
} |
| 152 |
if (!$strict_mode_err) |
| 153 |
{ |
| 154 |
--echo # Not expecting to find out of order GTID error.. |
| 155 |
} |
| 156 |
--source include/search_pattern_in_file.inc |
| 157 |
} |
| 158 |
|
| 159 |
--echo # Test finished - resetting $con1 and $con2.. |
| 160 |
--connection $con2 |
| 161 |
RESET SLAVE; |
| 162 |
RESET MASTER; |
| 163 |
set global gtid_slave_pos=""; |
| 164 |
CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); |
| 165 |
|
| 166 |
--connection $con1 |
| 167 |
RESET MASTER; |
| 168 |
DROP TABLE IF EXISTS t1, t2, t3, t4, t5; |
| 169 |
--source include/save_master_gtid.inc |
| 170 |
|
| 171 |
--connection $con2 |
| 172 |
--source include/start_slave.inc |
| 173 |
--source include/wait_for_slave_to_start.inc |
| 174 |
--source include/sync_with_master_gtid.inc |
| 175 |
--source include/stop_slave.inc |
| 176 |
RESET SLAVE; |
| 177 |
set global gtid_slave_pos=""; |
| 178 |
RESET MASTER; |
| 179 |
|
| 180 |
--connection $con1 |
| 181 |
RESET MASTER; |
| 182 |
|
| 183 |
--connection $con2 |
| 184 |
if ($strict_mode) |
| 185 |
{ |
| 186 |
set @@global.gtid_strict_mode=0; |
| 187 |
} |
| 188 |
--source include/start_slave.inc |
| 189 |
|
| 190 |
--connection $con1 |
| 191 |
--remove_file $BINLOG_FILE_PARAM |
| 192 |
--remove_file $MYSQLBINLOG_STDERR |
| 193 |
|
| 194 |
--let $include_filename= mysqlbinlog_slave_consistency.inc |
| 195 |
--source include/end_include_file.inc |