polardbxengine/mysql-test/suite/group_replication/t/gr_recovery_connection_opti...

194 lines
7.3 KiB
Plaintext

################################################################################
# Recovery donor connection options test
# This test checks the user options used for donor connection during recovery.
#
# Test:
# 0) The test requires three servers.
# 1) Start server1 to boot the group. Insert some data for recovery. Create
# the recovery user for the donor connection.
# 2) Start server2 after changing the connection credentials using the
# change master for the server. See that the recovery is successful.
# 3) On server3 set incorrect password. Keep recovery retry count to low.
# 4) Set DEBUG point to verify member is in RECOVERY state. Start server3.
# Check that members is recovering. Then, recovery failed causing the
# member to go to ERROR state.
# 5) On server3 set master_user to empty user.
# 6) Set DEBUG point to verify member is in RECOVERY state. Start server3.
# Check that members is recovering. Then, recovery failed causing the
# member to go to ERROR state.
# 7) On server3 set master_user to non-existing user.
# 8) Set DEBUG point to verify member is in RECOVERY state. Start server3.
# Check that members is recovering. Then, recovery failed causing the
# member to go to ERROR state.
# 9) Do the cleanup in the end.
################################################################################
--source include/big_test.inc
--source include/have_debug.inc
--let $group_replication_group_name= b5eb4110-a3a2-11e3-a5e2-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc
--let $recovery_user= recovery_user
--let $recovery_password= recovery_password
--let $recovery_bad_password= recovery_bad_password
--echo #
--echo # Start the donor member
--echo #
--connection server1
--source include/start_and_bootstrap_group_replication.inc
--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc
#insert some data
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--echo #
--echo # Install a rpl user for the donor connection
--echo #
--eval CREATE USER "$recovery_user" IDENTIFIED BY "$recovery_password"
--eval GRANT REPLICATION SLAVE ON *.* TO "$recovery_user"
FLUSH PRIVILEGES;
--connection server2
--echo #
--echo # Set valid options
--echo #
--disable_warnings
--eval CHANGE MASTER TO MASTER_USER='$recovery_user', MASTER_PASSWORD='$recovery_password' FOR CHANNEL 'group_replication_recovery';
--enable_warnings
--echo #
--echo # Start the joiner member with the given credentials and check if it is OK
--echo #
--source include/start_group_replication.inc
let $assert_text= On the recovered member, the table should contain 1 elements;
let $assert_cond= [select count(*) from t1] = 1;
source include/assert.inc;
--echo #
--echo # Create a new member and give it a bad password, watching it fail
--echo #
SET @debug_save= @@GLOBAL.DEBUG;
--connection server3
set session sql_log_bin=0;
call mtr.add_suppression("There was an error when connecting to the donor*");
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_replication_recovery.");
call mtr.add_suppression("Maximum number of retries when*");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("The member is leaving a group without being on one");
call mtr.add_suppression("The member is already leaving or joining a group.");
call mtr.add_suppression("Error leaving the group");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
call mtr.add_suppression(".*Invalid .* username when attempting to connect to the master server.*");
set session sql_log_bin=1;
--let $debug_save_count= `SELECT @@GLOBAL.group_replication_recovery_retry_count`
--let $debug_save_rec_int= `SELECT @@GLOBAL.group_replication_recovery_reconnect_interval`
SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG='d,recovery_thread_wait_before_finish';
--disable_warnings
CHANGE MASTER TO MASTER_USER='$recovery_user', MASTER_PASSWORD='$recovery_bad_password' FOR CHANNEL 'group_replication_recovery';
--enable_warnings
--echo # Set the retry count to try only twice. One time for each member.
--eval SET GLOBAL group_replication_recovery_retry_count= 2;
--echo # Set the reconnect interval to one. To prevent timeout on recovery.
--eval SET GLOBAL group_replication_recovery_reconnect_interval= 1;
--let $assert_text= The value of the recovery retry count should be equal to 2
--let $assert_cond= "[SELECT @@group_replication_recovery_retry_count]" = "2"
--source include/assert.inc
--echo # Start recovery and wait to verify the member is in recovery
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc
--echo # The member should error out as it can't connect
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
--echo #
--echo # Set MASTER_USER to an empty user name, watching it fail
--echo #
--source include/stop_group_replication.inc
CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '' FOR CHANNEL 'group_replication_recovery';
--echo # Start recovery and wait to verify the member is in recovery
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
--echo # Verify that the show slave status shows specific IO_error
let $show_statement= SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery';
let $field= Last_IO_Errno;
let $condition= = '1045';
--source include/wait_show_condition.inc
--source include/stop_group_replication.inc
--echo #
--echo # Set MASTER_USER to non existing user, watching it fail
--echo #
CHANGE MASTER TO MASTER_USER= 'parveez', MASTER_PASSWORD= 'me' FOR CHANNEL 'group_replication_recovery';
--echo # Start recovery and wait to verify the member is in recovery
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
--echo # Verify that show slave status shows specific IO_ERROR
let $show_statement= SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery';
let $field= Last_IO_Errno;
let $condition= = '1045';
--source include/wait_show_condition.inc
--source include/stop_group_replication.inc
--connection server2
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc
--echo #
--echo # Clean up
--echo #
--eval DROP USER "$recovery_user"
--connection server3
SET DEBUG_SYNC='RESET';
SET @@GLOBAL.DEBUG = @debug_save;
--eval SET GLOBAL group_replication_recovery_retry_count= $debug_save_count
--eval SET GLOBAL group_replication_recovery_reconnect_interval= $debug_save_rec_int
--connection server2
DROP TABLE t1;
--source include/group_replication_end.inc