diff options
author | Horst Hunger <horst@mysql.com> | 2009-01-23 18:19:09 +0100 |
---|---|---|
committer | Horst Hunger <horst@mysql.com> | 2009-01-23 18:19:09 +0100 |
commit | d574142888071b617087fc680151d51b89d5df48 (patch) | |
tree | d174ff430ef7f2b4441dec277647e56ea3809b39 | |
parent | 47bd8d19fd9a6eb8d6a314452db4a916a84adae9 (diff) | |
download | mariadb-git-d574142888071b617087fc680151d51b89d5df48.tar.gz |
Fix for bug#39108: Set global wait timeout within the test, not more via opt file.
Deleted the opt file. Replaced the sleeps by wait condition. Made some beautyfications.
Inserted review results.
-rw-r--r-- | mysql-test/r/wait_timeout.result | 33 | ||||
-rw-r--r-- | mysql-test/t/wait_timeout-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/wait_timeout.test | 83 |
3 files changed, 78 insertions, 39 deletions
diff --git a/mysql-test/r/wait_timeout.result b/mysql-test/r/wait_timeout.result index 6fbff82f908..adb7d6bafd9 100644 --- a/mysql-test/r/wait_timeout.result +++ b/mysql-test/r/wait_timeout.result @@ -1,20 +1,33 @@ -select 0; -0 -0 -flush status; -select 1; +SET @@global.wait_timeout= 2; +disconnect default; +connection wait_con; +connection default; +--disable_reconnect; +SELECT 1; 1 1 -select 2; +connection wait_con; +connection default; +SELECT 2; Got one of the listed errors -select 3; +--enable_reconnect; +SELECT 3; 3 3 -select 1; +disconnection default; +connection wait_con; +connection con1; +--disable_reconnect; +SELECT 1; 1 1 -select 2; +connection wait_con; +connection con1; +SELECT 2; Got one of the listed errors -select 3; +--enable_reconnect; +SELECT 3; 3 3 +SET @@global.wait_timeout= <start_value>; +disconnection con1; diff --git a/mysql-test/t/wait_timeout-master.opt b/mysql-test/t/wait_timeout-master.opt deleted file mode 100644 index 9e5c2289eb2..00000000000 --- a/mysql-test/t/wait_timeout-master.opt +++ /dev/null @@ -1 +0,0 @@ ---wait-timeout=1 diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test index 255947fa79f..63809252a01 100644 --- a/mysql-test/t/wait_timeout.test +++ b/mysql-test/t/wait_timeout.test @@ -1,40 +1,51 @@ -# This tests not performed with embedded server +# 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 # -# Bug #8731: wait_timeout does not work on Mac OS X +# 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; +SET SESSION wait_timeout=100; let $retries=300; -set @aborted_clients= 0; +SET @aborted_clients= 0; --enable_query_log # Disable reconnect and do the query +connect (default,localhost,root,,test,,); +--echo connection default; connection default; -# 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; +--echo --disable_reconnect; --disable_reconnect -select 1; +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`) { - sleep 0.1; + real_sleep 0.1; let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`; - eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0; + eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0; dec $retries; if (!$retries) @@ -45,44 +56,51 @@ while (!`select @aborted_clients`) --enable_query_log # The server has disconnected, add small sleep to make sure # the disconnect has reached client -sleep 1; - +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 +# 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; +SELECT 2; +--echo --enable_reconnect; --enable_reconnect -select 3; +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 a ip adress) +# (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 +FLUSH STATUS; # Reset counters let $retries=300; -set @aborted_clients= 0; +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; +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`) { - sleep 0.1; + real_sleep 0.1; let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`; - eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0; + eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0; dec $retries; if (!$retries) @@ -93,14 +111,23 @@ while (!`select @aborted_clients`) --enable_query_log # The server has disconnected, add small sleep to make sure # the disconnect has reached client -sleep 1; +let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist; +--source include/wait_condition.inc +--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 +# 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; +SELECT 2; +--echo --enable_reconnect; --enable_reconnect -select 3; +SELECT 3; +--replace_result $start_value <start_value> +eval SET @@global.wait_timeout= $start_value; +# ML: The start value might be changed in future ... +--echo disconnection con1; disconnect con1; + + |