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
|
# Verify that after CHANGE MASTER, replication (I/O thread and SQL
# thread) restart from where SQL thread left, not from where
# I/O thread left (some old bug fixed in 4.0.17)
call mtr.add_suppression("Replica I/O: The replica I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
--connection default
let $check_ipv6_just_check=1;
source include/check_ipv6.inc;
let $check_ipv6_just_check=0;
connection slave;
let $save_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
connection master;
# Make SQL slave thread advance a bit
create table t1(n int);
--sync_slave_with_master
select * from t1;
# Now stop it and make I/O slave thread be ahead
stop slave sql_thread;
connection master;
insert into t1 values(1);
insert into t1 values(2);
save_master_pos;
let $slave_param= Read_Master_Log_Pos;
let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
connection slave;
source include/wait_for_slave_param.inc;
source include/stop_slave.inc;
let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
if ($read_pos == $exec_pos)
{
source include/show_rpl_debug_info.inc;
echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
}
--replace_column 2 ####
CHANGE REPLICATION SOURCE to SOURCE_USER='root';
let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
if ($read_pos != $exec_pos)
{
source include/show_rpl_debug_info.inc;
echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
}
start slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
--sync_slave_with_master
# End of 4.1 tests
#
# BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE
#
--source include/rpl_reset.inc
connection master;
create table t1 (a int);
insert into t1 values (1);
flush logs;
insert into t1 values (2);
# Note: the master positon saved by this will also be used by the
# 'sync_with_master' below.
--sync_slave_with_master
# Check if the table t1 and t2 are identical on master and slave;
--let $diff_tables= master:t1, slave:t1
--source include/diff_tables.inc
connection slave;
source include/stop_slave.inc;
delete from t1 where a=2;
# start replication from the second insert, after fix of BUG#12190,
# relay_log_file does not use absolute path, only the filename is
# required
#
# Note: the follow change master will automatically reset
# relay_log_purge to false, save the old value to restore
let $relay_log_purge= `select @@global.relay_log_purge`;
CHANGE REPLICATION SOURCE TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4;
start slave sql_thread;
source include/wait_for_slave_sql_to_start.inc;
# Sync to the same position saved by the 'sync_slave_with_master' above.
sync_with_master;
# Check if the table t1 and t2 are identical on master and slave;
--let $diff_tables= master:t1, slave:t1
--source include/diff_tables.inc
# clean up
connection slave;
start slave io_thread;
source include/wait_for_slave_io_to_start.inc;
eval set global relay_log_purge=$relay_log_purge;
connection master;
drop table t1;
--sync_slave_with_master
#
# BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected from each other
#
-- connection master
-- source include/rpl_reset.inc
-- connection slave
-- let $retry_count0= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
# assertion: show that the command line is still valid (MTR sets it to 10)
-- echo Master_Retry_Count: $retry_count
-- source include/stop_slave.inc
# action: change the initial value to some other value
-- let $retry_count1= `SELECT $retry_count0+10`
-- eval CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=$retry_count1
-- source include/start_slave.inc
-- let $retry_count1= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
# assertion: it shows the new value -- retry_count0 +10
if (`SELECT $retry_count1 <> ($retry_count0+10)`)
{
-- let $expected= `SELECT $retry_count0+10`
-- echo Unexpected retry count value! Got: $retry_count1, expected: $expected
-- die
}
-- source include/stop_slave.inc
# action: change master_retry_count to zero will set it to zero.
-- let $retry_count1= 0
-- eval CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=$retry_count1
-- source include/start_slave.inc
-- let $retry_count2= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
# assertion: it shows no changes
if ($retry_count2 != $retry_count1)
{
-- echo Unexpected retry count value! Got: $retry_count2, expected: $retry_count1
-- die
}
-- source include/stop_slave.inc
# action: change the value to the smallest value possible
CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=1;
-- source include/start_slave.inc
-- let $retry_count3= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
# assertion: it should show 1
if ($retry_count3 != 1)
{
-- echo Unexpected retry count value! Got: $retry_count3, expected: 1
-- die
}
-- source include/stop_slave.inc
# action: change the value back to the original one
-- eval CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=$retry_count0
-- source include/start_slave.inc
-- let $retry_count4= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
# assertion: it should show 1
if ($retry_count4 != $retry_count0)
{
-- echo Unexpected retry count value! Got: $retry_count4, expected: $retry_count0
-- die
}
## Now lets change master_retry_count to the maximum value possible
## and stop and restart the slave to check that (in the middle of it
## we also check that when issueing CHANGE MASTER TO without specifying
## master_retry_count will not affect its current value):
## 1. master_retry_count persists after restart
## 2. setting a value higher than the max will make the max to be set.
## 3. maximum value is accepted and persists after serialization
## and de-serialization
-- source include/stop_slave.inc
-- let $retry_count_set= 18446744073709551616
-- replace_result 18446744073709551616 RETRY_COUNT_SET
-- eval CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=$retry_count_set
-- let $retry_count_expected= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
-- replace_result 18446744073709551615 RETRY_COUNT_EXPECTED 4294967295 RETRY_COUNT_EXPECTED 9223372036854775807 RETRY_COUNT_EXPECTED
-- eval SELECT $retry_count_expected AS current_retry_count
## assert that issuing CHANGE MASTER without changing master_retry_count
## does not affect the existing value for master_retry_count
-- let $connect_retry_old= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1)
-- let $connect_retry_new= `SELECT $connect_retry_old + 1`
-- let $retry_count_before= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
-- eval CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY= $connect_retry_new
-- let $retry_count_after= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
if ($retry_count_before != $retry_count_after)
{
-- echo Unexpected retry count value! Got: $retry_count_after, expected: $retry_count_before
-- die
}
-- eval CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY= $connect_retry_old
## Server restart persisting test
--let $rpl_server_number= 2
--source include/rpl_restart_server.inc
-- source include/start_slave.inc
-- let $retry_count5= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
if ($retry_count5 != $retry_count_expected)
{
-- echo Unexpected retry count value! Got: $retry_count5, expected: $retry_count_expected
-- die
}
# action: change the value back to the original one
-- source include/stop_slave.inc
-- eval CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=$retry_count0
## assert that there is a parse error if not using a numerical value
-- error ER_PARSE_ERROR
CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT='a';
## assert that there is a parse error if using a negative number
-- error ER_PARSE_ERROR
CHANGE REPLICATION SOURCE TO SOURCE_RETRY_COUNT=-1;
-- source include/start_slave.inc
## assert that the test has cleaned itself up
-- let $retry_count6= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1)
if ($retry_count6 != $retry_count0)
{
-- echo Unexpected retry count value! Got: $retry_count6, expected: $retry_count0
-- die
}
## Checks if Replicate_Ignore_Server_Ids is correctly written to a repository.
--connection slave
-- source include/stop_slave.inc
-- let $connect_old_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1)
-- let $ignore_old_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1)
-- eval CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY= 200, IGNORE_SERVER_IDS= (100, 200, 300, 400, 500)
-- let $connect_new_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1)
-- let $ignore_new_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1)
--let $rpl_server_number= 2
--source include/rpl_restart_server.inc
-- source include/start_slave.inc
-- let $connect_crash_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1)
-- let $ignore_crash_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1)
-- echo Eexpected values: "$ignore_new_value" == "$ignore_crash_value" or $connect_new_value == $connect_crash_value
if (`SELECT "$ignore_new_value" <> "$ignore_crash_value" || $connect_new_value <> $connect_crash_value`)
{
-- echo Unexpected values: "$ignore_new_value" <> "$ignore_crash_value" or $connect_new_value <> $connect_crash_value
-- die
}
# clean up
--source include/stop_slave.inc
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= ();
--source include/start_slave.inc
#
# WL#3127 slave side TCP address binding
# - CHANGE MASTER ... MASTER_BIND='interface'
# - SHOW SLAVE STATUS has new column Master_Bind
#
# Test valid IPv4 address
let $master_bind='127.0.0.1';
--source extra/rpl_tests/rpl_change_master_bind.inc
# Test invalid IPv4 address
let $master_bind='1.1.1.1';
let $master_bind_error_expected=2003;
--source extra/rpl_tests/rpl_change_master_bind.inc
let $master_bind_error_expected=0;
# Test valid IPv6 address
let $master_bind='::1';
if (!$check_ipv6_supported)
{
# No IPv6 support, fallback to IPv4
let $master_bind='127.0.0.1';
}
--source extra/rpl_tests/rpl_change_master_bind.inc
# Test with no bind address(check that reset works)
let $master_bind='';
--source extra/rpl_tests/rpl_change_master_bind.inc
### Revert to original master_host value
--source include/stop_slave.inc
--replace_result $save_master_host SAVE_MASTER_HOST
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='$save_master_host'
--source include/start_slave.inc
|