Commit caf29020 authored by Horst Hunger's avatar Horst Hunger

Fix for bug#36873 containing the review results.

parent c720394e
drop table if exists t1; SET @start_value= @@global.wait_timeout;
## Creating new table t1 ##
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name VARCHAR(30)
);
'#--------------------FN_DYNVARS_186_01-------------------------#' '#--------------------FN_DYNVARS_186_01-------------------------#'
## Creating new connection test_con1 ## SET @start_time= UNIX_TIMESTAMP();
## Setting value of variable to 5 ## connect (test_con1, localhost, root,,);
SET @@session.wait_timeout = 5; SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
## Inserting record in table t1 ## Expect 1
INSERT into t1(name) values('Record_1'); 1
## Using sleep to check timeout ## SET @@session.wait_timeout = <session_value>;
'#--------------------FN_DYNVARS_186_02-------------------------#' connect (test_con2, localhost, root,,);
## Setting value of variable ## SET @@session.wait_timeout = <session_value> - 1;
SET @@global.wait_timeout = 5; connection default;
## Creating new connection test_con2 ## wait until connections ready
INSERT into t1(name) values('Record_2'); SELECT info FROM information_schema.processlist;
## Using sleep to check timeout ## info
SELECT info FROM information_schema.processlist
'#--------------------FN_DYNVARS_186_03-------------------------#' '#--------------------FN_DYNVARS_186_03-------------------------#'
## Setting value of variable to 1 ## SET @@global.wait_timeout= <global_value>;
SET @@global.wait_timeout = 1; SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
## Creating new connection ## Expect 1
INSERT into t1(name) values('Record_3'); 1
## Using sleep to check timeout ## connect (test_con3, localhost, root,,);
## We cannot test it further because the server stops due to wait_timeout ## SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
SELECT * from t1; Expect 1
ERROR HY000: MySQL server has gone away 1
connection default;
SELECT info FROM information_schema.processlist;
info
SELECT info FROM information_schema.processlist
SELECT UNIX_TIMESTAMP() - @start_time >= <global_value> + <session_value>;;
UNIX_TIMESTAMP() - @start_time >= <global_value> + <session_value>;
1
SET @@global.wait_timeout= @start_value;
...@@ -11,93 +11,87 @@ ...@@ -11,93 +11,87 @@
# Creation Date: 2008-03-07 # # Creation Date: 2008-03-07 #
# Author: Salman Rawala # # Author: Salman Rawala #
# # # #
# Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. #
# #
# Description: Test Cases of Dynamic System Variable wait_timeout # # Description: Test Cases of Dynamic System Variable wait_timeout #
# that checks the functionality of this variable # # that checks the functionality of this variable #
# # # #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # # Reference: #
# server-system-variables.html#option_mysqld_wait_timeouts # # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# # # #
############################################################################### ###############################################################################
--source include/not_embedded.inc --source include/not_embedded.inc
--disable_warnings SET @start_value= @@global.wait_timeout;
drop table if exists t1;
--enable_warnings
##############################
# Creating two new tables #
##############################
--echo ## Creating new table t1 ##
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name VARCHAR(30)
);
--echo '#--------------------FN_DYNVARS_186_01-------------------------#' --echo '#--------------------FN_DYNVARS_186_01-------------------------#'
####################################################################### #######################################################################
# Setting initial value of interactive_timeout greater than sleep and # 1. test of scope session
# verifying its behavior on session scope
####################################################################### #######################################################################
--echo ## Creating new connection test_con1 ## SET @start_time= UNIX_TIMESTAMP();
--echo connect (test_con1, localhost, root,,);
connect (test_con1, localhost, root,,); connect (test_con1, localhost, root,,);
connection test_con1; connection test_con1;
--echo ## Setting value of variable to 5 ## # If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
SET @@session.wait_timeout = 5; SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
--echo ## Inserting record in table t1 ##
INSERT into t1(name) values('Record_1');
--echo ## Using sleep to check timeout ##
sleep 4;
--echo '#--------------------FN_DYNVARS_186_02-------------------------#'
#######################################################################
# Setting initial value of interactive_timeout greater than sleep and
# verifying its behavior on global scope
#######################################################################
--echo ## Setting value of variable ## # Find a small value <> @@global.wait_timeout.
SET @@global.wait_timeout = 5; let $session_value =
`SELECT IF(@@global.wait_timeout <> 2 OR @@global.wait_timeout IS NULL, 2, 3)`;
--replace_result $session_value <session_value>
eval SET @@session.wait_timeout = $session_value;
--echo ## Creating new connection test_con2 ## --echo connect (test_con2, localhost, root,,);
connect (test_con2, localhost, root,,); connect (test_con2, localhost, root,,);
connection test_con2; connection test_con2;
INSERT into t1(name) values('Record_2'); --replace_result $session_value <session_value>
eval SET @@session.wait_timeout = $session_value - 1;
--echo ## Using sleep to check timeout ##
sleep 4;
--echo connection default;
connection default;
--echo wait until connections ready
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
--source include/wait_condition.inc
SELECT info FROM information_schema.processlist;
--echo '#--------------------FN_DYNVARS_186_03-------------------------#' --echo '#--------------------FN_DYNVARS_186_03-------------------------#'
####################################################################### #######################################################################
# Setting initial value of interactive_timeout less than sleep and # 2. test of scope global
# verifying its behavior on global scope
####################################################################### #######################################################################
--echo ## Setting value of variable to 1 ## # Find a small value <> @@global.wait_timeout.
SET @@global.wait_timeout = 1; let $global_value = $session_value + 1;
--replace_result $global_value <global_value>
eval SET @@global.wait_timeout= $global_value;
--echo ## Creating new connection ## # Changing the @@global.wait_timeout has no influence on the
# @@session.wait_timeout of already established sessions.
SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
--echo connect (test_con3, localhost, root,,);
connect (test_con3, localhost, root,,); connect (test_con3, localhost, root,,);
connection test_con3; connection test_con3;
INSERT into t1(name) values('Record_3'); # If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
--echo ## Using sleep to check timeout ##
sleep 5; --echo connection default;
connection default;
--echo ## We cannot test it further because the server stops due to wait_timeout ## # We can be sure that the connections test_con1 and test_con2 must be
--Error 2006 # established because both have already executed a SET @@session.wait_timeout.
SELECT * from t1; # This means they are or at least were visible within the processlist.
# Therefore we can now simply wait till both disappear from the processlist.
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
--source include/wait_condition.inc
SELECT info FROM information_schema.processlist;
--replace_result $global_value <global_value> $session_value <session_value>;
eval SELECT UNIX_TIMESTAMP() - @start_time >= $global_value + $session_value;
SET @@global.wait_timeout= @start_value;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment