| 1 |
################################################################################ |
| 2 |
# |
| 3 |
# The auto-rejoin process is a mechanism that allows a server that left the |
| 4 |
# group due to flaky network (either on his side or on the other members) to |
| 5 |
# try to join again up to group_replication_autorejoin_tries number of times. |
| 6 |
# |
| 7 |
# This test shall verify that it is possible to stop the plugin while an |
| 8 |
# auto-rejoin process is running. |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0) The test requires three servers. |
| 12 |
# 1) Provoke a member expel. |
| 13 |
# 2) Stop the plugin while the auto-rejoin is running on the expelled member. |
| 14 |
# 3) Verify that the auto-rejoin process should stop immediately. |
| 15 |
# 4) Verify that the expelled member left the group. |
| 16 |
# 5) Set the group_replication_exit_state_action on that member to ABORT_SERVER |
| 17 |
# and restart the plugin. |
| 18 |
# 6) Expel that member again. |
| 19 |
# 7) Stop the plugin while the auto-rejoin is running on that member. |
| 20 |
# 8) Verify that it didn't abort and that it left the group. |
| 21 |
# 9) Cleanup. |
| 22 |
# |
| 23 |
################################################################################ |
| 24 |
--source include/have_debug_sync.inc |
| 25 |
--source include/big_test.inc |
| 26 |
--source include/linux.inc |
| 27 |
--source include/have_group_replication_plugin.inc |
| 28 |
--let $rpl_server_count = 3 |
| 29 |
--source include/group_replication.inc |
| 30 |
|
| 31 |
--echo |
| 32 |
--echo #### |
| 33 |
--echo # 0) The test requires three servers. |
| 34 |
--echo #### |
| 35 |
--echo |
| 36 |
--let $rpl_connection_name = server1 |
| 37 |
--source include/rpl_connection.inc |
| 38 |
|
| 39 |
SET sql_log_bin = 0; |
| 40 |
call mtr.add_suppression("Member was expelled from the group due to network failures, changing member status to ERROR."); |
| 41 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 42 |
call mtr.add_suppression("\\[GCS\\] The member has left the group but the new view will not be installed, probably because it has not been delivered yet."); |
| 43 |
call mtr.add_suppression("\\[GCS\\] read failed"); |
| 44 |
call mtr.add_suppression("Started auto-rejoin procedure attempt*"); |
| 45 |
call mtr.add_suppression("Auto-rejoin procedure attempt*"); |
| 46 |
--disable_query_log # No need for the result file to specify suppressions. |
| 47 |
call mtr.add_suppression("\\[GCS\\] There is no local IP address matching the one configured for the local node .*"); |
| 48 |
call mtr.add_suppression("Unable to initialize the group communication engine"); |
| 49 |
--enable_query_log |
| 50 |
SET sql_log_bin = 1; |
| 51 |
|
| 52 |
--source include/gr_autorejoin_monitoring.inc |
| 53 |
|
| 54 |
--echo |
| 55 |
--echo #### |
| 56 |
--echo # 1) Provoke a member expel. |
| 57 |
--echo #### |
| 58 |
--echo |
| 59 |
# Save the local address so we can restore it later |
| 60 |
--let $local_address_server = `SELECT @@GLOBAL.group_replication_local_address` |
| 61 |
|
| 62 |
# First, enable auto-rejoin |
| 63 |
SET GLOBAL group_replication_autorejoin_tries = 2016; |
| 64 |
|
| 65 |
# Enable debug sync point before rejoin(), so we can manually trigger a failure |
| 66 |
SET @debug_saved = @@GLOBAL.DEBUG; |
| 67 |
|
| 68 |
# Mess up the local address so we trigger a join failure |
| 69 |
SET GLOBAL group_replication_local_address = "128.0.0.1:3306"; |
| 70 |
|
| 71 |
# Force expel on member 1 |
| 72 |
--let $member_id = `SELECT @@GLOBAL.server_uuid` |
| 73 |
--source include/gr_expel_member_from_group.inc |
| 74 |
|
| 75 |
# Wait until auto-rejoin starts |
| 76 |
--let $wait_condition = SELECT IS_AUTOREJOIN_RUNNING() = TRUE |
| 77 |
--source include/wait_condition_or_abort.inc |
| 78 |
|
| 79 |
--echo |
| 80 |
--echo #### |
| 81 |
--echo # 2) Stop the plugin while the auto-rejoin is running on the expelled |
| 82 |
--echo # member. |
| 83 |
--echo #### |
| 84 |
--echo |
| 85 |
--source include/stop_group_replication.inc |
| 86 |
|
| 87 |
--echo |
| 88 |
--echo #### |
| 89 |
--echo # 3) Verify that the auto-rejoin process should stop immediately. |
| 90 |
--echo #### |
| 91 |
--echo |
| 92 |
--let $wait_condition = SELECT IS_AUTOREJOIN_RUNNING() = FALSE |
| 93 |
--source include/wait_condition_or_abort.inc |
| 94 |
|
| 95 |
--echo |
| 96 |
--echo #### |
| 97 |
--echo # 4) Verify that the expelled member left the group. |
| 98 |
--echo #### |
| 99 |
--echo |
| 100 |
# Verify the view on server 2 |
| 101 |
--let $rpl_connection_name = server2 |
| 102 |
--source include/rpl_connection.inc |
| 103 |
|
| 104 |
--let $group_replication_number_of_members = 2 |
| 105 |
--source include/gr_wait_for_number_of_members.inc |
| 106 |
|
| 107 |
--let $assert_text = Member 1 should not be in the group |
| 108 |
--let $assert_cond = COUNT(*) = 0 FROM performance_schema.replication_group_members WHERE MEMBER_ID = "$member_id" |
| 109 |
--source include/assert.inc |
| 110 |
|
| 111 |
# Then on server 3 |
| 112 |
--let $rpl_connection_name = server3 |
| 113 |
--source include/rpl_connection.inc |
| 114 |
|
| 115 |
--let $group_replication_number_of_members = 2 |
| 116 |
--source include/gr_wait_for_number_of_members.inc |
| 117 |
|
| 118 |
--let $assert_text = Member 1 should not be in the group |
| 119 |
--let $assert_cond = COUNT(*) = 0 FROM performance_schema.replication_group_members WHERE MEMBER_ID = "$member_id" |
| 120 |
--source include/assert.inc |
| 121 |
|
| 122 |
--echo |
| 123 |
--echo #### |
| 124 |
--echo # 5) Set the group_replication_exit_state_action on that member to |
| 125 |
--echo # ABORT_SERVER and restart the plugin. |
| 126 |
--echo #### |
| 127 |
--echo |
| 128 |
--let $rpl_connection_name = server1 |
| 129 |
--source include/rpl_connection.inc |
| 130 |
|
| 131 |
SET @saved_exit_state_action = @@GLOBAL.group_replication_exit_state_action; |
| 132 |
|
| 133 |
SET @@GLOBAL.group_replication_exit_state_action = ABORT_SERVER; |
| 134 |
--replace_result $local_address_server LOCAL_ADDRESS_SERVER |
| 135 |
--eval SET GLOBAL group_replication_local_address = "$local_address_server" |
| 136 |
|
| 137 |
# Restart the plugin |
| 138 |
--source include/start_group_replication.inc |
| 139 |
|
| 140 |
--echo |
| 141 |
--echo #### |
| 142 |
--echo # 6) Expel that member again. |
| 143 |
--echo #### |
| 144 |
--echo |
| 145 |
# Mess up the local address so we trigger a join failure |
| 146 |
SET GLOBAL group_replication_local_address = "128.0.0.1:3306"; |
| 147 |
|
| 148 |
SET @@GLOBAL.DEBUG='+d,group_replication_stop_before_rejoin_loop'; |
| 149 |
SET @@GLOBAL.DEBUG='+d,group_replication_long_retry'; |
| 150 |
SET @@GLOBAL.DEBUG='-d,group_replication_stop_before_rejoin'; |
| 151 |
|
| 152 |
# Expel member again |
| 153 |
--source include/gr_expel_member_from_group.inc |
| 154 |
|
| 155 |
--echo |
| 156 |
--echo #### |
| 157 |
--echo # 7) Stop the plugin while the auto-rejoin is running on that member. |
| 158 |
--echo #### |
| 159 |
--echo |
| 160 |
SET DEBUG_SYNC = "now WAIT_FOR signal.autorejoin_entering_loop"; |
| 161 |
SET DEBUG_SYNC = "now SIGNAL signal.autorejoin_enter_loop"; |
| 162 |
--source include/stop_group_replication.inc |
| 163 |
|
| 164 |
--echo |
| 165 |
--echo #### |
| 166 |
--echo # 8) Verify that it didn't abort and that it left the group. |
| 167 |
--echo #### |
| 168 |
--echo |
| 169 |
# Should be in OFFLINE state |
| 170 |
--let $group_replication_member_state= OFFLINE |
| 171 |
--let $group_replication_member_id= $member_id |
| 172 |
--source include/gr_wait_for_member_state.inc |
| 173 |
|
| 174 |
# Reset GR |
| 175 |
--replace_result $local_address_server LOCAL_ADDRESS_SERVER |
| 176 |
--eval SET GLOBAL group_replication_local_address = "$local_address_server" |
| 177 |
--source include/start_group_replication.inc |
| 178 |
|
| 179 |
--echo |
| 180 |
--echo #### |
| 181 |
--echo # 9) Cleanup. |
| 182 |
--echo #### |
| 183 |
--echo |
| 184 |
SET @@GLOBAL.DEBUG = @debug_saved; |
| 185 |
SET GLOBAL group_replication_autorejoin_tries = default; |
| 186 |
SET GLOBAL group_replication_exit_state_action = @saved_exit_state_action; |
| 187 |
--source include/gr_end_autorejoin_monitoring.inc |
| 188 |
--source include/group_replication_end.inc |