############################################################################## # # This test validates parallel shutdown of all members is safe. # When shutdown happens 2 parallel things may happen in group replication. # View change may happen due to member shutdown and applier may stop due to # kill received from shutdown operation. # This test makes sure above mentioned parallel operations are handled properly. # # Test: # 0. The test requires two servers: M1(primary) and M2(secondary). # 1. Start GR on server1 & server2. # 2. Add debug point to # 2.1. make sure primary change fails on server2. # 2.2. delay primary change operation to allow shutdown to send KILL signals # 2.3. block applier processing so suspension packets is not processed # 3. Stop GR on server1, server2 become primary # 4. Primary change happens on server2 but is delayed with help of # group_replication_wait_for_current_events_execution_fail debug point. # 5. Execute shutdown so that applier threads receives the KILL signal. # 6. Cleanup ############################################################################## # Do not run on valgrind due to restart and sleeps used. --source include/not_valgrind.inc # Big-test due to restart of server --source include/big_test.inc --source include/have_debug_sync.inc --source include/have_group_replication_plugin.inc --let $rpl_group_replication_single_primary_mode=1 --let $rpl_skip_group_replication_start= 1 --source include/group_replication.inc --echo --echo # 1. Start GR on server1 & server2. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/start_and_bootstrap_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc SET SESSION sql_log_bin = 0; 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."); call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); call mtr.add_suppression("The group replication applier thread has received KILL request."); call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); call mtr.add_suppression("Skipping leave operation: member already left the group."); call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); call mtr.add_suppression("Error, maximum number of retries exceeded when waiting for the internal server session state to be operating"); call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations"); SET SESSION sql_log_bin = 1; --source include/start_group_replication.inc --echo --echo # 2. Add debug point to --echo # 2.1. make sure primary change fails on server2. --echo # 2.2. delay primary change operation to allow shutdown to send KILL signals --echo # 2.3. block applier processing so suspension packets is not processed SET @@GLOBAL.DEBUG= '+d,group_replication_wait_for_current_events_execution_fail'; --echo --echo # 3. Stop GR on server1, server2 become primary --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/stop_group_replication.inc --echo --echo # 4. Primary change happens on server2 but is delayed with help of --echo # group_replication_wait_for_current_events_execution_fail debug point. --let $rpl_connection_name= server2 --source include/rpl_connection.inc SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_wait_for_current_events_execution_fail_applier_add_suspension_packet"; --echo --echo # 5. Execute shutdown so that applier threads receives the KILL signal. --let $allow_rpl_inited=1 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` --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 --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 --let $shutdown_server_timeout = 18000 --source include/restart_mysqld.inc --let $rpl_server_number= 2 --source include/rpl_reconnect.inc --echo --echo # 6. Cleanup --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/start_and_bootstrap_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/start_group_replication.inc --source include/group_replication_end.inc