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
|
###########################################################################
# Test case to verify that main thread which start group_replication waits
# for applier thread to properly initialized before calling its termination
# in case of failure.
#
# Test:
# 0. The test requires two servers M1 & M2.
# 1. START GROUP_REPLICATION on server1.
# Also set group_replication_applier_thread_init_wait
# dbug_sync point to make applier thread wait.
# 2. KILL START GROUP_REPLICATION query and connection,
# to simulate CTRL-C/Z'ED `START GROUP_REPLICATION`.
# 3. Reap the killed command and reset debug point.
# 4. Restart Group Replication on server1
# 5. Clean up.
###########################################################################
--source include/not_valgrind.inc
--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
SET sql_log_bin = 0;
call mtr.add_suppression("Unblocking the group replication thread waiting for applier to start, as the start group replication was killed.");
call mtr.add_suppression("Unable to initialize the Group Replication applier module.");
call mtr.add_suppression("Failed to setup the group replication applier thread.");
call mtr.add_suppression("Error while starting the group replication applier thread");
call mtr.add_suppression("Failed to stop the group replication applier thread.");
call mtr.add_suppression("Info table is not ready to be used.*");
call mtr.add_suppression("Error writing relay log configuration.");
call mtr.add_suppression("Error writing source configuration");
call mtr.add_suppression("Error reading source configuration");
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("Unable to confirm whether the server has left the group or not. Check performance_schema.replication_group_members to check group membership information.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
SET sql_log_bin = 1;
--echo
--echo # 1. START GROUP_REPLICATION on server1.
--echo # Also set group_replication_applier_thread_init_wait
--echo # dbug_sync point to make applier thread wait.
--let $connection_id= `SELECT CONNECTION_ID()`
SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,group_replication_applier_thread_init_wait';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
SET GLOBAL group_replication_bootstrap_group=ON;
--send START GROUP_REPLICATION
--echo
--echo # 2. Wait until applier thread reaches the
--echo # group_replication_applier_thread_init_wait debug sync point.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
--source include/wait_condition.inc
--echo
--echo # 3. KILL START GROUP_REPLICATION query and connection,
--echo # to simulate CTRL-C/Z'ED `START GROUP_REPLICATION`.
--replace_result $connection_id CONNECTION_ID
--eval KILL QUERY $connection_id
--replace_result $connection_id CONNECTION_ID
--eval KILL $connection_id
--echo
--echo # 4. Reap the killed command and reset debug point.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--error CR_SERVER_LOST
--reap
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
--echo
--echo # 5. Restart Group Replication on server1
# Give time for the start thread to be detected as killed on the applier start
--sleep 3
#Unblock
SET DEBUG_SYNC= "now SIGNAL signal.gr_applier_init_signal";
SET @@GLOBAL.DEBUG= @debug_save;
--let $wait_condition=SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND='Killed' && INFO LIKE 'START GROUP_REPLICATION%'
--source include/wait_condition.inc
# set group_replication_group_name command is failing as the previous start
# process may still be running so can't use
# start_and_bootstrap_group_replication.inc.
START GROUP_REPLICATION;
--let $group_replication_member_state= ONLINE
--source include/gr_wait_for_member_state.inc
--echo
--echo # 6. Clean Up
--source include/group_replication_end.inc
|