| 1 |
################################################################################ |
| 2 |
# This test proves credential for recovery can be passed via START GR command |
| 3 |
# using the MySQL stack. |
| 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 works without any option. |
| 10 |
# 4. Delete recovery channel and test START GR, it should fail. |
| 11 |
# 5. Pass USER as root and test START GR, member should come ONLINE. |
| 12 |
# START GR without parameter fails, credentials are removed on STOP. |
| 13 |
# 6. Test wrong credentials do not come online and START GR fails. |
| 14 |
# 7. Test right credentials in START GR connect with master. |
| 15 |
# 8. Cleanup. |
| 16 |
################################################################################ |
| 17 |
|
| 18 |
--source include/have_group_replication_mysql_communication_stack.inc |
| 19 |
--source include/big_test.inc |
| 20 |
--source include/have_group_replication_plugin.inc |
| 21 |
--let $rpl_skip_group_replication_start= 1 |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--echo |
| 25 |
--echo # 1. Bootstrap M1. And create new users. |
| 26 |
|
| 27 |
--let $rpl_connection_name= server1 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
|
| 30 |
--source include/start_and_bootstrap_group_replication.inc |
| 31 |
|
| 32 |
SET SQL_LOG_BIN=0; |
| 33 |
|
| 34 |
CREATE USER 'regular_user_p' IDENTIFIED BY 'password'; |
| 35 |
CREATE USER 'regular_user_wp' IDENTIFIED BY ''; |
| 36 |
|
| 37 |
GRANT REPLICATION SLAVE ON *.* TO "regular_user_p"; |
| 38 |
GRANT REPLICATION SLAVE ON *.* TO "regular_user_wp"; |
| 39 |
|
| 40 |
GRANT GROUP_REPLICATION_STREAM ON *.* TO "regular_user_p"; |
| 41 |
GRANT GROUP_REPLICATION_STREAM ON *.* TO "regular_user_wp"; |
| 42 |
|
| 43 |
SET SQL_LOG_BIN=1; |
| 44 |
|
| 45 |
--echo |
| 46 |
--echo # 2. Reset recovery interval to 1 and count to 2 for M2. |
| 47 |
|
| 48 |
--let $rpl_connection_name= server2 |
| 49 |
--source include/rpl_connection.inc |
| 50 |
|
| 51 |
SET SQL_LOG_BIN=0; |
| 52 |
|
| 53 |
CREATE USER 'regular_user_p' IDENTIFIED BY 'password'; |
| 54 |
CREATE USER 'regular_user_wp' IDENTIFIED BY ''; |
| 55 |
|
| 56 |
GRANT REPLICATION SLAVE ON *.* TO "regular_user_p"; |
| 57 |
GRANT REPLICATION SLAVE ON *.* TO "regular_user_wp"; |
| 58 |
|
| 59 |
GRANT GROUP_REPLICATION_STREAM ON *.* TO "regular_user_p"; |
| 60 |
GRANT GROUP_REPLICATION_STREAM ON *.* TO "regular_user_wp"; |
| 61 |
|
| 62 |
SET SQL_LOG_BIN=1; |
| 63 |
|
| 64 |
SET @saved_group_replication_recovery_reconnect_interval = @@GLOBAL.group_replication_recovery_reconnect_interval; |
| 65 |
SET @saved_gr_recovery_retry_count = @@GLOBAL.group_replication_recovery_retry_count; |
| 66 |
|
| 67 |
SET GLOBAL group_replication_recovery_reconnect_interval= 1; |
| 68 |
SET GLOBAL group_replication_recovery_retry_count= 2; |
| 69 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 70 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 71 |
|
| 72 |
--echo |
| 73 |
--echo # 3. Test START GR works without any option. |
| 74 |
|
| 75 |
--source include/start_group_replication.inc |
| 76 |
--source include/stop_group_replication.inc |
| 77 |
|
| 78 |
--echo |
| 79 |
--echo # 4. Delete recovery channel and test START GR, it should fail. |
| 80 |
|
| 81 |
RESET SLAVE ALL FOR CHANNEL 'group_replication_recovery'; |
| 82 |
|
| 83 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 84 |
START GROUP_REPLICATION; |
| 85 |
|
| 86 |
--echo |
| 87 |
--echo # 5. Pass USER as root and test START GR, member should come ONLINE. |
| 88 |
--echo # START GR without parameter fails, credentials are removed on STOP. |
| 89 |
|
| 90 |
START GROUP_REPLICATION USER='root'; |
| 91 |
--let $group_replication_member_state = ONLINE |
| 92 |
--source include/gr_wait_for_member_state.inc |
| 93 |
--source include/stop_group_replication.inc |
| 94 |
|
| 95 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 96 |
START GROUP_REPLICATION; |
| 97 |
|
| 98 |
--echo |
| 99 |
--echo # 6. Test wrong credentials do not connect with master. |
| 100 |
|
| 101 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 102 |
START GROUP_REPLICATION USER='regular_user_p',PASSWORD='wrong'; |
| 103 |
|
| 104 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 105 |
START GROUP_REPLICATION USER='regular_user_p'; |
| 106 |
|
| 107 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 108 |
START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='password'; |
| 109 |
|
| 110 |
--echo |
| 111 |
--echo # 7. Test right credentials in START GR connect with master. |
| 112 |
|
| 113 |
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password'; |
| 114 |
--let $group_replication_member_state = ONLINE |
| 115 |
--source include/gr_wait_for_member_state.inc |
| 116 |
--source include/stop_group_replication.inc |
| 117 |
|
| 118 |
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password' , DEFAULT_AUTH= 'auth_test_plugin'; |
| 119 |
--let $group_replication_member_state = ONLINE |
| 120 |
--source include/gr_wait_for_member_state.inc |
| 121 |
--source include/stop_group_replication.inc |
| 122 |
|
| 123 |
START GROUP_REPLICATION PASSWORD='password' , USER='regular_user_p', DEFAULT_AUTH='auth_test_plugin'; |
| 124 |
--let $group_replication_member_state = ONLINE |
| 125 |
--source include/gr_wait_for_member_state.inc |
| 126 |
--source include/stop_group_replication.inc |
| 127 |
|
| 128 |
START GROUP_REPLICATION USER='regular_user_p' , DEFAULT_AUTH= '' , PASSWORD='password'; |
| 129 |
--let $group_replication_member_state = ONLINE |
| 130 |
--source include/gr_wait_for_member_state.inc |
| 131 |
--source include/stop_group_replication.inc |
| 132 |
|
| 133 |
START GROUP_REPLICATION USER='regular_user_wp'; |
| 134 |
--let $group_replication_member_state = ONLINE |
| 135 |
--source include/gr_wait_for_member_state.inc |
| 136 |
--source include/stop_group_replication.inc |
| 137 |
|
| 138 |
START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD=''; |
| 139 |
--let $group_replication_member_state = ONLINE |
| 140 |
--source include/gr_wait_for_member_state.inc |
| 141 |
--source include/stop_group_replication.inc |
| 142 |
|
| 143 |
--echo |
| 144 |
--echo # 8. Cleanup. |
| 145 |
|
| 146 |
CHANGE REPLICATION SOURCE TO SOURCE_USER='root' , SOURCE_PASSWORD='' FOR CHANNEL 'group_replication_recovery'; |
| 147 |
|
| 148 |
SET SESSION sql_log_bin = 0; |
| 149 |
call mtr.add_suppression("Error while executing a group configuration operation: Could not extract the access credentials for XCom connections.*"); |
| 150 |
call mtr.add_suppression("\\[GCS\\] The group communication engine could not set up its internal event notification mechanism.*"); |
| 151 |
call mtr.add_suppression("\\[GCS\\] The group communication engine failed to test connectivity to the local group communication engine.*"); |
| 152 |
call mtr.add_suppression("Timeout on wait for view after joining group."); |
| 153 |
SET SESSION sql_log_bin = 1; |
| 154 |
|
| 155 |
SET @@GLOBAL.group_replication_recovery_reconnect_interval = @saved_group_replication_recovery_reconnect_interval; |
| 156 |
SET @@GLOBAL.group_replication_recovery_retry_count = @saved_gr_recovery_retry_count; |
| 157 |
|
| 158 |
SET SQL_LOG_BIN=0; |
| 159 |
|
| 160 |
DROP USER 'regular_user_p'; |
| 161 |
DROP USER 'regular_user_wp'; |
| 162 |
|
| 163 |
SET SQL_LOG_BIN=1; |
| 164 |
|
| 165 |
--let $rpl_connection_name= server1 |
| 166 |
--source include/rpl_connection.inc |
| 167 |
|
| 168 |
SET SQL_LOG_BIN=0; |
| 169 |
|
| 170 |
DROP USER 'regular_user_p'; |
| 171 |
DROP USER 'regular_user_wp'; |
| 172 |
|
| 173 |
SET SQL_LOG_BIN=1; |
| 174 |
|
| 175 |
--source include/group_replication_end.inc |