1--source ../include/is_local_machine.inc
2
3--echo Preamble
4--source ../include/xplugin_preamble.inc
5--sleep 1
6SHOW VARIABLES LIKE 'mysqlx_connect_timeout';
7show status like 'Mysqlx_conn%';
8
9--write_file $MYSQL_TMP_DIR/mysqlx-idle-disconnect.tmp
10-->peerdisc 4000 800
11EOF
12
13--write_file $MYSQL_TMP_DIR/mysqlx-idle-disconnect-no-prolong.tmp
14-->newsession idle_session	-
15-->measure
16-->sleep 2
17-->noquery_result
18Mysqlx.Connection.CapabilitiesGet {
19}
20-->recvtype Mysqlx.Connection.Capabilities
21-->query_result
22
23# lets give maximum tolerance for disconnecting
24# this is going to be verified at endmesasure !
25-->peerdisc 2000 2000
26
27# 4000 sum of peerdisc and sleep
28-->endmeasure 4000 800
29EOF
30
31--write_file $MYSQL_TMP_DIR/mysqlx-idle-no-disconnect-after-auth.tmp
32-->sleep 3
33-->stmtadmin ping
34-->recvresult
35-->sleep 3
36-->stmtadmin ping
37-->recvresult
38EOF
39
40--write_file $MYSQL_TMP_DIR/mysqlx-reset-session-after-auth.tmp
41-->sleep 6
42-->stmtadmin ping
43-->recvresult
44##timer should get restarted here
45Mysqlx.Session.Reset {
46}
47-->recv
48-->sleep 5
49-->login root
50-->stmtadmin ping
51-->recvresult
52#timer should get restarted here
53Mysqlx.Session.Reset {
54}
55-->recv
56-->login root
57EOF
58
59SET GLOBAL mysqlx_connect_timeout = 4;
60show status like 'Mysqlx_conn%';
61--echo Disconnect user on idle connection after timeout
62--exec $MYSQLXTEST -u root --password='' -h127.0.0.1 --no-auth --file=$MYSQL_TMP_DIR/mysqlx-idle-disconnect.tmp 2>&1
63
64--echo Disconnect user without session after timeout
65--exec $MYSQLXTEST -u root --password='' -h127.0.0.1 --file=$MYSQL_TMP_DIR/mysqlx-idle-disconnect-no-prolong.tmp 2>&1
66
67--echo Inactivity timer disabled after session setup (commands executed after 1s should be processed)
68--exec $MYSQLXTEST -u root --password='' -h127.0.0.1 --file=$MYSQL_TMP_DIR/mysqlx-idle-no-disconnect-after-auth.tmp 2>&1
69
70--echo Disconnect user on idle connection after new timeout
71--remove_file $MYSQL_TMP_DIR/mysqlx-idle-disconnect.tmp
72--write_file $MYSQL_TMP_DIR/mysqlx-idle-disconnect.tmp
73-->peerdisc 2000
74EOF
75
76SET GLOBAL mysqlx_connect_timeout = 2;
77show status like 'Mysqlx_conn%';
78--exec $MYSQLXTEST -u root --password='' -h127.0.0.1 --no-auth --file=$MYSQL_TMP_DIR/mysqlx-idle-disconnect.tmp 2>&1
79
80SET GLOBAL mysqlx_connect_timeout = 4;
81--echo Inactivity timer restarted with Session.Reset Message
82--exec $MYSQLXTEST -u root --password='' -h127.0.0.1 --file=$MYSQL_TMP_DIR/mysqlx-reset-session-after-auth.tmp 2>&1
83
84
85--echo Cleanup
86--sleep 1
87SET GLOBAL mysqlx_connect_timeout = 300;
88show status like 'Mysqlx_conn%';
89UNINSTALL PLUGIN mysqlx;
90
91--remove_file $MYSQL_TMP_DIR/mysqlx-idle-disconnect.tmp
92--remove_file $MYSQL_TMP_DIR/mysqlx-idle-disconnect-no-prolong.tmp
93--remove_file $MYSQL_TMP_DIR/mysqlx-idle-no-disconnect-after-auth.tmp
94--remove_file $MYSQL_TMP_DIR/mysqlx-reset-session-after-auth.tmp
95