/usr/lib/mysql-testsuite/t/wait_timeout.test is in mysql-testsuite-5.6 5.6.16-1~exp1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | # Last modification:
# 2009-01-19 H.Hunger Fix Bug#39108 main.wait_timeout fails sporadically
# - Increase wait timeout to 2 seconds
# - Eliminated the corresponding opt file,
# set global wait timeout within the test.
# - Replaced sleeps by wait condition
# - Minor improvements
###############################################################################
# These tests cannot run with the embedded server
-- source include/not_embedded.inc
-- source include/one_thread_per_connection.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Bug#8731 wait_timeout does not work on Mac OS X
#
let $start_value= `SELECT @@global.wait_timeout`;
SET @@global.wait_timeout= 2;
--echo disconnect default;
disconnect default;
# Connect with another connection and reset counters
--disable_query_log
connect (wait_con,localhost,root,,test,,);
--echo connection wait_con;
connection wait_con;
SET SESSION wait_timeout=100;
let $retries=300;
SET @aborted_clients= 0;
--enable_query_log
# Disable reconnect and do the query
connect (default,localhost,root,,test,,);
--echo connection default;
connection default;
--echo --disable_reconnect;
--disable_reconnect
SELECT 1;
# Switch to wait_con and wait until server has aborted the connection
--disable_query_log
--echo connection wait_con;
connection wait_con;
while (!`select @aborted_clients`)
{
real_sleep 0.1;
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
dec $retries;
if (!$retries)
{
die Failed to detect that client has been aborted;
}
}
--enable_query_log
# The server has disconnected, add small sleep to make sure
# the disconnect has reached client
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
--source include/wait_condition.inc
--echo connection default;
connection default;
# When the connection is closed in this way, the error code should
# be consistent see Bug#2845 for an explanation
# depending on platform/client, either errno 2006 or 2013 can occur below
--error 2006,2013
SELECT 2;
--echo --enable_reconnect;
--enable_reconnect
SELECT 3;
# Disconnect so that we will not be confused by a future abort from this
# connection.
--echo disconnection default;
disconnect default;
#
# Do the same test as above on a TCP connection
# (which we get by specifying an ip adress)
# Connect with another connection and reset counters
--disable_query_log
--echo connection wait_con;
connection wait_con;
FLUSH STATUS; # Reset counters
let $retries=300;
SET @aborted_clients= 0;
--enable_query_log
--echo connection con1;
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
--echo --disable_reconnect;
--disable_reconnect
SELECT 1;
# Switch to wait_con and wait until server has aborted the connection
--disable_query_log
--echo connection wait_con;
connection wait_con;
while (!`select @aborted_clients`)
{
real_sleep 0.1;
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
dec $retries;
if (!$retries)
{
die Failed to detect that client has been aborted;
}
}
--enable_query_log
# The server has disconnected, add small sleep to make sure
# the disconnect has reached client
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
--source include/wait_condition.inc
disconnect wait_con;
--echo connection con1;
connection con1;
# When the connection is closed in this way, the error code should
# be consistent see Bug#2845 for an explanation
# depending on platform/client, either errno 2006 or 2013 can occur below
--error 2006,2013
SELECT 2;
--echo --enable_reconnect;
--enable_reconnect
SELECT 3;
--replace_result $start_value <start_value>
eval SET @@global.wait_timeout= $start_value;
--echo disconnection con1;
disconnect con1;
# The last connect is to keep tools checking the current test happy.
connect (default,localhost,root,,test,,);
--echo #
--echo # Bug#54790: Use of non-blocking mode for sockets limits performance
--echo #
--echo #
--echo # Test UNIX domain sockets timeout.
--echo #
--echo # Open con1 and set a timeout.
connect(con1,localhost,root,,);
LET $ID= `SELECT connection_id()`;
SET @@SESSION.wait_timeout = 2;
--echo # Wait for con1 to be disconnected.
connection default;
let $wait_condition=
SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID = $ID;
--source include/wait_condition.inc
--echo # Check that con1 has been disconnected.
connection con1;
--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR
--error 2006,2013
SELECT 1;
disconnect con1;
connection default;
--echo #
--echo # Test TCP/IP sockets timeout.
--echo #
--echo # Open con1 and set a timeout.
connect(con1,127.0.0.1,root,,);
LET $ID= `SELECT connection_id()`;
SET @@SESSION.wait_timeout = 2;
--echo # Wait for con1 to be disconnected.
connection default;
let $wait_condition=
SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID = $ID;
--source include/wait_condition.inc
--echo # Check that con1 has been disconnected.
connection con1;
--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR
--error 2006,2013
SELECT 1;
disconnect con1;
connection default;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
|