Debian Codegraph @

mysql-test/suite/sys_vars/t/wait_timeout_func.test

raw
1 ###############################################################################
2 # #
3 # Variable Name: wait_timeout #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: #
8 # Range: #
9 # #
10 # #
11 # Creation Date: 2008-03-07 #
12 # Author: Salman Rawala #
13 # #
14 # Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. #
15 # #
16 # Description: Test Cases of Dynamic System Variable wait_timeout #
17 # that checks the functionality of this variable #
18 # #
19 # Reference: #
20 # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
21 # #
22 ###############################################################################
23
24 --source include/not_embedded.inc
25
26 SET @start_value= @@global.wait_timeout;
27
28
29 --echo '#--------------------FN_DYNVARS_186_01-------------------------#'
30 #######################################################################
31 # 1. test of scope session
32 #######################################################################
33
34 SET @start_time= UNIX_TIMESTAMP();
35 connect (test_con1, localhost, root,,);
36 connection test_con1;
37
38 # If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
39 SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
40
41 # Find a small value <> @@global.wait_timeout.
42 let $session_value =
43 `SELECT IF(@@global.wait_timeout <> 2 OR @@global.wait_timeout IS NULL, 2, 3)`;
44 --replace_result $session_value <session_value>
45 eval SET @@session.wait_timeout = $session_value;
46
47 connect (test_con2, localhost, root,,);
48 connection test_con2;
49
50 --replace_result $session_value <session_value>
51 eval SET @@session.wait_timeout = $session_value - 1;
52
53 connection default;
54
55 --echo wait until connections ready
56 let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
57 --source include/wait_condition.inc
58 SELECT info FROM information_schema.processlist;
59
60 --echo '#--------------------FN_DYNVARS_186_03-------------------------#'
61 #######################################################################
62 # 2. test of scope global
63 #######################################################################
64
65 # Find a small value <> @@global.wait_timeout.
66 let $global_value = $session_value + 1;
67 --replace_result $global_value <global_value>
68 eval SET @@global.wait_timeout= $global_value;
69
70 # Changing the @@global.wait_timeout has no influence on the
71 # @@session.wait_timeout of already established sessions.
72 SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
73
74 connect (test_con3, localhost, root,,);
75 connection test_con3;
76
77 # If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
78 SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
79
80 connection default;
81 # We can be sure that the connections test_con1 and test_con2 must be
82 # established because both have already executed a SET @@session.wait_timeout.
83 # This means they are or at least were visible within the processlist.
84 # Therefore we can now simply wait till both disappear from the processlist.
85 let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
86 --source include/wait_condition.inc
87 SELECT info FROM information_schema.processlist;
88
89 --replace_result $global_value <global_value> $session_value <session_value>;
90 eval SELECT UNIX_TIMESTAMP() - @start_time >= $global_value + $session_value;
91 SET @@global.wait_timeout= @start_value;