Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_async_conn_failover_udf_check.test

raw
1 # ==== Purpose ====
2 #
3 # WL#12649: Automatic reconnection for Async replication between InnoDB Clusters
4 #
5 # It tests add and delete sender configuration UDF's.
6 #
7 # ==== Implementation ====
8 #
9 # For asynchronous_connection_failover_add_source:
10 # 1. Check that the parameter count is greater than 3,
11 # i.e. channel_name, hostname and port must be provided.
12 # 2. Check that the channel name is provided.
13 # 3. Check host parameters values is provided and not empty.
14 # 4. Check port parameters values is provided.
15 # 5. Check the weight parameter value is integer value between 1-100.
16 # 6. Check the default value of weight parameter is 50.
17 # 7. Check asynchronous_connection_failover_add_source returns warning
18 # on network_namespace value. Also if network_namespace is set through
19 # CHANGE REPLICATION SOURCE TO command that network_namespace is returned on
20 # querying
21 # performance_schema.replication_asynchronous_connection_failover
22 # table for the channel.
23 #
24 # For asynchronous_connection_failover_delete_source:
25 # 7. Check that the parameter count is greater than 3,
26 # 8 i.e. channel_name, hostname and port must be provided.
27 # 9. Check that the channel name is provided.
28 # 10. Check host parameters values is provided and not empty.
29 # 11. Check port parameters values is provided.
30 # 12. Check correct string value is provided for network_namespace.
31 # 13. Add existing credentials. Delete non existing credentials.
32 # 14. Verify user without SUPER or REPLICATION_SLAVE_ADMIN fails with
33 # ER_SPECIFIC_ACCESS_DENIED_ERROR error when execute
34 # asynchronous_connection_failover_add_source and
35 # asynchronous_connection_failover_delete_source UDF.
36 # 15. Verify user with REPLICATION_SLAVE_ADMIN privilege can execute
37 # asynchronous_connection_failover_add_source and
38 # asynchronous_connection_failover_delete_source UDF.
39 #
40
41 --let $rpl_skip_start_slave= 1
42 --source include/master-slave.inc
43
44 # Checks for add sender configuration UDF
45 # i.e. asynchronous_connection_failover_add_source()
46
47 --echo #
48 --echo # 1. Check that the parameter count is greater than 3 and less then 5,
49 --echo # i.e. channel_name, hostname and port must be provided.
50 --echo #
51
52 --error ER_CANT_INITIALIZE_UDF
53 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1');
54
55 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
56 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
57 --source include/assert.inc
58
59
60 --error ER_CANT_INITIALIZE_UDF
61 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, 'net', 30, 11);
62
63 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
64 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
65 --source include/assert.inc
66
67
68 --echo #
69 --echo # 2. Check that the channel name is provided.
70 --echo #
71
72 --error ER_CANT_INITIALIZE_UDF
73 SELECT asynchronous_connection_failover_add_source(9, '127.0.0.1', 3100);
74
75 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
76 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
77 --source include/assert.inc
78
79
80 --echo #
81 --echo # 3. Check host parameters values is provided and not empty.
82 --echo #
83
84 --error ER_CANT_INITIALIZE_UDF
85 SELECT asynchronous_connection_failover_add_source('', '', 3100);
86
87 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
88 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
89 --source include/assert.inc
90
91
92 --echo #
93 --echo # 4. Check port parameters values is provided.
94 --echo #
95
96 --error ER_CANT_INITIALIZE_UDF
97 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', '3100');
98
99 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
100 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
101 --source include/assert.inc
102
103
104 --echo #
105 --echo # 5. Check the weight parameter value is integer value between 1-100.
106 --echo #
107
108 --error ER_CANT_INITIALIZE_UDF
109 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, '', 0);
110
111 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
112 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
113 --source include/assert.inc
114
115
116 --error ER_CANT_INITIALIZE_UDF
117 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, '', 200);
118
119 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
120 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
121 --source include/assert.inc
122
123
124 --error ER_CANT_INITIALIZE_UDF
125 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, '', '100');
126
127 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
128 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
129 --source include/assert.inc
130
131
132 --echo #
133 --echo # 6. Check the default value of weight parameter is 50.
134 --echo #
135
136 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100);
137
138 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
139 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
140 --source include/assert.inc
141
142 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
143 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE weight=50, count, 1] = 1
144 --source include/assert.inc
145
146 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', 3100);
147
148
149 --echo #
150 --echo # 7. Check asynchronous_connection_failover_add_source returns warning
151 --echo # on network_namespace value. Also if network_namespace is set through
152 --echo # CHANGE REPLICATION SOURCE TO command that network_namespace is
153 --echo # returned on querying
154 --echo # performance_schema.replication_asynchronous_connection_failover
155 --echo # table for the channel.
156 --echo #
157
158 --error ER_CANT_INITIALIZE_UDF
159 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, 100);
160
161 --let $assert_text= 'There is no row in performance_schema.replication_asynchronous_connection_failover'
162 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
163 --source include/assert.inc
164
165 --let $assert_text= 'There is no row in performance_schema.replication_asynchronous_connection_failover'
166 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE network_namespace="", count, 1] = 0
167 --source include/assert.inc
168
169
170 # Check network_namespace values set through CHANGE REPLICATION SOURCE TO
171 # command is returned.
172 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, 'blue');
173
174 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
175 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
176 --source include/assert.inc
177
178 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
179 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE network_namespace="", count, 1] = 1
180 --source include/assert.inc
181
182 --replace_result $SERVER_MYPORT_1 SERVER_1_PORT
183 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1", SOURCE_USER="root", SOURCE_PASSWORD="", SOURCE_PORT=$SERVER_MYPORT_1, NETWORK_NAMESPACE='red' FOR CHANNEL ""
184
185
186 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
187 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
188 --source include/assert.inc
189
190 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover with NETWORK_NAMESPACE="red"'
191 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE network_namespace="red", count, 1] = 1
192 --source include/assert.inc
193
194
195
196 # Checks for delete sender configuration UDF
197 # i.e. asynchronous_connection_failover_delete_source()
198
199 --echo #
200 --echo # 8. Check that the parameter count is greater than 3 and less then 4,
201 --echo # i.e. channel_name, hostname and port must be provided.
202 --echo #
203
204 --error ER_CANT_INITIALIZE_UDF
205 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1');
206
207 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
208 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
209 --source include/assert.inc
210
211
212 --error ER_CANT_INITIALIZE_UDF
213 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', 3100, 'net', 30);
214
215 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
216 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
217 --source include/assert.inc
218
219
220 --echo #
221 --echo # 9. Check that the channel name is provided.
222 --echo #
223
224 --error ER_CANT_INITIALIZE_UDF
225 SELECT asynchronous_connection_failover_delete_source(9, '127.0.0.1', 3100);
226
227 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
228 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
229 --source include/assert.inc
230
231
232 --echo #
233 --echo # 10. Check host parameters values is provided and not empty.
234 --echo #
235
236 --error ER_CANT_INITIALIZE_UDF
237 SELECT asynchronous_connection_failover_delete_source('', '', 3100);
238
239 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
240 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
241 --source include/assert.inc
242
243
244 --echo #
245 --echo # 11. Check port parameters values is provided.
246 --echo #
247
248 --error ER_CANT_INITIALIZE_UDF
249 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', '3100');
250
251 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
252 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
253 --source include/assert.inc
254
255
256 --echo #
257 --echo # 12. Check correct string value is provided for network_namespace.
258 --echo #
259
260 --error ER_CANT_INITIALIZE_UDF
261 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', 3100, 100);
262
263 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
264 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
265 --source include/assert.inc
266
267
268 --echo #
269 --echo # 13. Add existing credentials. Delete non existing credentials.
270 --echo #
271
272 --error ER_UDF_ERROR
273 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100, '');
274
275 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
276 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
277 --source include/assert.inc
278
279 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', 3100, '');
280
281 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
282 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
283 --source include/assert.inc
284
285 --error ER_UDF_ERROR
286 SELECT asynchronous_connection_failover_delete_source('ch2', '127.0.0.1', 77100);
287
288 --let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table is empty'
289 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
290 --source include/assert.inc
291
292
293 --echo #
294 --echo # 14. Verify user without SUPER or REPLICATION_SLAVE_ADMIN fails with
295 --echo # ER_SPECIFIC_ACCESS_DENIED_ERROR error when execute
296 --echo # asynchronous_connection_failover_add_source and
297 --echo # asynchronous_connection_failover_delete_source UDF.
298 --echo #
299
300 CREATE USER 'async_user' IDENTIFIED BY 'pass';
301
302 --echo [connection connect_async]
303 connect(connect_async, localhost, async_user, pass);
304
305 --error ER_SPECIFIC_ACCESS_DENIED_ERROR
306 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100);
307
308 --error ER_SPECIFIC_ACCESS_DENIED_ERROR
309 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', 3100);
310
311 --error ER_TABLEACCESS_DENIED_ERROR
312 SELECT * FROM mysql.replication_asynchronous_connection_failover;
313
314 --error ER_SPECIFIC_ACCESS_DENIED_ERROR
315 SELECT asynchronous_connection_failover_reset();
316
317 --disconnect connect_async
318
319
320 --echo #
321 --echo # 15. Verify user with REPLICATION_SLAVE_ADMIN privilege can execute
322 --echo # asynchronous_connection_failover_add_source and
323 --echo # asynchronous_connection_failover_delete_source UDF.
324 --echo #
325
326 --source include/rpl_connection_master.inc
327
328 GRANT REPLICATION_SLAVE_ADMIN ON *.* TO 'async_user';
329
330 --echo [connection connect_async]
331 connect(connect_async, localhost, async_user, pass);
332
333 SELECT asynchronous_connection_failover_add_source('', '127.0.0.1', 3100);
334
335 SELECT asynchronous_connection_failover_delete_source('', '127.0.0.1', 3100);
336
337 SELECT asynchronous_connection_failover_reset();
338
339 --disconnect connect_async
340
341 --source include/rpl_connection_master.inc
342 DROP USER 'async_user';
343
344 --let $assert_text= 'There are 0 rows in performance_schema.replication_asynchronous_connection_failover'
345 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE managed_name="", count, 1] = 0
346 --source include/assert.inc
347
348 RESET REPLICA ALL;
349 --let $rpl_only_running_threads= 1
350 --source include/rpl_end.inc