Debian Codegraph @

mysql-test/suite/x/t/connection.test

raw
1 # This is test file for connection & authentication handling without ssl.
2 #
3 # Comment:
4 #
5 # Mysqlx_connections_closed status variable is incremented after releasing
6 # client network resources. Because of it, it is a best suitable for synchronization.
7 # Other session/connection release/error status variables must be checked after waiting
8 # for concrete value on this timer.
9 #
10
11 --source include/xplugin_preamble.inc
12 --source include/xplugin_create_user.inc
13
14 call mtr.add_suppression("Plugin mysqlx reported: 'Unable to switch context to user mysql.session'");
15 call mtr.add_suppression("Plugin mysqlx reported: 'Unable to accept connection, disconnecting client'");
16 call mtr.add_suppression("Plugin mysqlx reported: 'Could not open internal MySQL session'");
17 call mtr.add_suppression("Plugin mysqlx reported: '.*: Error initializing session for connection: Too many connections'");
18 call mtr.add_suppression("Plugin 'mysqlx' has ref_count=5 after shutdown");
19 call mtr.add_suppression("Plugin 'mysqlx' will be forced to shutdown");
20
21 ## Test starts here
22 --write_file $MYSQL_TMP_DIR/mysqlx-connection.xpl
23 -->sql
24 SELECT PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where PLUGIN_NAME LIKE '%mysqlx%';
25 create user xplugin@localhost identified by 'xplugin';
26 alter user xplugin@localhost password expire;
27 create user nonblank@localhost identified by 'nonblank';
28 create user blank@localhost identified by '';
29 CREATE USER 'abc'@'localhost' IDENTIFIED BY 'abc' ACCOUNT LOCK;
30 #CREATE USER noauth@localhost IDENTIFIED WITH 'mysql_no_login';
31 create user ''@localhost identified by 'ramana';
32 create user special@localhost identified by '1aram@&Tpu';
33 create user session@localhost identified by 'session';
34 grant all on *.* to session@localhost;
35 show status like 'Mysqlx_connections_closed';
36 show status like 'Mysqlx_connections_accepted';
37 show status like 'Mysqlx_connection_accept_errors';
38 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
39 show status where `Variable_name` like 'Mysqlx_sessions%' and not `Variable_name` like 'Mysqlx_sessions_fatal_error';
40 -->endsql
41 EOF
42
43 --write_file $MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl
44 -->stmtsql select user(),current_user(),@@bind_address
45 -->expecterror %EXPECT_ERROR%
46 -->recvresult
47
48 -->stmtsql show status like 'Mysqlx_connections_closed'
49 -->expecterror %EXPECT_ERROR%
50 -->recvresult
51
52 -->stmtsql show status like 'Mysqlx_connections_accepted'
53 -->expecterror %EXPECT_ERROR%
54 -->recvresult
55
56 -->stmtsql show status like 'Mysqlx_connection_accept_errors'
57 -->expecterror %EXPECT_ERROR%
58 -->recvresult
59
60 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
61 -->stmtsql show status where `Variable_name` like 'Mysqlx_sessions%' and not `Variable_name` like 'Mysqlx_sessions_fatal_error'
62 -->expecterror %EXPECT_ERROR%
63 -->recvresult
64
65 EOF
66
67 --write_file $MYSQL_TMP_DIR/mysqlx-connection_locked_user.xpl
68 -->expecterror ER_ACCOUNT_HAS_BEEN_LOCKED
69 -->newsession bla abc abc
70 EOF
71
72
73 --write_file $MYSQL_TMP_DIR/mysqlx-connection_session_track.xpl
74 -->sql
75 SET @@session.session_track_system_variables='mysqlx_port,mysqlx_idle_worker_thread_timeout,mysqlx_max_allowed_packet,mysqlx_max_connections,mysqlx_min_worker_threads';
76 show variables like '%session_track%';
77 -->endsql
78
79 -->stmtsql uninstall plugin mysqlx;
80 -->expecterror ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED
81 -->recvresult
82
83 -->sql
84 show warnings;
85 show variables like '%mysqlx_max_connections%';
86 set @@global.mysqlx_max_connections=100;
87 show variables like '%mysqlx_max_connections%';
88 show status like 'Mysqlx_connections_closed';
89 show status like 'Mysqlx_connections_accepted';
90 show status like 'Mysqlx_connection_accept_errors';
91 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
92 show status where `Variable_name` like 'Mysqlx_sessions%' and not `Variable_name` like 'Mysqlx_sessions_fatal_error';
93 -->endsql
94 EOF
95
96 --write_file $MYSQL_TMP_DIR/mysqlx-connection_uninstallplugin.xpl
97 -->sql
98 uninstall plugin mysqlx;
99 -->endsql
100 EOF
101
102 --echo #
103 --echo # Login with valid account
104 --echo #
105 exec $MYSQLXTEST -ux_root --password=''
106 --file=$MYSQL_TMP_DIR/mysqlx-connection.xpl 2>&1;
107 let $wait_for_status_variable =
108 'Mysqlx_connections_closed',
109 'Mysqlx_sessions_closed';
110 let $wait_for_status_value = 1, 1;
111 source ../include/wait_for_status_variables.inc;
112 source ../include/connection_test_helpers.inc;
113
114 --echo #
115 --echo # Try to login with bogus accounts that could match a valid account by collation
116 --echo #
117 exec $MYSQLXTEST --expect-error 2510 -uX_root --password='' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1;
118
119
120 exec $MYSQLXTEST --expect-error 2510 -u"x_root " --password='' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1;
121 let $wait_for_status_variable =
122 'Mysqlx_sessions',
123 'Mysqlx_connections_closed';
124 let $wait_for_status_value = 0, 3;
125
126 source ../include/wait_for_status_variables.inc;
127 source ../include/connection_test_helpers.inc;
128
129
130 --echo #
131 --echo # Try login with user having special characters in password when mysqlxplugin installed
132 --echo #
133 --exec $MYSQLXTEST -uspecial --password="1aram@&Tpu" -v%EXPECT_ERROR%=ER_SUCCESS --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1
134 let $wait_for_status_variable =
135 'Mysqlx_sessions',
136 'Mysqlx_connections_closed';
137 let $wait_for_status_value = 0, 4;
138 source ../include/wait_for_status_variables.inc;
139 source ../include/connection_test_helpers.inc;
140
141 #### Not a Bug, anon user doesn't exist in xplugin
142 ####try login with annonymous user when mysqx plugin is installed
143 ####Test for Bug#21372364
144 ####--exec $MYSQLXTEST -ut --password='ramana' -v%EXPECT_ERROR%=ER_MUST_CHANGE_PASSWORD --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1
145
146 --echo #
147 --echo # try login with invalid host when mysqx plugin is installed
148 --echo #
149 --exec $MYSQLXTEST --expect-error CR_UNKNOWN_HOST -ux_root --password='' -hmtr_test_invalid_mysql_host --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1
150
151 # replace_regex did consume last character in line, lets put it back
152 --echo
153
154 --source ../include/xplugin_wait_for_connection_closure.inc
155
156 let $wait_for_status_variable =
157 'Mysqlx_sessions_rejected',
158 'Mysqlx_connections_closed';
159 let $wait_for_status_value = 2, 4;
160 source ../include/wait_for_status_variables.inc;
161 source ../include/connection_test_helpers.inc;
162
163 --echo #
164 --echo # Trying with valid user when mysqlx is not installed
165 --echo #
166
167 let $restart_parameters = restart: --skip-mysqlx;
168 source include/restart_mysqld.inc;
169
170 replace_regex /( *No connection could be made because the target machine actively refused it connecting to*| *Connection refused connecting to*) .*:[0-9]*/ERROR: Connection refused connecting to HOST:PORT/;
171 exec $MYSQLXTEST --expect-error CR_CONNECTION_ERROR -ux_root --password=''
172 --file=$MYSQL_TMP_DIR/mysqlx-connection.xpl 2>&1;
173 source ../include/connection_test_helpers.inc;
174
175 --echo #
176 --echo # Try login using mysqlx protocol when server and mysqlx loaded with super user
177 --echo #
178 replace_regex /\.dll/.so/;
179 let $restart_parameters = restart: ;
180 source include/restart_mysqld.inc;
181 exec $MYSQLXTEST -u x_root --password='' -v%EXPECT_ERROR%=ER_SUCCESS
182 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
183 let $wait_for_status_variable =
184 'Mysqlx_connections_closed',
185 'Mysqlx_sessions_closed';
186 let $wait_for_status_value = 1,1;
187 source ../include/wait_for_status_variables.inc;
188 source ../include/connection_test_helpers.inc;
189
190 --echo #
191 --echo # Try login with valid user but incorrect password
192 --echo #
193 exec $MYSQLXTEST --expect-error 2510 -ux_root --password='x_root' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1;
194 let $wait_for_status_variable =
195 'Mysqlx_sessions_rejected',
196 'Mysqlx_connections_closed';
197 let $wait_for_status_value = 1, 2;
198 source ../include/wait_for_status_variables.inc;
199 source ../include/connection_test_helpers.inc;
200
201 --echo #
202 --echo # Try login with user doesn't exists when mysqlx installed
203 --echo #
204 exec $MYSQLXTEST --expect-error 2510 -u rt --password='x_root' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1;
205 let $wait_for_status_variable =
206 'Mysqlx_sessions_rejected',
207 'Mysqlx_connections_closed';
208 let $wait_for_status_value = 2, 3;
209 source ../include/wait_for_status_variables.inc;
210 source ../include/connection_test_helpers.inc;
211
212 --echo #
213 --echo # Try login with user whose password expired when mysqlx installed
214 --echo #
215 exec $MYSQLXTEST --expect-error ER_MUST_CHANGE_PASSWORD_LOGIN -u xplugin --password='xplugin' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1;
216 let $wait_for_status_variable =
217 'Mysqlx_sessions_rejected',
218 'Mysqlx_connections_closed';
219 let $wait_for_status_value = 3, 4;
220 source ../include/wait_for_status_variables.inc;
221 source ../include/connection_test_helpers.inc;
222
223 --echo #
224 --echo # Try login with user whose account is locked when mysqlx installed
225 --echo #
226 --exec $MYSQLXTEST --expect-error ER_ACCOUNT_HAS_BEEN_LOCKED -u abc --password='abc' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1
227 let $wait_for_status_variable =
228 'Mysqlx_sessions_rejected',
229 'Mysqlx_connections_closed';
230 let $wait_for_status_value = 4, 5;
231 source ../include/wait_for_status_variables.inc;
232 source ../include/connection_test_helpers.inc;
233
234 --echo #
235 --echo # Try login with internal user account and expect account is locked error
236 --echo #
237 --exec $MYSQLXTEST --expect-error 2510 -u'mysql.session' --password='' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()"
238 let $wait_for_status_variable =
239 'Mysqlx_sessions_rejected',
240 'Mysqlx_connections_closed';
241 let $wait_for_status_value = 5, 6;
242 source ../include/wait_for_status_variables.inc;
243 source ../include/connection_test_helpers.inc;
244
245 --echo #
246 --echo # Login with valid user and valid password when mysqlx installed
247 --echo #
248 --exec $MYSQLXTEST -u nonblank --password='nonblank' -v%EXPECT_ERROR%=ER_SUCCESS --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1
249 let $wait_for_status_variable =
250 'Mysqlx_sessions_closed',
251 'Mysqlx_connections_closed';
252 let $wait_for_status_value = 2, 7;
253 source ../include/wait_for_status_variables.inc;
254 source ../include/connection_test_helpers.inc;
255
256 --echo #
257 --echo # Login with valid user and blank password when mysqlx installed
258 --echo #
259 --exec $MYSQLXTEST -u blank --password='' -v%EXPECT_ERROR%=ER_SUCCESS --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1
260 let $wait_for_status_variable =
261 'Mysqlx_sessions_closed',
262 'Mysqlx_connections_closed';
263 let $wait_for_status_value = 3, 8;
264 source ../include/wait_for_status_variables.inc;
265 source ../include/connection_test_helpers.inc;
266
267 --remove_file $MYSQL_TMP_DIR/mysqlx-connection.xpl
268
269 --write_file $MYSQL_TMP_DIR/mysqlx-connection.xpl
270 -->sql
271 SELECT PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_STATUS,PLUGIN_TYPE,PLUGIN_TYPE_VERSION,PLUGIN_LIBRARY,PLUGIN_LIBRARY_VERSION,PLUGIN_AUTHOR,PLUGIN_DESCRIPTION,PLUGIN_LICENSE,LOAD_OPTION from information_schema.plugins where PLUGIN_NAME LIKE '%xplugin%';
272 show status like 'Mysqlx_connections_closed';
273 show status like 'Mysqlx_connections_accepted';
274 show status like 'Mysqlx_connection_accept_errors';
275 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
276 show status where `Variable_name` like 'Mysqlx_sessions%' and not `Variable_name` like 'Mysqlx_sessions_fatal_error';
277 -->endsql
278 EOF
279
280 --echo #
281 --echo # Try login with valid user when server started with localhost as bind-address and mysqlx loaded
282 --echo #
283 let $restart_parameters = restart: --bind-address=localhost;
284 replace_regex /\.dll/.so/;
285 source include/restart_mysqld.inc;
286 exec $MYSQLXTEST -u nonblank --password='nonblank'
287 -v%EXPECT_ERROR%=ER_SUCCESS
288 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
289 let $wait_for_status_variable =
290 'Mysqlx_sessions_closed',
291 'Mysqlx_connections_closed';
292 let $wait_for_status_value = 1, 1;
293 source ../include/wait_for_status_variables.inc;
294
295 exec $MYSQLXTEST -u nonblank --password='nonblank' -hlocalhost
296 -v%EXPECT_ERROR%=ER_SUCCESS
297 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
298 let $wait_for_status_variable =
299 'Mysqlx_sessions_closed',
300 'Mysqlx_connections_closed';
301 let $wait_for_status_value = 2, 2;
302 source ../include/wait_for_status_variables.inc;
303 source ../include/connection_test_helpers.inc;
304
305 --echo #
306 --echo # Try login with valid user when server started with 127.0.0.1 as bind-address and mysqlx loaded
307 --echo #
308 let $restart_parameters = restart: --bind-address=127.0.0.1;
309 replace_regex /\.dll/.so/;
310 source include/restart_mysqld.inc;
311 exec $MYSQLXTEST -u nonblank --password='nonblank'
312 -v%EXPECT_ERROR%=ER_SUCCESS
313 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
314 let $wait_for_status_variable =
315 'Mysqlx_sessions_closed',
316 'Mysqlx_connections_closed';
317 let $wait_for_status_value = 1, 1;
318 source ../include/wait_for_status_variables.inc;
319 source ../include/connection_test_helpers.inc;
320
321 exec $MYSQLXTEST -u nonblank --password='nonblank' -h127.0.0.1
322 -v%EXPECT_ERROR%=ER_SUCCESS
323 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
324 let $wait_for_status_variable =
325 'Mysqlx_sessions_closed',
326 'Mysqlx_connections_closed';
327 let $wait_for_status_value = 2, 2;
328 source ../include/wait_for_status_variables.inc;
329 source ../include/connection_test_helpers.inc;
330
331 --echo #
332 --echo # Try login with valid non-super and super user when server is in offline mode and mysqlx loaded
333 --echo #
334 let $restart_parameters = restart: --offline_mode=ON;
335 replace_regex /\.dll/.so/;
336 source include/restart_mysqld.inc;
337 exec $MYSQLXTEST --expect-error ER_SERVER_OFFLINE_MODE -u nonblank --password='nonblank' --sql "SELECT THIS_MUST_NOT_BE_EXECUTED()" 2>&1;
338 let $wait_for_status_variable =
339 'Mysqlx_sessions_rejected',
340 'Mysqlx_connections_closed';
341 let $wait_for_status_value = 1, 1;
342 source ../include/wait_for_status_variables.inc;
343 source ../include/connection_test_helpers.inc;
344
345 --exec $MYSQLXTEST -u x_root --password='' -v%EXPECT_ERROR%=ER_SUCCESS --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1
346 let $wait_for_status_variable =
347 'Mysqlx_sessions_closed',
348 'Mysqlx_connections_closed';
349 let $wait_for_status_value = 1, 2;
350 source ../include/wait_for_status_variables.inc;
351 source ../include/connection_test_helpers.inc;
352
353 --echo #
354 --echo # Start server with session tracking variables and monitor them using xprotocol
355 --echo #
356 let $restart_parameters = restart: ;
357 replace_regex /\.dll/.so/;
358 source include/restart_mysqld.inc;
359 exec $MYSQLXTEST -u session --password='session'
360 --file=$MYSQL_TMP_DIR/mysqlx-connection_session_track.xpl 2>&1;
361 let $wait_for_status_variable =
362 'Mysqlx_sessions_closed',
363 'Mysqlx_connections_closed';
364 let $wait_for_status_value = 1, 1;
365 source ../include/wait_for_status_variables.inc;
366 source ../include/connection_test_helpers.inc;
367
368 --echo #
369 --echo # Try login with user whose password expired when mysqlx installed and when server started with skip-disconnect-on-expired-password option
370 --echo #
371 let $restart_parameters = restart: --skip-disconnect-on-expired-password;
372 replace_regex /\.dll/.so/;
373 source include/restart_mysqld.inc;
374
375 exec $MYSQLXTEST -u xplugin --password='xplugin'
376 -v%EXPECT_ERROR%=ER_MUST_CHANGE_PASSWORD
377 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
378 let $wait_for_status_variable =
379 'Mysqlx_sessions_closed',
380 'Mysqlx_connections_closed';
381 let $wait_for_status_value = 1, 1;
382 source ../include/wait_for_status_variables.inc;
383 source ../include/connection_test_helpers.inc;
384
385 --write_file $MYSQL_TMP_DIR/open_max_mysqlx_connection.xpl
386 -->sql
387 create user con1@localhost identified by 'con1';
388 create user con2@localhost identified by 'con2';
389 grant all on *.* to con2@localhost;
390 -->endsql
391 -->echo Test data
392 -->stmtadmin list_clients
393 -->echo expect Mysqlx.Sql.StmtExecuteOk
394 -->recvresult client_id user host
395
396 -->echo create and activate new session con1
397 -->newsession con1 con1 con1
398
399 -->stmtadmin list_clients
400 -->echo expect Mysqlx.Sql.StmtExecuteOk
401 -->recvresult client_id user host
402
403 -->echo open 3rd xprotocol connection where 2 sessions already opened (may fail)
404 -->newsession con2 -
405 -->peerdisc 1000 1000
406
407 -->sleep 2
408 -->stmtadmin list_clients
409 -->recvresult client_id user host
410
411 -->sql
412 show status like 'Mysqlx_connections_closed';
413 show status like 'Mysqlx_connections_accepted';
414 show status like 'Mysqlx_connection_accept_errors';
415 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
416 -->endsql
417 EOF
418
419 --echo #
420 --echo # Try to open xprotocol sessions more than mysqlx_max_connections,
421 --echo # expect error for last connection
422 --echo #
423 let $restart_parameters = restart: --mysqlx_max_connections=2;
424 replace_regex /\.dll/.so/;
425 source include/restart_mysqld.inc;
426 exec $MYSQLXTEST -u x_root --password=''
427 --file=$MYSQL_TMP_DIR/open_max_mysqlx_connection.xpl 2>&1;
428
429 let $wait_for_status_variable =
430 'Mysqlx_connections_closed', 'Mysqlx_connections_accepted', 'Mysqlx_sessions_closed';
431 let $wait_for_status_value = 2, 2, 2;
432 source ../include/wait_for_status_variables.inc;
433 let $skip_show_mysqlx_sessions_variables=1;
434 source ../include/connection_test_helpers.inc;
435
436 --write_file $MYSQL_TMP_DIR/open_max_mysqlx_connection2.xpl
437 -->sql
438 create user con1@localhost identified by 'con1';
439 create user con2@localhost identified by 'con2';
440 grant all on *.* to con2@localhost;
441 -->endsql
442 -->echo Test data
443 -->stmtadmin list_clients
444 -->echo expect Mysqlx.Sql.StmtExecuteOk
445 -->recvresult client_id user host
446
447 -->echo create and activate new session con1
448 -->newsession con1 con1 con1
449
450 -->stmtadmin list_clients
451 -->echo expect Mysqlx.Sql.StmtExecuteOk
452 -->recvresult client_id user host
453
454 -->echo open 3rd xprotocol connection where 2 sessions already opened
455 -->newsession con2 con2 con2
456
457 -->stmtadmin list_clients
458 -->recvresult client_id user host
459
460 -->sql
461 show status like 'Mysqlx_connections_closed';
462 show status like 'Mysqlx_connections_accepted';
463 show status like 'Mysqlx_connection_accept_errors';
464 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
465 -->endsql
466 EOF
467
468 --echo #
469 --echo # Try to open xprotocol sessions as that of mysqlx_max_connections set
470 --echo #
471 drop user con1@localhost;
472 drop user con2@localhost;
473 let $restart_parameters = restart: --mysqlx_max_connections=3;
474 --replace_regex /\.dll/.so/
475 --source include/restart_mysqld.inc
476 --exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/open_max_mysqlx_connection2.xpl 2>&1
477 let $wait_for_status_variable =
478 'Mysqlx_connections_closed', 'Mysqlx_connections_accepted', 'Mysqlx_sessions_closed';
479 let $wait_for_status_value = 3, 3, 3;
480 source ../include/wait_for_status_variables.inc;
481 let $skip_show_mysqlx_sessions_variables=1;
482 source ../include/connection_test_helpers.inc;
483
484 --write_file $MYSQL_TMP_DIR/allconn_root.xpl
485 -->sql
486 create user xcon1@localhost identified by 'xcon1';
487 create user xcon2@localhost identified by 'xcon2';
488 grant all on *.* to xcon2@localhost;
489 set @@global.mysqlx_max_connections=2;
490 -->endsql
491 -->echo Test data
492 -->stmtadmin list_clients
493 -->echo expect Mysqlx.Sql.StmtExecuteOk
494 -->recvresult client_id user host
495
496 -->sql
497 show status like 'Mysqlx_connections_closed';
498 show status like 'Mysqlx_connections_accepted';
499 show status like 'Mysqlx_connection_accept_errors';
500 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
501 -->endsql
502
503 -->echo create and activate new session con1
504 -->newsession xcon1 xcon1 xcon1
505
506 -->stmtadmin list_clients
507 -->echo expect Mysqlx.Sql.StmtExecuteOk
508 -->recvresult client_id user host
509
510 -->sql
511 show status like 'Mysqlx_connections_closed';
512 show status like 'Mysqlx_connections_accepted';
513 show status like 'Mysqlx_connection_accept_errors';
514 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
515 -->endsql
516
517 -->echo open 3rd xprotocol connection where 2 sessions already opened
518 -->echo this scenario is related to Bug#21374656
519 -->newsession xcon2 -
520 -->peerdisc 1500 1500
521
522 ## switch back to default session
523 -->setsession
524 -->sleep 2
525 -->stmtadmin list_clients
526 -->recvresult client_id user host
527
528 -->sql
529 set @@global.mysqlx_max_connections=3;
530 show status like 'Mysqlx_connections_closed';
531 show status like 'Mysqlx_connections_accepted';
532 show status like 'Mysqlx_connection_accept_errors';
533 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
534 -->endsql
535
536 -->newsession xcon2 xcon2 xcon2
537
538 -->stmtadmin list_clients
539 -->recvresult client_id user host
540
541 -->sql
542 drop user xcon1@localhost;
543 drop user xcon2@localhost;
544 set @@global.mysqlx_max_connections=100;
545 show status like 'Mysqlx_connections_closed';
546 show status like 'Mysqlx_connections_accepted';
547 show status like 'Mysqlx_connection_accept_errors';
548 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
549 -->endsql
550 EOF
551
552 --echo #
553 --echo # Open max allowed connections and expect error for new connections and changes value and connect again,expect success
554 --echo #
555 --exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/allconn_root.xpl 2>&1
556 let $wait_for_status_variable =
557 'Mysqlx_connections_closed', 'Mysqlx_connections_accepted', 'Mysqlx_sessions_closed';
558 let $wait_for_status_value = 6, 6, 6;
559 source ../include/wait_for_status_variables.inc;
560 let $skip_show_mysqlx_sessions_variables=1;
561 source ../include/connection_test_helpers.inc;
562
563 --write_file $MYSQL_TMP_DIR/admin_xkill_parallel.xpl
564 -->echo kill xprotocol session when some operations are going on there using mysqx protocol
565 -->sql
566 create user xcon1@localhost identified by 'xcon1';
567 create user xcon2@localhost identified by 'xcon2';
568 grant all on *.* to xcon2@localhost;
569 SET GLOBAL mysqlx_connect_timeout = 300;
570 -->endsql
571 -->echo Test data
572 -->stmtadmin list_clients
573 -->echo expect Mysqlx.Sql.StmtExecuteOk
574 -->recvresult client_id user host
575
576 -->sql
577 show status like 'Mysqlx_connections_closed';
578 show status like 'Mysqlx_connections_accepted';
579 show status like 'Mysqlx_connection_accept_errors';
580 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
581 -->endsql
582
583 -->echo create and activate new session con1
584 -->newsession xcon1 xcon1 xcon1
585
586 -->sql
587 show status like 'Mysqlx_connections_closed';
588 show status like 'Mysqlx_connections_accepted';
589 show status like 'Mysqlx_connection_accept_errors';
590 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
591 -->endsql
592
593 -->stmtadmin list_clients
594 -->echo expect Mysqlx.Sql.StmtExecuteOk
595 -->recvresult client_id user host
596
597 Mysqlx.Sql.StmtExecute {
598 stmt: "select sleep(100);"
599 }
600
601 -->echo open 3rd xprotocol connection where 2 sessions already opened
602 -->newsession xcon2 xcon2 xcon2
603 -->sql
604 #select ID,USER,COMMAND,STATE from information_schema.processlist order by ID desc;
605 show status like 'Mysqlx_connections_closed';
606 show status like 'Mysqlx_connections_accepted';
607 show status like 'Mysqlx_connection_accept_errors';
608 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
609 -->endsql
610
611 ## switch back to default session
612 -->setsession
613
614 -->stmtadmin list_clients
615 -->recvresult client_id user host
616
617 -->sql
618 show status like 'Mysqlx_connections_closed';
619 show status like 'Mysqlx_connections_accepted';
620 show status like 'Mysqlx_connection_accept_errors';
621 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
622 -->endsql
623
624 -->newsession xcon3 xcon2 xcon2
625
626 -->stmtadmin list_clients
627 -->recvresult client_id user host
628
629
630 -->stmtadmin kill_client {"id":9}
631 -->echo expect Mysqlx.Sql.StmtExecuteOk
632 -->recvresult
633
634 -->setsession xcon1
635 -->recvuntildisc
636
637 # Ensure that all connection disconnected until now
638 # were released. The test must wait for Mysqlx_connections_closed.
639 quiet;
640 noquery_result;
641 -->wait_for 7 SELECT variable_value FROM performance_schema.global_status WHERE variable_name LIKE 'Mysqlx_connections_closed'
642 noquiet;
643 query_result;
644
645 -->stmtadmin list_clients
646 -->recvresult client_id user host
647
648 -->sql
649 drop user xcon1@localhost;
650 drop user xcon2@localhost;
651 show status like 'Mysqlx_connections_closed';
652 show status like 'Mysqlx_connections_accepted';
653 show status like 'Mysqlx_connection_accept_errors';
654 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
655 -->endsql
656 EOF
657
658
659 --write_file $MYSQL_TMP_DIR/open_max_mysql_connection.xpl
660 -->echo open more xconnections than specified max_connections,expect error
661 -->sql
662 create user mysqlcon1@localhost identified by 'mysqlcon1';
663 create user mysqlcon2@localhost identified by 'mysqlcon2';
664 set @@global.max_connections=2;
665 -->endsql
666 -->echo Test data
667 -->stmtadmin list_clients
668 -->echo expect Mysqlx.Sql.StmtExecuteOk
669 -->recvresult client_id user host
670
671 -->echo create and activate new session con1
672 -->newsession con1 mysqlcon1 mysqlcon1
673
674 -->sleep 2
675 -->stmtadmin list_clients
676 -->echo expect Mysqlx.Sql.StmtExecuteOk
677 -->recvresult client_id user host
678
679 -->echo open 3rd xprotocol connection where 2 sessions already opened
680 -->newsession con2 -
681 -->recvtype Mysqlx.Error
682 -->peerdisc 1000 1000
683
684 -->sleep 2
685 -->stmtadmin list_clients
686 -->recvresult client_id user host
687
688 -->sql
689 show status like 'Mysqlx_connections_closed';
690 show status like 'Mysqlx_connections_accepted';
691 show status like 'Mysqlx_connection_accept_errors';
692 set @@global.max_connections=150;
693 #### show status like 'Mysqlx_connection_errors'; Bug #21782329
694 -->endsql
695 EOF
696
697 ##kill xprotocol session when some operations are going on there using mysqx protocol
698 --exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/admin_xkill_parallel.xpl 2>&1
699
700 let $wait_for_status_variable =
701 'Mysqlx_connections_closed', 'Mysqlx_connections_accepted', 'Mysqlx_sessions_closed';
702 let $wait_for_status_value = 10, 10, 10;
703 source ../include/wait_for_status_variables.inc;
704
705 let $skip_show_mysqlx_sessions_variables=1;
706 source ../include/connection_test_helpers.inc;
707
708 ##try open more xconnections than specified max_connections,expect error
709 --exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/open_max_mysql_connection.xpl 2>&1
710
711 --source ../include/xplugin_wait_for_connection_closure.inc
712
713 ##ensure proper error for locked account
714 #TODO move error handling here
715 --exec $MYSQLXTEST -uabc --no-auth --file=$MYSQL_TMP_DIR/mysqlx-connection_locked_user.xpl 2>&1
716
717 --source ../include/xplugin_wait_for_connection_closure.inc
718
719 show status like 'Mysqlx_connections_closed';
720 show status like 'Mysqlx_connections_accepted';
721 show status like 'Mysqlx_connection_accept_errors';
722
723 ## Cleanup
724 --let $restart_parameters = restart:
725 --source include/restart_mysqld.inc
726
727 drop user xplugin@localhost;
728 drop user nonblank@localhost;
729 drop user blank@localhost;
730 drop user abc@localhost;
731 drop user con1@localhost;
732 drop user con2@localhost;
733 drop user mysqlcon1@localhost;
734 drop user mysqlcon2@localhost;
735 drop user ''@localhost;
736 drop user special@localhost;
737 drop user session@localhost;
738
739 SET GLOBAL mysqlx_connect_timeout = DEFAULT;
740 --source ../include/xplugin_cleanup.inc