Debian Codegraph @

mysql-test/suite/group_replication/t/gr_start_gr_with_credentials.test

raw
1 ################################################################################
2 # This test proves credential for recovery can be passed via START GR command.
3 #
4 # Test:
5 # 0. The test requires two servers: M1 and M2.
6 # 1. Bootstrap M1. And create new users.
7 # 2. Reset recovery interval to 1 and count to 2 for M2.
8 # 3. Test START GR works without any option.
9 # 4. Delete recovery channel and test START GR, it should fail.
10 # 5. Pass USER as root and test START GR, member should come ONLINE.
11 # START GR without parameter fails, credentials are removed on STOP.
12 # 6. Test wrong credentials do not connect with master.
13 # 7. Test right credentials in START GR connect with master.
14 # 8. Cleanup.
15 ################################################################################
16
17 --source include/have_group_replication_xcom_communication_stack.inc
18 --source include/big_test.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
33 CREATE USER 'regular_user_p' IDENTIFIED BY 'password';
34 CREATE USER 'regular_user_wp' IDENTIFIED BY '';
35
36 GRANT REPLICATION SLAVE ON *.* TO "regular_user_p";
37 GRANT REPLICATION SLAVE ON *.* TO "regular_user_wp";
38
39 SET SQL_LOG_BIN=1;
40
41 --echo
42 --echo # 2. Reset recovery interval to 1 and count to 2 for M2.
43
44 --let $rpl_connection_name= server2
45 --source include/rpl_connection.inc
46
47 SET @saved_group_replication_recovery_reconnect_interval = @@GLOBAL.group_replication_recovery_reconnect_interval;
48 SET @saved_gr_recovery_retry_count = @@GLOBAL.group_replication_recovery_retry_count;
49
50 SET GLOBAL group_replication_recovery_reconnect_interval= 1;
51 SET GLOBAL group_replication_recovery_retry_count= 2;
52 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
53 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
54
55 --echo
56 --echo # 3. Test START GR works without any option.
57
58 --source include/start_group_replication.inc
59 --source include/stop_group_replication.inc
60
61 --echo
62 --echo # 4. Delete recovery channel and test START GR, it should fail.
63
64 RESET SLAVE ALL FOR CHANNEL 'group_replication_recovery';
65 START GROUP_REPLICATION;
66 --let $group_replication_member_state = ERROR
67 --source include/gr_wait_for_member_state.inc
68 --source include/stop_group_replication.inc
69
70 --echo
71 --echo # 5. Pass USER as root and test START GR, member should come ONLINE.
72 --echo # START GR without parameter fails, credentials are removed on STOP.
73
74 START GROUP_REPLICATION USER='root';
75 --let $group_replication_member_state = ONLINE
76 --source include/gr_wait_for_member_state.inc
77 --source include/stop_group_replication.inc
78
79 START GROUP_REPLICATION;
80 --let $group_replication_member_state = ERROR
81 --source include/gr_wait_for_member_state.inc
82 --source include/stop_group_replication.inc
83
84 --echo
85 --echo # 6. Test wrong credentials do not connect with master.
86
87 START GROUP_REPLICATION USER='regular_user_p',PASSWORD='wrong';
88 --let $group_replication_member_state = ERROR
89 --source include/gr_wait_for_member_state.inc
90 --source include/stop_group_replication.inc
91
92 START GROUP_REPLICATION USER='regular_user_p';
93 --let $group_replication_member_state = ERROR
94 --source include/gr_wait_for_member_state.inc
95 --source include/stop_group_replication.inc
96
97 START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='password';
98 --let $group_replication_member_state = ERROR
99 --source include/gr_wait_for_member_state.inc
100 --source include/stop_group_replication.inc
101
102 --echo
103 --echo # 7. Test right credentials in START GR connect with master.
104
105 START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password';
106 --let $group_replication_member_state = ONLINE
107 --source include/gr_wait_for_member_state.inc
108 --source include/stop_group_replication.inc
109
110 START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password' , DEFAULT_AUTH='wrong_auth';
111 --let $group_replication_member_state = ONLINE
112 --source include/gr_wait_for_member_state.inc
113 --source include/stop_group_replication.inc
114
115 START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password' , DEFAULT_AUTH= 'auth_test_plugin';
116 --let $group_replication_member_state = ONLINE
117 --source include/gr_wait_for_member_state.inc
118 --source include/stop_group_replication.inc
119
120 START GROUP_REPLICATION PASSWORD='password' , USER='regular_user_p', DEFAULT_AUTH='auth_test_plugin';
121 --let $group_replication_member_state = ONLINE
122 --source include/gr_wait_for_member_state.inc
123 --source include/stop_group_replication.inc
124
125 START GROUP_REPLICATION USER='regular_user_p' , DEFAULT_AUTH= '' , PASSWORD='password';
126 --let $group_replication_member_state = ONLINE
127 --source include/gr_wait_for_member_state.inc
128 --source include/stop_group_replication.inc
129
130 START GROUP_REPLICATION USER='regular_user_wp';
131 --let $group_replication_member_state = ONLINE
132 --source include/gr_wait_for_member_state.inc
133 --source include/stop_group_replication.inc
134
135 START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='';
136 --let $group_replication_member_state = ONLINE
137 --source include/gr_wait_for_member_state.inc
138 --source include/stop_group_replication.inc
139
140 --echo
141 --echo # 8. Cleanup.
142
143 CHANGE REPLICATION SOURCE TO SOURCE_USER='root' , SOURCE_PASSWORD='' FOR CHANNEL 'group_replication_recovery';
144
145 SET SESSION sql_log_bin = 0;
146 call mtr.add_suppression("Replica I/O for channel 'group_replication_recovery': Fatal error: Invalid .* username when attempting to connect to the source server.*");
147 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.");
148 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.");
149 call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
150 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
151 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
152 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
153 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
154 SET SESSION sql_log_bin = 1;
155
156 SET @@GLOBAL.group_replication_recovery_reconnect_interval = @saved_group_replication_recovery_reconnect_interval;
157 SET @@GLOBAL.group_replication_recovery_retry_count = @saved_gr_recovery_retry_count;
158
159 --let $rpl_connection_name= server1
160 --source include/rpl_connection.inc
161
162 SET SQL_LOG_BIN=0;
163
164 DROP USER 'regular_user_p';
165 DROP USER 'regular_user_wp';
166
167 SET SQL_LOG_BIN=1;
168
169 --source include/group_replication_end.inc