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/performance_schema_unixsockets.test

## Tests detecting presence of xplugin objects in PERFORMANCE_SCHEMA.

## Preamble
--source include/not_windows.inc
--source ../include/have_performance_schema_threads.inc
--source include/have_perfschema.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]
-->wait_for %EXPECTED_NUM_OF_CONNECTIONS%	SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection'
-->echo  success
-->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 UNIX sockets should be set to '']
-->stmtsql SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' AND LENGTH(IP)=0
-->recvtovar %NUM%
-->assert_eq %CON_COUNTER%	%NUM%

-->echo Verify [Peer ports should be unique]
-->stmtsql SELECT count(*) as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection' AND PORT=0
-->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%
-->noquiet
EOF

--write_file $MYSQL_TMP_DIR/performance_schema_socket_io_stats.tmp
-->macro Verify_increase %VARI% %COLUMN% %EVENT_NAME%
-->quiet
# ENSURE THAT SOCKET STATS WERE INCREMENTED
# BY SENDING DATA TO THE SOCKET
-->stmtsql SELECT 1
-->recvresult be-quiet
#MAKE THE 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%
-->quiet
# ENSURE THAT SOCKET STATS WERE INCREMENTED
# BY SENDING DATA TO THE SOCKET
-->stmtsql SELECT 1
-->recvresult be-quiet
#MAKE THE CHECK
-->stmtsql SELECT %COLUMN% FROM `performance_schema`.%TABLE% WHERE  `EVENT_NAME` LIKE 'wait/io/socket/mysqlx/client_connection'
-->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`
-->callmacro Verify_greater_or_equal	%READ_TIME%	`SUM_TIMER_READ`	`socket_summary_by_instance`
-->callmacro Verify_greater_or_equal	%READ_TIME%	`SUM_TIMER_READ`	`socket_summary_by_instance`
-->callmacro Verify_greater_or_equal	%READ_TIME%	`SUM_TIMER_READ`	`socket_summary_by_instance`

-->varlet %WRITE_TIME% 0
-->callmacro Verify_greater_or_equal	%WRITE_TIME%	`SUM_TIMER_WRITE`	`socket_summary_by_instance`
-->callmacro Verify_greater_or_equal	%WRITE_TIME%	`SUM_TIMER_WRITE`	`socket_summary_by_instance`
-->callmacro Verify_greater_or_equal	%WRITE_TIME%	`SUM_TIMER_WRITE`	`socket_summary_by_instance`
-->callmacro Verify_greater_or_equal	%WRITE_TIME%	`SUM_TIMER_WRITE`	`socket_summary_by_instance`

# Verify `SUM_NUMBER_OF_BYTES_READ` counter on new 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

# Make connection and verify that accept counter was incremented
-->varlet %ACCETP_COUNT% 0
-->repeat 40
-->newsession temporary_connection	root
-->callmacro Verify_increase	%ACCETP_COUNT%	`COUNT_MISC`	'wait/io/socket/mysqlx/unix_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`
EOF

--echo 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 Check the IP and PORT of UNIX socket
--let $XPlugin_ip=   query_get_value(SELECT * FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/unix_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/unix_socket', PORT, 1)

if ($XPlugin_ip != "") {
--echo X Plugin UNIX socket is set to $XPlugin_ip
--die X Plugins UNIX socket should be set to ''
}

--let $XPlugin_port_expected= 0

if ( $XPlugin_port != $XPlugin_port_expected) {
--echo X Plugin UNIX socket port filed is set to $XPlugin_port, was expecting $XPlugin_port_expected
--die X Plugin UNIX sockets port has a wrong value
}

--echo Check if clinet_socket are reported in proper way in PFS
--exec $MYSQLXTEST -uroot --password='' --socket=$MASTER_X_MYSOCK --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='' --socket=$MASTER_X_MYSOCK --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;

Man Man