| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# During shutdown of the master, check Slave_IO_Running status |
| 4 |
# after reconnecting a specified number of times. |
| 5 |
# |
| 6 |
# ==== Usage ==== |
| 7 |
# |
| 8 |
# --let $overflow= 0 |
| 9 |
# --let $retry_count= 3 |
| 10 |
# --let $expected_Slave_IO_Running_status= Connecting |
| 11 |
# --source rpl_mdev36002.inc |
| 12 |
# |
| 13 |
# Parameters: |
| 14 |
# $overflow |
| 15 |
# If overflow equals 1, the DEBUG flag 'set_slave_err_count_near_overflow' |
| 16 |
# will be activated, and the number of tries made will be initialized to |
| 17 |
# ULONG_MAX - 2. |
| 18 |
# |
| 19 |
# $retry_count |
| 20 |
# The number of reconnections the slave will do during shutdown of the master. |
| 21 |
# |
| 22 |
# $expected_Slave_IO_Running_status |
| 23 |
# Whether Slave_IO_Running should be Connecting/No |
| 24 |
# after reconnecting $retry_count times. |
| 25 |
# |
| 26 |
|
| 27 |
|
| 28 |
--source include/have_debug.inc |
| 29 |
--source include/have_debug_sync.inc |
| 30 |
|
| 31 |
# Set MASTER_CONNECT_RETRY as 1 second |
| 32 |
--let $rpl_skip_start_slave= 1 |
| 33 |
--source include/master-slave.inc |
| 34 |
|
| 35 |
--connection slave |
| 36 |
CHANGE MASTER TO MASTER_CONNECT_RETRY= 1; |
| 37 |
--source include/start_slave.inc |
| 38 |
|
| 39 |
|
| 40 |
# Set err_count as ULONG_MAX if necessary and starts up sync points |
| 41 |
SET @saved_dbug= @@GLOBAL.debug_dbug; |
| 42 |
|
| 43 |
if ($overflow) |
| 44 |
{ |
| 45 |
SET @@GLOBAL.debug_dbug= '+d,set_slave_err_count_near_overflow'; |
| 46 |
} |
| 47 |
SET @@GLOBAL.debug_dbug= '+d,sync_master_retry'; |
| 48 |
|
| 49 |
|
| 50 |
# stop the master |
| 51 |
--let $rpl_server_number= 1 |
| 52 |
--source include/rpl_stop_server.inc |
| 53 |
|
| 54 |
# Everytime the reconnection is done, check the status of Slave_IO_Running |
| 55 |
while ($retry_count) |
| 56 |
{ |
| 57 |
SET @@SESSION.debug_sync= 'now WAIT_FOR master_retry_sleep'; |
| 58 |
--let $slave_param= Slave_IO_Running |
| 59 |
--let $slave_param_value= Connecting |
| 60 |
--source include/wait_for_slave_param.inc |
| 61 |
|
| 62 |
SET @@SESSION.debug_sync= 'now SIGNAL master_retry_continue'; |
| 63 |
--dec $retry_count |
| 64 |
} |
| 65 |
|
| 66 |
# after exhausting exactly that many number of tries, |
| 67 |
# the Slave_IO_Running status should be expected. |
| 68 |
|
| 69 |
--echo Slave_IO_Running status should be $expected_Slave_IO_Running_status |
| 70 |
--let $slave_param= Slave_IO_Running |
| 71 |
--let $slave_param_value= $expected_Slave_IO_Running_status |
| 72 |
--source include/wait_for_slave_param.inc |
| 73 |
|
| 74 |
SET @@GLOBAL.debug_dbug= @saved_dbug; |
| 75 |
|
| 76 |
|
| 77 |
# Restart the master to reestablish a successful slave connection for clean-up |
| 78 |
--let $rpl_server_number= 1 |
| 79 |
--source include/rpl_start_server.inc |
| 80 |
|
| 81 |
--connection slave |
| 82 |
--disable_warnings |
| 83 |
START SLAVE; |
| 84 |
--enable_warnings |
| 85 |
--let $rpl_allow_error= 1 |
| 86 |
--source include/wait_for_slave_io_to_start.inc |
| 87 |
|
| 88 |
--source include/rpl_end.inc |