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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
################################################################################
# Validate the correct behaviour of
# group_replication_recovery_get_public_key and
# group_replication_recovery_public_key_path options on Group Replication.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Bootstrap group on server1.
# 2. Prepare server2 configuration to force public key
# authentication.
# 3. Disable fetch donor public key and do not set donor
# public key, recovery must fail and the member status must
# change to ERROR.
# 4. Disable fetch donor public key and do set a donor invalid
# public key, recovery must fail and the member status must
# change to ERROR.
# 5. Disable fetch donor public key and do set a donor valid
# public key, recovery must succeed and the member status
# must change to ONLINE.
# 6. Clean up.
################################################################################
--source include/have_group_replication_xcom_communication_stack.inc
--source include/big_test.inc
--source include/set_privilege_checks_user_as_system_user.inc
--let $rpl_privilege_checks_user_grant_option = 1
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--echo
--echo ############################################################
--echo # 1. Bootstrap group on server1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
CREATE USER 'u1_caching_sha2_password'@'127.0.0.1' IDENTIFIED WITH 'caching_sha2_password' BY 'pwd';
GRANT REPLICATION SLAVE ON *.* TO 'u1_caching_sha2_password'@'127.0.0.1';
FLUSH PRIVILEGES;
--source include/start_and_bootstrap_group_replication.inc
--echo
--echo ############################################################
--echo # 2. Prepare server2 configuration to force public key
--echo # authentication.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @group_replication_recovery_get_public_key= @@GLOBAL.group_replication_recovery_get_public_key;
SET @group_replication_recovery_public_key_path= @@GLOBAL.group_replication_recovery_public_key_path;
# We need to disable encrypted connection to force
# public key authentication.
SET @group_replication_recovery_use_ssl= @@GLOBAL.group_replication_recovery_use_ssl;
SET GLOBAL group_replication_recovery_use_ssl= FALSE;
# Reduce the retry count to try only once.
SET @group_replication_recovery_retry_count= @@GLOBAL.group_replication_recovery_retry_count;
SET GLOBAL group_replication_recovery_retry_count= 1;
CHANGE REPLICATION SOURCE TO SOURCE_USER='u1_caching_sha2_password', SOURCE_PASSWORD='pwd' FOR CHANNEL 'group_replication_recovery';
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials.*");
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table*");
call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
call mtr.add_suppression("Can't locate server public key '.*mysql-test/std_data/invalid_rsa_public_key.pem'");
call mtr.add_suppression("Public key is not in Privacy Enhanced Mail format: '.*mysql-test/std_data/invalid_rsa_public_key.pem'");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
SET SESSION sql_log_bin= 1;
--echo
--echo ############################################################
--echo # 3. Disable fetch donor public key and do not set donor
--echo # public key, recovery must fail and the member status must
--echo # change to ERROR.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_recovery_get_public_key= FALSE;
SET GLOBAL group_replication_recovery_public_key_path= "";
--let $group_replication_start_member_state= ERROR
--source include/start_group_replication.inc
--source include/stop_group_replication.inc
--echo
--echo ############################################################
--echo # 4. Disable fetch donor public key and do set a donor invalid
--echo # public key, recovery must fail and the member status must
--echo # change to ERROR.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_recovery_get_public_key= FALSE;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--eval SET GLOBAL group_replication_recovery_public_key_path= "$MYSQL_TEST_DIR/std_data/invalid_rsa_public_key.pem"
--let $group_replication_start_member_state= ERROR
--source include/start_group_replication.inc
--source include/stop_group_replication.inc
--echo
--echo ############################################################
--echo # 5. Disable fetch donor public key and do set a donor valid
--echo # public key, recovery must succeed and the member status
--echo # must change to ONLINE.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_recovery_get_public_key= FALSE;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--eval SET GLOBAL group_replication_recovery_public_key_path= "$MYSQL_TEST_DIR/std_data/rsa_public_key.pem"
--let $group_replication_start_member_state= ONLINE
--source include/start_group_replication.inc
--echo
--echo ############################################################
--echo # 6. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
DROP USER 'u1_caching_sha2_password'@'127.0.0.1';
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_recovery_use_ssl= @group_replication_recovery_use_ssl;
SET GLOBAL group_replication_recovery_retry_count= @group_replication_recovery_retry_count;
SET GLOBAL group_replication_recovery_get_public_key= @group_replication_recovery_get_public_key;
SET GLOBAL group_replication_recovery_public_key_path= @group_replication_recovery_public_key_path;
--source include/group_replication_end.inc
|