2009-01-23 18:19:09 +01:00
|
|
|
# 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
|
2006-02-24 17:34:15 +01:00
|
|
|
-- source include/not_embedded.inc
|
2007-02-23 12:13:55 +01:00
|
|
|
-- source include/one_thread_per_connection.inc
|
2006-02-24 17:34:15 +01:00
|
|
|
|
2009-03-06 15:56:17 +01:00
|
|
|
# Save the initial number of concurrent sessions
|
|
|
|
--source include/count_sessions.inc
|
2006-02-24 17:34:15 +01:00
|
|
|
|
2005-10-11 18:12:12 +02:00
|
|
|
#
|
2009-03-03 21:34:18 +01:00
|
|
|
# Bug#8731 wait_timeout does not work on Mac OS X
|
2005-10-11 18:12:12 +02:00
|
|
|
#
|
2006-05-23 15:45:16 +02:00
|
|
|
|
2009-01-23 18:19:09 +01:00
|
|
|
let $start_value= `SELECT @@global.wait_timeout`;
|
|
|
|
SET @@global.wait_timeout= 2;
|
|
|
|
--echo disconnect default;
|
|
|
|
disconnect default;
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
# Connect with another connection and reset counters
|
|
|
|
--disable_query_log
|
|
|
|
connect (wait_con,localhost,root,,test,,);
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo connection wait_con;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection wait_con;
|
2009-01-23 18:19:09 +01:00
|
|
|
SET SESSION wait_timeout=100;
|
2006-05-23 15:45:16 +02:00
|
|
|
let $retries=300;
|
2009-01-23 18:19:09 +01:00
|
|
|
SET @aborted_clients= 0;
|
2006-05-23 15:45:16 +02:00
|
|
|
--enable_query_log
|
|
|
|
|
|
|
|
# Disable reconnect and do the query
|
2009-01-23 18:19:09 +01:00
|
|
|
connect (default,localhost,root,,test,,);
|
|
|
|
--echo connection default;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection default;
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo --disable_reconnect;
|
2005-10-11 18:12:12 +02:00
|
|
|
--disable_reconnect
|
2009-01-23 18:19:09 +01:00
|
|
|
SELECT 1;
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
# Switch to wait_con and wait until server has aborted the connection
|
|
|
|
--disable_query_log
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo connection wait_con;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection wait_con;
|
|
|
|
while (!`select @aborted_clients`)
|
|
|
|
{
|
2009-01-23 18:19:09 +01:00
|
|
|
real_sleep 0.1;
|
2006-05-23 15:45:16 +02:00
|
|
|
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
|
2009-01-23 18:19:09 +01:00
|
|
|
eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
dec $retries;
|
|
|
|
if (!$retries)
|
|
|
|
{
|
|
|
|
Failed to detect that client has been aborted;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--enable_query_log
|
2006-06-15 22:22:59 +02:00
|
|
|
# The server has disconnected, add small sleep to make sure
|
|
|
|
# the disconnect has reached client
|
2009-01-23 18:19:09 +01:00
|
|
|
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
|
|
|
|
--source include/wait_condition.inc
|
|
|
|
--echo connection default;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection default;
|
2006-02-16 12:02:38 +01:00
|
|
|
# When the connection is closed in this way, the error code should
|
2009-01-23 18:19:09 +01:00
|
|
|
# be consistent see Bug#2845 for an explanation
|
2007-01-10 15:55:53 +01:00
|
|
|
# depending on platform/client, either errno 2006 or 2013 can occur below
|
|
|
|
--error 2006,2013
|
2009-01-23 18:19:09 +01:00
|
|
|
SELECT 2;
|
|
|
|
--echo --enable_reconnect;
|
2005-10-11 18:12:12 +02:00
|
|
|
--enable_reconnect
|
2009-01-23 18:19:09 +01:00
|
|
|
SELECT 3;
|
2006-07-06 23:49:09 +02:00
|
|
|
# Disconnect so that we will not be confused by a future abort from this
|
|
|
|
# connection.
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo disconnection default;
|
2006-07-29 13:03:17 +02:00
|
|
|
disconnect default;
|
2006-02-16 12:02:38 +01:00
|
|
|
|
2006-05-23 15:45:16 +02:00
|
|
|
#
|
2006-02-16 12:02:38 +01:00
|
|
|
# Do the same test as above on a TCP connection
|
2009-01-23 18:19:09 +01:00
|
|
|
# (which we get by specifying an ip adress)
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
# Connect with another connection and reset counters
|
|
|
|
--disable_query_log
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo connection wait_con;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection wait_con;
|
2009-01-23 18:19:09 +01:00
|
|
|
FLUSH STATUS; # Reset counters
|
2006-05-23 15:45:16 +02:00
|
|
|
let $retries=300;
|
2009-01-23 18:19:09 +01:00
|
|
|
SET @aborted_clients= 0;
|
2006-05-23 15:45:16 +02:00
|
|
|
--enable_query_log
|
|
|
|
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo connection con1;
|
2006-02-16 12:02:38 +01:00
|
|
|
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo --disable_reconnect;
|
2006-02-16 12:02:38 +01:00
|
|
|
--disable_reconnect
|
2009-01-23 18:19:09 +01:00
|
|
|
SELECT 1;
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
# Switch to wait_con and wait until server has aborted the connection
|
|
|
|
--disable_query_log
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo connection wait_con;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection wait_con;
|
|
|
|
while (!`select @aborted_clients`)
|
|
|
|
{
|
2009-01-23 18:19:09 +01:00
|
|
|
real_sleep 0.1;
|
2006-05-23 15:45:16 +02:00
|
|
|
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
|
2009-01-23 18:19:09 +01:00
|
|
|
eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
dec $retries;
|
|
|
|
if (!$retries)
|
|
|
|
{
|
|
|
|
Failed to detect that client has been aborted;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--enable_query_log
|
2006-06-15 22:22:59 +02:00
|
|
|
# The server has disconnected, add small sleep to make sure
|
|
|
|
# the disconnect has reached client
|
2009-01-23 18:19:09 +01:00
|
|
|
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
|
|
|
|
--source include/wait_condition.inc
|
2009-03-03 21:34:18 +01:00
|
|
|
disconnect wait_con;
|
2006-05-23 15:45:16 +02:00
|
|
|
|
2009-01-23 18:19:09 +01:00
|
|
|
--echo connection con1;
|
2006-05-23 15:45:16 +02:00
|
|
|
connection con1;
|
2006-02-16 12:02:38 +01:00
|
|
|
# When the connection is closed in this way, the error code should
|
2009-01-23 18:19:09 +01:00
|
|
|
# be consistent see Bug#2845 for an explanation
|
2007-01-10 15:55:53 +01:00
|
|
|
# depending on platform/client, either errno 2006 or 2013 can occur below
|
|
|
|
--error 2006,2013
|
2009-01-23 18:19:09 +01:00
|
|
|
SELECT 2;
|
|
|
|
--echo --enable_reconnect;
|
2006-02-16 12:02:38 +01:00
|
|
|
--enable_reconnect
|
2009-01-23 18:19:09 +01:00
|
|
|
SELECT 3;
|
|
|
|
--replace_result $start_value <start_value>
|
|
|
|
eval SET @@global.wait_timeout= $start_value;
|
|
|
|
--echo disconnection con1;
|
2006-02-16 12:02:38 +01:00
|
|
|
disconnect con1;
|
2009-01-23 18:19:09 +01:00
|
|
|
|
|
|
|
|
2009-03-03 21:34:18 +01:00
|
|
|
# The last connect is to keep tools checking the current test happy.
|
|
|
|
connect (default,localhost,root,,test,,);
|
2009-03-06 15:56:17 +01:00
|
|
|
|
|
|
|
# Wait till all disconnects are completed
|
|
|
|
--source include/wait_until_count_sessions.inc
|
|
|
|
|