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 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/t/performance_schema_sockets.test |
## Tests detecting presence of xplugin objects in PERFORMANCE_SCHEMA. ## Preamble --source ../include/have_performance_schema_threads.inc --source ../include/xplugin_preamble.inc # Tests --write_file $MYSQL_TMP_DIR/performance_schema_socket_num.tmp -->quiet -->macro check_xconnection_count %EXPECTED_NUM_OF_CONNECTIONS% -->echo Verify [Checking if X Plugin reports %EXPECTED_NUM_OF_CONNECTIONS% connections] -->stmtsql SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' -->recvtovar %NUM% -->assert_eq %EXPECTED_NUM_OF_CONNECTIONS% %NUM% -->endmacro -->varlet %CON_COUNTER% 1 -->callmacro check_xconnection_count %CON_COUNTER% -->repeat 10 -->varinc %CON_COUNTER% 1 -->newsession NAME_%CON_COUNTER% root -->callmacro check_xconnection_count %CON_COUNTER% -->endrepeat -->echo Verify [Peer addresses of all sockets should be set to ::ffff:127.0.0.1] -->stmtsql SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' AND IP='::ffff:127.0.0.1' -->recvtovar %NUM% -->assert_eq %CON_COUNTER% %NUM% -->echo Verify [Peer ports should be unique] -->stmtsql SELECT COUNT(*) FROM (SELECT `PORT` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' AND IP='::ffff:127.0.0.1' GROUP BY `PORT`) as `temp_table` -->recvtovar %NUM% -->assert_eq %CON_COUNTER% %NUM% # Synchronize with X Plugin -->wait_for 1 SELECT 1 FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' AND `STATE` = 'IDLE' -->echo Check if we have connection ACTIVE and IDLE state -->stmtsql SELECT `STATE` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' GROUP BY `STATE` ORDER BY `STATE` -->recvresult -->repeat 10 -->setsession NAME_%CON_COUNTER% -->closesession -->varinc %CON_COUNTER% -1 -->endrepeat -->setsession -->callmacro check_xconnection_count %CON_COUNTER% -->query_result -->noquiet EOF --write_file $MYSQL_TMP_DIR/performance_schema_socket_io_stats.tmp -->macro Verify_increase %VARI% %COLUMN% %EVENT_NAME% # Kick client socket counters -->quiet -->stmtsql SELECT 1 -->recvresult be-quiet # Check # Get %COLUMN% counter at latest created connection (`OBJECT_INSTANCE_BEGIN`) -->stmtsql SELECT %COLUMN% FROM `performance_schema`.`socket_summary_by_instance` WHERE `EVENT_NAME` LIKE %EVENT_NAME% and OBJECT_INSTANCE_BEGIN IN (SELECT MAX(OBJECT_INSTANCE_BEGIN) FROM `performance_schema`.`socket_summary_by_instance` WHERE `EVENT_NAME` LIKE %EVENT_NAME%); -->recvtovar %TMP% -->echo Verify [Checking if data in column %COLUMN% had increased] -->assert_gt %TMP% %VARI% -->varlet %VARI% %TMP% -->noquiet -->endmacro # This function doesn't get latest entry ! -->macro Verify_greater_or_equal %VARI% %COLUMN% %TABLE% %EVENT_NAME% #Kick client socket counters -->quiet -->stmtsql SELECT 1 -->recvresult be-quiet #MAKE THE CHECK -->stmtsql SELECT %COLUMN% FROM `performance_schema`.%TABLE% WHERE `EVENT_NAME` LIKE %EVENT_NAME% -->recvtovar %TMP% -->echo Verify [Checking if data in column %COLUMN% had increased] -->assert_ge %TMP% %VARI% -->varlet %VARI% %TMP% -->noquiet -->endmacro -->varlet %READ_CNT% 0 -->callmacro Verify_increase %READ_CNT% `COUNT_READ` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %READ_CNT% `COUNT_READ` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %READ_CNT% `COUNT_READ` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %READ_CNT% `COUNT_READ` 'wait/io/socket/mysqlx/client_connection' -->varlet %WRITE_CNT% 0 -->callmacro Verify_increase %WRITE_CNT% `COUNT_WRITE` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %WRITE_CNT% `COUNT_WRITE` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %WRITE_CNT% `COUNT_WRITE` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %WRITE_CNT% `COUNT_WRITE` 'wait/io/socket/mysqlx/client_connection' -->varlet %READ_BYTES1% 0 -->callmacro Verify_increase %READ_BYTES1% `SUM_NUMBER_OF_BYTES_READ` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %READ_BYTES1% `SUM_NUMBER_OF_BYTES_READ` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %READ_BYTES1% `SUM_NUMBER_OF_BYTES_READ` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %READ_BYTES1% `SUM_NUMBER_OF_BYTES_READ` 'wait/io/socket/mysqlx/client_connection' -->varlet %WRITE_BYTES% 0 -->callmacro Verify_increase %WRITE_BYTES% `SUM_NUMBER_OF_BYTES_WRITE` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %WRITE_BYTES% `SUM_NUMBER_OF_BYTES_WRITE` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %WRITE_BYTES% `SUM_NUMBER_OF_BYTES_WRITE` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_increase %WRITE_BYTES% `SUM_NUMBER_OF_BYTES_WRITE` 'wait/io/socket/mysqlx/client_connection' -->varlet %READ_TIME% 0 -->callmacro Verify_greater_or_equal %READ_TIME% `SUM_TIMER_READ` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_greater_or_equal %READ_TIME% `SUM_TIMER_READ` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_greater_or_equal %READ_TIME% `SUM_TIMER_READ` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_greater_or_equal %READ_TIME% `SUM_TIMER_READ` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->varlet %WRITE_TIME% 0 -->callmacro Verify_greater_or_equal %WRITE_TIME% `SUM_TIMER_WRITE` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_greater_or_equal %WRITE_TIME% `SUM_TIMER_WRITE` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_greater_or_equal %WRITE_TIME% `SUM_TIMER_WRITE` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->callmacro Verify_greater_or_equal %WRITE_TIME% `SUM_TIMER_WRITE` `socket_summary_by_instance` 'wait/io/socket/mysqlx/client_connection' -->newsession second_session root -->varlet %READ_BYTES2% 0 -->repeat 40 -->callmacro Verify_increase %READ_BYTES2% `SUM_NUMBER_OF_BYTES_READ` 'wait/io/socket/mysqlx/client_connection' -->endrepeat -->varlet %ACCETP_COUNT% 0 -->repeat 40 -->newsession temporary_connection root -->callmacro Verify_increase %ACCETP_COUNT% `COUNT_MISC` 'wait/io/socket/mysqlx/tcpip_socket' -->closesession -->endrepeat -->varlet %READ_BYTES% 0 -->varinc %READ_BYTES% %READ_BYTES1% -->varinc %READ_BYTES% %READ_BYTES2% -->echo Verify summary table -->callmacro Verify_greater_or_equal %READ_BYTES% `SUM_NUMBER_OF_BYTES_READ` `socket_summary_by_event_name` 'wait/io/socket/mysqlx/client_connection' EOF --echo Verify [No socket from X Plugin should be reported] --let $XPlugin_socket_count_when_no_Xconnection= query_get_value(SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection', Num, 1) if ( $XPlugin_socket_count_when_no_Xconnection != 0) { --echo got $XPlugin_socket_count_when_no_Xconnection active connections --die Reported size should be zero } --echo Verify [Check the IP and PORT of TCP socket] --let $XPlugin_ip= query_get_value(SELECT * FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/tcpip_socket' and STATE='ACTIVE', IP, 1) --let $XPlugin_port= query_get_value(SELECT * FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/tcpip_socket', PORT, 1) if ($XPlugin_ip != "::") { --echo X Plugin IP is set to $XPlugin_ip --die X Plugins TCP server IP should be set to :: } --let $XPlugin_port_expected= query_get_value(SELECT @@mysqlx_port as value, value, 1) if ( $XPlugin_port != $XPlugin_port_expected) { --echo X Plugin tcp-port is set to $XPlugin_port, was expecting $XPlugin_port_expected --die X Plugins TCP server port has a wrong value } --echo Check if clinet_socket are reported in proper way in PFS --exec $MYSQLXTEST -uroot --password='' --file=$MYSQL_TMP_DIR/performance_schema_socket_num.tmp 2>&1 --echo No socket should be reported by X Plugin let $wait_condition= SELECT count(*)= 0 as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection'; --source include/wait_condition_or_abort.inc --exec $MYSQLXTEST -uroot --password='' --file=$MYSQL_TMP_DIR/performance_schema_socket_io_stats.tmp 2>&1 ## Cleanup --remove_file $MYSQL_TMP_DIR/performance_schema_socket_num.tmp --remove_file $MYSQL_TMP_DIR/performance_schema_socket_io_stats.tmp ## Postamble UNINSTALL PLUGIN mysqlx;