| 1 |
################################################################################ |
| 2 |
# Recovery donor connection options test |
| 3 |
# This test checks the user options used for donor connection during recovery. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0) The test requires three servers. |
| 7 |
# 1) Start server1 to boot the group. Insert some data for recovery. Create |
| 8 |
# the recovery user for the donor connection. |
| 9 |
# 2) Start server2 after changing the connection credentials using the |
| 10 |
# change master for the server. See that the recovery is successful. |
| 11 |
# 3) On server3 set incorrect password. Keep recovery retry count to low. |
| 12 |
# 4) Set DEBUG point to verify member is in RECOVERY state. Start server3. |
| 13 |
# Check that members is recovering. Then, recovery failed causing the |
| 14 |
# member to go to ERROR state. |
| 15 |
# 5) On server3 set master_user to empty user. |
| 16 |
# 6) Set DEBUG point to verify member is in RECOVERY state. Start server3. |
| 17 |
# Check that members is recovering. Then, recovery failed causing the |
| 18 |
# member to go to ERROR state. |
| 19 |
# 7) On server3 set master_user to non-existing user. |
| 20 |
# 8) Set DEBUG point to verify member is in RECOVERY state. Start server3. |
| 21 |
# Check that members is recovering. Then, recovery failed causing the |
| 22 |
# member to go to ERROR state. |
| 23 |
# 9) Do the cleanup in the end. |
| 24 |
################################################################################ |
| 25 |
|
| 26 |
--source include/big_test.inc |
| 27 |
--source include/have_debug.inc |
| 28 |
--source include/have_group_replication_xcom_communication_stack.inc |
| 29 |
--let $group_replication_group_name= b5eb4110-a3a2-11e3-a5e2-0800200c9a66 |
| 30 |
--source include/set_privilege_checks_user_as_system_user.inc |
| 31 |
--let $rpl_privilege_checks_user_grant_option = 1 |
| 32 |
--source include/have_group_replication_plugin.inc |
| 33 |
|
| 34 |
--let $rpl_skip_group_replication_start= 1 |
| 35 |
--let $rpl_server_count= 3 |
| 36 |
--source include/group_replication.inc |
| 37 |
|
| 38 |
--let $recovery_user= recovery_user |
| 39 |
--let $recovery_password= recovery_password |
| 40 |
--let $recovery_bad_password= recovery_bad_password |
| 41 |
|
| 42 |
--echo # |
| 43 |
--echo # Start the donor member |
| 44 |
--echo # |
| 45 |
|
| 46 |
--connection server1 |
| 47 |
--source include/start_and_bootstrap_group_replication.inc |
| 48 |
|
| 49 |
--let $group_replication_number_of_members= 1 |
| 50 |
--source include/gr_wait_for_number_of_members.inc |
| 51 |
|
| 52 |
#insert some data |
| 53 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 54 |
INSERT INTO t1 VALUES (1); |
| 55 |
|
| 56 |
--echo # |
| 57 |
--echo # Install a rpl user for the donor connection |
| 58 |
--echo # |
| 59 |
|
| 60 |
--eval CREATE USER "$recovery_user" IDENTIFIED BY "$recovery_password" |
| 61 |
--eval GRANT REPLICATION SLAVE ON *.* TO "$recovery_user" |
| 62 |
FLUSH PRIVILEGES; |
| 63 |
|
| 64 |
--connection server2 |
| 65 |
|
| 66 |
--echo # |
| 67 |
--echo # Set valid options |
| 68 |
--echo # |
| 69 |
|
| 70 |
--disable_warnings |
| 71 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_USER='$recovery_user', SOURCE_PASSWORD='$recovery_password' FOR CHANNEL 'group_replication_recovery'; |
| 72 |
--enable_warnings |
| 73 |
|
| 74 |
--echo # |
| 75 |
--echo # Start the joiner member with the given credentials and check if it is OK |
| 76 |
--echo # |
| 77 |
|
| 78 |
--source include/start_group_replication.inc |
| 79 |
|
| 80 |
let $assert_text= On the recovered member, the table should contain 1 elements; |
| 81 |
let $assert_cond= [select count(*) from t1] = 1; |
| 82 |
source include/assert.inc; |
| 83 |
|
| 84 |
--echo # |
| 85 |
--echo # Create a new member and give it a bad password, watching it fail |
| 86 |
--echo # |
| 87 |
|
| 88 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 89 |
|
| 90 |
--connection server3 |
| 91 |
set session sql_log_bin=0; |
| 92 |
call mtr.add_suppression("There was an error when connecting to the donor*"); |
| 93 |
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery."); |
| 94 |
call mtr.add_suppression("Maximum number of retries when*"); |
| 95 |
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group."); |
| 96 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 97 |
call mtr.add_suppression("The member is leaving a group without being on one"); |
| 98 |
call mtr.add_suppression("The member is already leaving or joining a group."); |
| 99 |
call mtr.add_suppression("Error leaving the group"); |
| 100 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 101 |
call mtr.add_suppression(".*Invalid .* username when attempting to connect to the source server.*"); |
| 102 |
set session sql_log_bin=1; |
| 103 |
|
| 104 |
--let $debug_save_count= `SELECT @@GLOBAL.group_replication_recovery_retry_count` |
| 105 |
--let $debug_save_rec_int= `SELECT @@GLOBAL.group_replication_recovery_reconnect_interval` |
| 106 |
|
| 107 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 108 |
SET @@GLOBAL.DEBUG='d,recovery_thread_wait_before_finish'; |
| 109 |
|
| 110 |
--disable_warnings |
| 111 |
CHANGE REPLICATION SOURCE TO SOURCE_USER='$recovery_user', SOURCE_PASSWORD='$recovery_bad_password' FOR CHANNEL 'group_replication_recovery'; |
| 112 |
--enable_warnings |
| 113 |
|
| 114 |
--echo # Set the retry count to try only twice. One time for each member. |
| 115 |
--eval SET GLOBAL group_replication_recovery_retry_count= 2; |
| 116 |
--echo # Set the reconnect interval to one. To prevent timeout on recovery. |
| 117 |
--eval SET GLOBAL group_replication_recovery_reconnect_interval= 1; |
| 118 |
|
| 119 |
--let $assert_text= The value of the recovery retry count should be equal to 2 |
| 120 |
--let $assert_cond= "[SELECT @@group_replication_recovery_retry_count]" = "2" |
| 121 |
--source include/assert.inc |
| 122 |
|
| 123 |
--echo # Start recovery and wait to verify the member is in recovery |
| 124 |
--let $group_replication_start_member_state= RECOVERING |
| 125 |
--source include/start_group_replication.inc |
| 126 |
|
| 127 |
--echo # The member should error out as it can't connect |
| 128 |
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end"; |
| 129 |
--let $group_replication_member_state= ERROR |
| 130 |
--source include/gr_wait_for_member_state.inc |
| 131 |
|
| 132 |
--echo # |
| 133 |
--echo # Set MASTER_USER to an empty user name, watching it fail |
| 134 |
--echo # |
| 135 |
|
| 136 |
--source include/stop_group_replication.inc |
| 137 |
|
| 138 |
CHANGE REPLICATION SOURCE TO SOURCE_USER= '', SOURCE_PASSWORD= '' FOR CHANNEL 'group_replication_recovery'; |
| 139 |
|
| 140 |
--echo # Start recovery and wait to verify the member is in recovery |
| 141 |
--let $group_replication_start_member_state= RECOVERING |
| 142 |
--source include/start_group_replication.inc |
| 143 |
|
| 144 |
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end"; |
| 145 |
--let $group_replication_member_state= ERROR |
| 146 |
--source include/gr_wait_for_member_state.inc |
| 147 |
|
| 148 |
--echo # Verify that the show slave status shows specific IO_error |
| 149 |
--let $rpl_channel_name= 'group_replication_recovery' |
| 150 |
--let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR) |
| 151 |
--source include/wait_for_slave_io_error.inc |
| 152 |
|
| 153 |
--source include/stop_group_replication.inc |
| 154 |
|
| 155 |
--echo # |
| 156 |
--echo # Set MASTER_USER to non existing user, watching it fail |
| 157 |
--echo # |
| 158 |
|
| 159 |
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'parveez', SOURCE_PASSWORD= 'me' FOR CHANNEL 'group_replication_recovery'; |
| 160 |
|
| 161 |
--echo # Start recovery and wait to verify the member is in recovery |
| 162 |
--let $group_replication_start_member_state= RECOVERING |
| 163 |
--source include/start_group_replication.inc |
| 164 |
|
| 165 |
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end"; |
| 166 |
--let $group_replication_member_state= ERROR |
| 167 |
--source include/gr_wait_for_member_state.inc |
| 168 |
|
| 169 |
--echo # Verify that show slave status shows specific IO_ERROR |
| 170 |
let $show_statement= SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery'; |
| 171 |
let $field= Last_IO_Errno; |
| 172 |
let $condition= = '1045'; |
| 173 |
--source include/wait_show_condition.inc |
| 174 |
|
| 175 |
--source include/stop_group_replication.inc |
| 176 |
|
| 177 |
--connection server2 |
| 178 |
--let $group_replication_number_of_members= 2 |
| 179 |
--source include/gr_wait_for_number_of_members.inc |
| 180 |
|
| 181 |
--echo # |
| 182 |
--echo # Clean up |
| 183 |
--echo # |
| 184 |
|
| 185 |
--eval DROP USER "$recovery_user" |
| 186 |
--connection server3 |
| 187 |
SET DEBUG_SYNC='RESET'; |
| 188 |
SET @@GLOBAL.DEBUG = @debug_save; |
| 189 |
--eval SET GLOBAL group_replication_recovery_retry_count= $debug_save_count |
| 190 |
--eval SET GLOBAL group_replication_recovery_reconnect_interval= $debug_save_rec_int |
| 191 |
|
| 192 |
--connection server2 |
| 193 |
DROP TABLE t1; |
| 194 |
|
| 195 |
--source include/group_replication_end.inc |