config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/suite/x/t/killconnection.test

## This is test file for connection authentication using mysqlx.
##
--source include/restart_mysqld.inc

--replace_regex /localhost:[0-9]*/localhost/

--sleep 2
--source ../include/xplugin_preamble.inc
call mtr.add_suppression("Plugin mysqlx reported: '3.1: Unhandled message of type 12'");
call mtr.add_suppression("Plugin mysqlx reported: '4.1: Unhandled message of type 12'");
call mtr.add_suppression("Plugin mysqlx reported: '5.1: Unhandled message of type 12'");


## Test starts here
--write_file $MYSQL_TMP_DIR/mysqlx-connection.tmp
-->sql
create user killsession@localhost identified by 'killsession';
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
EOF

--write_file $MYSQL_TMP_DIR/mysqlx-connection_current_user.tmp
-->sql
select user(),current_user(),@@bind_address;
-->endsql
EOF

--write_file $MYSQL_TMP_DIR/mysqlx-connection.processlist.tmp
-->fatalerrors
-->sql
set @current := connection_id();
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
kill %MYSQLTEST_CONNECTION_ID%;
select sleep(1);
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
-->expecterror ER_QUERY_INTERRUPTED
-->sql
kill @current;
-->endsql
EOF

--write_file $MYSQL_TMP_DIR/mysqlx-connection_killiunprivileged.tmp
-->sql
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
-->expecterror ER_KILL_DENIED_ERROR
-->sql
kill %MYSQLTEST_CONNECTION_ID%;
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
EOF

--write_file $MYSQL_TMP_DIR/mysqlx-connection_killmysqlxsession.tmp
-->fatalerrors
-->sql
set @current := connection_id();
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
-->expecterror ER_QUERY_INTERRUPTED
-->sql
kill @current;
-->endsql
EOF

--write_file $MYSQL_TMP_DIR/mysqlx-connection_killinvalid.tmp
-->fatalerrors
-->sql
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
-->expecterror ER_NO_SUCH_THREAD
-->sql
kill 5126;
select USER,COMMAND,STATE from information_schema.processlist order by ID desc;
-->endsql
EOF


--replace_regex /localhost:[0-9]*/localhost/ /Execute/Query/
--exec $MYSQLXTEST -u root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection.tmp 2>&1

###try killing with unprivileged user both mysqlx and mysql session ids using mysqlx protocol
###processlist should show the current session info even privileges are minimal
let $MYSQLTEST_CONNID_1=`select connection_id()`;
--replace_regex /localhost:[0-9]*/localhost/ /kill [0-9]+/kill $CONNECTION_ID/ /thread [0-9]+/thread $CONNECTION_ID/
--exec $MYSQLXTEST -u killsession --password='killsession' --file=$MYSQL_TMP_DIR/mysqlx-connection_killiunprivileged.tmp -v%MYSQLTEST_CONNECTION_ID%=$MYSQLTEST_CONNID_1 2>&1

###try killing sessionid which doesn't exists when mysqlxplugin installed using mysqlx protocol
###show processlist returns 0 rows effected even more rows are returned Bug#21392187
--replace_regex /localhost:[0-9]*/localhost/ /Execute/Query/
--exec $MYSQLXTEST -u root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection_killinvalid.tmp 2>&1

--connect(con1,localhost,root,,)
let $MYSQLTEST_CONNID_2=`select connection_id()`;
###try killing both mysqlx and mysql session ids using mysqlx protocol (expect error from getting killed)
--let $expected_error_line= 13
--let $expected_error_msg= MySQL server has gone away \(code 2006\)
--let $expected_error_extra= /localhost:[0-9]*/localhost/ /kill [0-9]+/kill CONNECTION_ID/ /Execute/Query/
--source ../include/mysqlxtest_expected_error.inc
--exec $MYSQLXTEST -u root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection.processlist.tmp -v%MYSQLTEST_CONNECTION_ID%=$MYSQLTEST_CONNID_2 2>&1

###kill mysqlx protocol session using mysqlx protocol when mysqlxplugin installed (expect error again)
--let $expected_error_line= 10
--let $expected_error_msg= MySQL server has gone away \(code 2006\)
--let $expected_error_extra= /localhost:[0-9]*/localhost/ /Execute/Query/
--source ../include/mysqlxtest_expected_error.inc
--exec $MYSQLXTEST -u root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection_killmysqlxsession.tmp 2>&1

##todo: ensure that after client disconnection last session was destroyed
--sleep 1
--connection default
##expect Mysqlx_sessions_fatal_error incremented when killing its own session
show status like 'Mysqlx_sessions%';
--remove_file $MYSQL_TMP_DIR/mysqlx-connection_current_user.tmp
--remove_file $MYSQL_TMP_DIR/mysqlx-connection.tmp
--remove_file $MYSQL_TMP_DIR/mysqlx-connection_killinvalid.tmp
--remove_file $MYSQL_TMP_DIR/mysqlx-connection_killmysqlxsession.tmp
--remove_file $MYSQL_TMP_DIR/mysqlx-connection.processlist.tmp
--remove_file $MYSQL_TMP_DIR/mysqlx-connection_killiunprivileged.tmp

##cleanup
drop user killsession@localhost;
uninstall plugin mysqlx;

Man Man