| 1 |
################################################################################ |
| 2 |
# This test proves credentials passed in START GR have preference over channel. |
| 3 |
# This test also proves credentials are deleted on STOP GR. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires two servers: M1 and M2. |
| 7 |
# 1. Bootstrap M1. And create new users. |
| 8 |
# 2. Reset recovery interval to 1 and count to 2 for M2. |
| 9 |
# 3. Test START GR passing right credentials and wrong in channel. |
| 10 |
# 4. Stop GR and check start GR does not work without credentials. |
| 11 |
# Confirming credentials have been deleted. |
| 12 |
# 5. Test START GR fails passing wrong credentials and right in channel. |
| 13 |
# 6. Start GR without credentials should work due to channel. |
| 14 |
# Confirming credentials have been deleted. |
| 15 |
# 7. Cleanup. |
| 16 |
################################################################################ |
| 17 |
|
| 18 |
--source include/have_group_replication_xcom_communication_stack.inc |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
--let $rpl_skip_group_replication_start= 1 |
| 21 |
--source include/group_replication.inc |
| 22 |
|
| 23 |
--echo |
| 24 |
--echo # 1. Bootstrap M1. And create new users. |
| 25 |
|
| 26 |
--let $rpl_connection_name= server1 |
| 27 |
--source include/rpl_connection.inc |
| 28 |
|
| 29 |
--source include/start_and_bootstrap_group_replication.inc |
| 30 |
|
| 31 |
SET SQL_LOG_BIN=0; |
| 32 |
CREATE USER 'regular_user_p' IDENTIFIED BY 'password'; |
| 33 |
GRANT REPLICATION SLAVE ON *.* TO "regular_user_p"; |
| 34 |
SET SQL_LOG_BIN=1; |
| 35 |
|
| 36 |
--echo |
| 37 |
--echo # 2. Reset recovery interval to 1 and count to 2 for M2. |
| 38 |
|
| 39 |
--let $rpl_connection_name= server2 |
| 40 |
--source include/rpl_connection.inc |
| 41 |
|
| 42 |
SET @saved_group_replication_recovery_reconnect_interval = @@GLOBAL.group_replication_recovery_reconnect_interval; |
| 43 |
SET @saved_gr_recovery_retry_count = @@GLOBAL.group_replication_recovery_retry_count; |
| 44 |
|
| 45 |
SET GLOBAL group_replication_recovery_reconnect_interval= 1; |
| 46 |
SET GLOBAL group_replication_recovery_retry_count= 2; |
| 47 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 48 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 49 |
|
| 50 |
--echo |
| 51 |
--echo # 3. Test START GR passing right credentials and wrong in channel. |
| 52 |
|
| 53 |
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'invalid', SOURCE_PASSWORD='wrong' FOR CHANNEL 'group_replication_recovery'; |
| 54 |
|
| 55 |
START GROUP_REPLICATION USER='regular_user_p', PASSWORD='password'; |
| 56 |
|
| 57 |
--let $group_replication_member_state = ONLINE |
| 58 |
--source include/gr_wait_for_member_state.inc |
| 59 |
|
| 60 |
--source include/stop_group_replication.inc |
| 61 |
|
| 62 |
--echo |
| 63 |
--echo # 4. Stop GR and check start GR does not work without credentials. |
| 64 |
--echo # Confirming credentials have been deleted. |
| 65 |
|
| 66 |
START GROUP_REPLICATION; |
| 67 |
|
| 68 |
--let $group_replication_member_state = ERROR |
| 69 |
--source include/gr_wait_for_member_state.inc |
| 70 |
|
| 71 |
--source include/stop_group_replication.inc |
| 72 |
|
| 73 |
--echo |
| 74 |
--echo # 5. Test START GR fails passing wrong credentials and right in channel. |
| 75 |
|
| 76 |
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'regular_user_p', SOURCE_PASSWORD='password' FOR CHANNEL 'group_replication_recovery'; |
| 77 |
|
| 78 |
START GROUP_REPLICATION USER='user_wrong' , PASSWORD='password_wrong'; |
| 79 |
|
| 80 |
--let $group_replication_member_state = ERROR |
| 81 |
--source include/gr_wait_for_member_state.inc |
| 82 |
|
| 83 |
--source include/stop_group_replication.inc |
| 84 |
|
| 85 |
--echo |
| 86 |
--echo # 6. Start GR without credentials should work due to channel. |
| 87 |
--echo # Confirming credentials have been deleted. |
| 88 |
|
| 89 |
--source include/start_group_replication.inc |
| 90 |
--source include/stop_group_replication.inc |
| 91 |
|
| 92 |
--echo |
| 93 |
--echo # 7. Cleanup. |
| 94 |
|
| 95 |
CHANGE REPLICATION SOURCE TO SOURCE_USER = 'root' , SOURCE_PASSWORD = '' FOR CHANNEL 'group_replication_recovery'; |
| 96 |
|
| 97 |
SET SESSION sql_log_bin = 0; |
| 98 |
call mtr.add_suppression("Replica I/O for channel 'group_replication_recovery': Fatal error: Invalid .* username when attempting to connect to the source server.*"); |
| 99 |
call mtr.add_suppression("There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable."); |
| 100 |
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."); |
| 101 |
call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery."); |
| 102 |
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group."); |
| 103 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 104 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 105 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 106 |
SET SESSION sql_log_bin = 1; |
| 107 |
|
| 108 |
SET @@GLOBAL.group_replication_recovery_reconnect_interval = @saved_group_replication_recovery_reconnect_interval; |
| 109 |
SET @@GLOBAL.group_replication_recovery_retry_count = @saved_gr_recovery_retry_count; |
| 110 |
|
| 111 |
--let $rpl_connection_name= server1 |
| 112 |
--source include/rpl_connection.inc |
| 113 |
|
| 114 |
SET SQL_LOG_BIN=0; |
| 115 |
DROP USER 'regular_user_p'; |
| 116 |
SET SQL_LOG_BIN=1; |
| 117 |
|
| 118 |
--source include/group_replication_end.inc |