| 1 |
########################################################################### |
| 2 |
# Test case to verify that main thread which start group_replication waits |
| 3 |
# for applier thread to properly initialized before calling its termination |
| 4 |
# in case of failure. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. The test requires two servers M1 & M2. |
| 8 |
# 1. START GROUP_REPLICATION on server1. |
| 9 |
# Also set group_replication_applier_thread_init_wait |
| 10 |
# dbug_sync point to make applier thread wait. |
| 11 |
# 2. KILL START GROUP_REPLICATION query and connection, |
| 12 |
# to simulate CTRL-C/Z'ED `START GROUP_REPLICATION`. |
| 13 |
# 3. Reap the killed command and reset debug point. |
| 14 |
# 4. Restart Group Replication on server1 |
| 15 |
# 5. Clean up. |
| 16 |
########################################################################### |
| 17 |
|
| 18 |
--source include/not_valgrind.inc |
| 19 |
--source include/have_debug_sync.inc |
| 20 |
--source include/have_group_replication_plugin.inc |
| 21 |
--let $rpl_skip_group_replication_start= 1 |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
SET sql_log_bin = 0; |
| 25 |
call mtr.add_suppression("Unblocking the group replication thread waiting for applier to start, as the start group replication was killed."); |
| 26 |
call mtr.add_suppression("Unable to initialize the Group Replication applier module."); |
| 27 |
call mtr.add_suppression("Failed to setup the group replication applier thread."); |
| 28 |
call mtr.add_suppression("Error while starting the group replication applier thread"); |
| 29 |
call mtr.add_suppression("Failed to stop the group replication applier thread."); |
| 30 |
call mtr.add_suppression("Info table is not ready to be used.*"); |
| 31 |
call mtr.add_suppression("Error writing relay log configuration."); |
| 32 |
call mtr.add_suppression("Error writing source configuration"); |
| 33 |
call mtr.add_suppression("Error reading source configuration"); |
| 34 |
call mtr.add_suppression("The group replication applier thread has received KILL request."); |
| 35 |
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); |
| 36 |
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."); |
| 37 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 38 |
SET sql_log_bin = 1; |
| 39 |
|
| 40 |
|
| 41 |
--echo |
| 42 |
--echo # 1. START GROUP_REPLICATION on server1. |
| 43 |
--echo # Also set group_replication_applier_thread_init_wait |
| 44 |
--echo # dbug_sync point to make applier thread wait. |
| 45 |
|
| 46 |
--let $connection_id= `SELECT CONNECTION_ID()` |
| 47 |
|
| 48 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 49 |
SET @@GLOBAL.DEBUG= '+d,group_replication_applier_thread_init_wait'; |
| 50 |
|
| 51 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 52 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 53 |
SET GLOBAL group_replication_bootstrap_group=ON; |
| 54 |
|
| 55 |
--send START GROUP_REPLICATION |
| 56 |
|
| 57 |
|
| 58 |
--echo |
| 59 |
--echo # 2. Wait until applier thread reaches the |
| 60 |
--echo # group_replication_applier_thread_init_wait debug sync point. |
| 61 |
|
| 62 |
--let $rpl_connection_name= server_1 |
| 63 |
--source include/rpl_connection.inc |
| 64 |
|
| 65 |
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now' |
| 66 |
--source include/wait_condition.inc |
| 67 |
|
| 68 |
|
| 69 |
--echo |
| 70 |
--echo # 3. KILL START GROUP_REPLICATION query and connection, |
| 71 |
--echo # to simulate CTRL-C/Z'ED `START GROUP_REPLICATION`. |
| 72 |
|
| 73 |
--replace_result $connection_id CONNECTION_ID |
| 74 |
--eval KILL QUERY $connection_id |
| 75 |
|
| 76 |
--replace_result $connection_id CONNECTION_ID |
| 77 |
--eval KILL $connection_id |
| 78 |
|
| 79 |
|
| 80 |
--echo |
| 81 |
--echo # 4. Reap the killed command and reset debug point. |
| 82 |
|
| 83 |
--let $rpl_connection_name= server1 |
| 84 |
--source include/rpl_connection.inc |
| 85 |
|
| 86 |
--error CR_SERVER_LOST |
| 87 |
--reap |
| 88 |
|
| 89 |
--let $rpl_server_number= 1 |
| 90 |
--source include/rpl_reconnect.inc |
| 91 |
|
| 92 |
|
| 93 |
--echo |
| 94 |
--echo # 5. Restart Group Replication on server1 |
| 95 |
|
| 96 |
# Give time for the start thread to be detected as killed on the applier start |
| 97 |
--sleep 3 |
| 98 |
|
| 99 |
#Unblock |
| 100 |
SET DEBUG_SYNC= "now SIGNAL signal.gr_applier_init_signal"; |
| 101 |
SET @@GLOBAL.DEBUG= @debug_save; |
| 102 |
|
| 103 |
--let $wait_condition=SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND='Killed' && INFO LIKE 'START GROUP_REPLICATION%' |
| 104 |
--source include/wait_condition.inc |
| 105 |
|
| 106 |
# set group_replication_group_name command is failing as the previous start |
| 107 |
# process may still be running so can't use |
| 108 |
# start_and_bootstrap_group_replication.inc. |
| 109 |
START GROUP_REPLICATION; |
| 110 |
|
| 111 |
--let $group_replication_member_state= ONLINE |
| 112 |
--source include/gr_wait_for_member_state.inc |
| 113 |
|
| 114 |
|
| 115 |
--echo |
| 116 |
--echo # 6. Clean Up |
| 117 |
|
| 118 |
--source include/group_replication_end.inc |