| 1 |
############################################################################## |
| 2 |
# |
| 3 |
# This test validates parallel shutdown of all members is safe. |
| 4 |
# When shutdown happens 2 parallel things may happen in group replication. |
| 5 |
# View change may happen due to member shutdown and applier may stop due to |
| 6 |
# kill received from shutdown operation. |
| 7 |
# This test makes sure above mentioned parallel operations are handled properly. |
| 8 |
# |
| 9 |
# Test: |
| 10 |
# 0. The test requires two servers: M1(primary) and M2(secondary). |
| 11 |
# 1. Start GR on server1 & server2. |
| 12 |
# 2. Add debug point to |
| 13 |
# 2.1. make sure primary change fails on server2. |
| 14 |
# 2.2. delay primary change operation to allow shutdown to send KILL signals |
| 15 |
# 2.3. block applier processing so suspension packets is not processed |
| 16 |
# 3. Stop GR on server1, server2 become primary |
| 17 |
# 4. Primary change happens on server2 but is delayed with help of |
| 18 |
# group_replication_wait_for_current_events_execution_fail debug point. |
| 19 |
# 5. Execute shutdown so that applier threads receives the KILL signal. |
| 20 |
# 6. Cleanup |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
# Do not run on valgrind due to restart and sleeps used. |
| 24 |
--source include/not_valgrind.inc |
| 25 |
# Big-test due to restart of server |
| 26 |
--source include/big_test.inc |
| 27 |
--source include/have_debug_sync.inc |
| 28 |
--source include/have_group_replication_plugin.inc |
| 29 |
--let $rpl_group_replication_single_primary_mode=1 |
| 30 |
--let $rpl_skip_group_replication_start= 1 |
| 31 |
--source include/group_replication.inc |
| 32 |
|
| 33 |
--echo |
| 34 |
--echo # 1. Start GR on server1 & server2. |
| 35 |
--let $rpl_connection_name= server1 |
| 36 |
--source include/rpl_connection.inc |
| 37 |
--source include/start_and_bootstrap_group_replication.inc |
| 38 |
|
| 39 |
--let $rpl_connection_name= server2 |
| 40 |
--source include/rpl_connection.inc |
| 41 |
|
| 42 |
SET SESSION sql_log_bin = 0; |
| 43 |
call mtr.add_suppression("There was an issue on the primary election process: Could not wait for the execution of local transactions. The member will now leave the group."); |
| 44 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 45 |
call mtr.add_suppression("The group replication applier thread has received KILL request."); |
| 46 |
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); |
| 47 |
call mtr.add_suppression("Skipping leave operation: member already left the group."); |
| 48 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 49 |
call mtr.add_suppression("Error, maximum number of retries exceeded when waiting for the internal server session state to be operating"); |
| 50 |
call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations"); |
| 51 |
SET SESSION sql_log_bin = 1; |
| 52 |
--source include/start_group_replication.inc |
| 53 |
|
| 54 |
--echo |
| 55 |
--echo # 2. Add debug point to |
| 56 |
--echo # 2.1. make sure primary change fails on server2. |
| 57 |
--echo # 2.2. delay primary change operation to allow shutdown to send KILL signals |
| 58 |
--echo # 2.3. block applier processing so suspension packets is not processed |
| 59 |
|
| 60 |
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_for_current_events_execution_fail'; |
| 61 |
|
| 62 |
--echo |
| 63 |
--echo # 3. Stop GR on server1, server2 become primary |
| 64 |
|
| 65 |
--let $rpl_connection_name= server1 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
|
| 68 |
--source include/stop_group_replication.inc |
| 69 |
|
| 70 |
--echo |
| 71 |
--echo # 4. Primary change happens on server2 but is delayed with help of |
| 72 |
--echo # group_replication_wait_for_current_events_execution_fail debug point. |
| 73 |
|
| 74 |
--let $rpl_connection_name= server2 |
| 75 |
--source include/rpl_connection.inc |
| 76 |
|
| 77 |
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_wait_for_current_events_execution_fail_applier_add_suspension_packet"; |
| 78 |
|
| 79 |
--echo |
| 80 |
--echo # 5. Execute shutdown so that applier threads receives the KILL signal. |
| 81 |
|
| 82 |
--let $allow_rpl_inited=1 |
| 83 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 84 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 85 |
--let $restart_parameters=restart:--group-replication-group-name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_single_primary_mode=1 --group_replication_enforce_update_everywhere_checks=0 |
| 86 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS |
| 87 |
--let $shutdown_server_timeout = 18000 |
| 88 |
--source include/restart_mysqld.inc |
| 89 |
|
| 90 |
--let $rpl_server_number= 2 |
| 91 |
--source include/rpl_reconnect.inc |
| 92 |
|
| 93 |
--echo |
| 94 |
--echo # 6. Cleanup |
| 95 |
|
| 96 |
--let $rpl_connection_name= server1 |
| 97 |
--source include/rpl_connection.inc |
| 98 |
--source include/start_and_bootstrap_group_replication.inc |
| 99 |
|
| 100 |
--let $rpl_connection_name= server2 |
| 101 |
--source include/rpl_connection.inc |
| 102 |
--source include/start_group_replication.inc |
| 103 |
|
| 104 |
--source include/group_replication_end.inc |