2006-02-24 17:34:15 +01:00
|
|
|
# This tests not performed with embedded server
|
|
|
|
-- 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
|
|
|
|
2005-10-11 18:12:12 +02:00
|
|
|
#
|
|
|
|
# Bug #8731: wait_timeout does not work on Mac OS X
|
|
|
|
#
|
2006-05-23 15:45:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Connect with another connection and reset counters
|
|
|
|
--disable_query_log
|
|
|
|
connect (wait_con,localhost,root,,test,,);
|
|
|
|
connection wait_con;
|
2006-06-24 13:11:09 +02:00
|
|
|
set session wait_timeout=100;
|
2006-05-23 15:45:16 +02:00
|
|
|
let $retries=300;
|
|
|
|
set @aborted_clients= 0;
|
|
|
|
--enable_query_log
|
|
|
|
|
|
|
|
# Disable reconnect and do the query
|
|
|
|
connection default;
|
2006-07-06 23:49:09 +02:00
|
|
|
# If slow host (Valgrind...), we may have already timed out here.
|
|
|
|
# So force a reconnect if necessary, using a dummy query. And issue a
|
|
|
|
# 'flush status' to reset the 'aborted_clients' counter.
|
|
|
|
--enable_reconnect
|
|
|
|
select 0;
|
|
|
|
flush status;
|
2005-10-11 18:12:12 +02:00
|
|
|
--disable_reconnect
|
|
|
|
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
|
|
|
|
connection wait_con;
|
|
|
|
while (!`select @aborted_clients`)
|
|
|
|
{
|
|
|
|
sleep 0.1;
|
|
|
|
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
|
|
|
|
eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
|
|
|
|
|
|
|
|
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
|
|
|
|
sleep 1;
|
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
|
|
|
|
# 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
|
2005-10-11 18:12:12 +02:00
|
|
|
select 2;
|
|
|
|
--enable_reconnect
|
|
|
|
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.
|
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
|
2006-05-23 15:45:16 +02:00
|
|
|
# (which we get by specifying a ip adress)
|
|
|
|
|
|
|
|
# Connect with another connection and reset counters
|
|
|
|
--disable_query_log
|
|
|
|
connection wait_con;
|
|
|
|
flush status; # Reset counters
|
|
|
|
let $retries=300;
|
|
|
|
set @aborted_clients= 0;
|
|
|
|
--enable_query_log
|
|
|
|
|
2006-02-16 12:02:38 +01:00
|
|
|
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
|
|
|
--disable_reconnect
|
|
|
|
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
|
|
|
|
connection wait_con;
|
|
|
|
while (!`select @aborted_clients`)
|
|
|
|
{
|
|
|
|
sleep 0.1;
|
|
|
|
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
|
|
|
|
eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
|
|
|
|
|
|
|
|
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
|
|
|
|
sleep 1;
|
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
|
|
|
|
# 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
|
2006-02-16 12:02:38 +01:00
|
|
|
select 2;
|
|
|
|
--enable_reconnect
|
|
|
|
select 3;
|
|
|
|
disconnect con1;
|