1############# mysql-test\t\slow_launch_time_func.test ##########################
2#                                                                              #
3# Variable Name: slow_launch_time                                              #
4# Scope: SESSION                                                               #
5# Access Type: Dynamic                                                         #
6# Data Type: NUMERIC                                                           #
7# Default Value: 2                                                             #
8# Values:      -                                                               #
9#                                                                              #
10#                                                                              #
11# Creation Date: 2008-03-02                                                    #
12# Author:  Sharique Abdullah                                                   #
13#                                                                              #
14# Last change: 2008-09-09 mleich Reimplementation of this test                 #
15#              - Fix Bug#36874 : main.slow_launch_time_func test fails         #
16#                randomly                                                      #
17#              - Fix other failures and streamline the test                    #
18#                                                                              #
19# Description: Test Cases of Dynamic System Variable "slow_launch_time "       #
20#              that checks behavior of this variable in the following ways     #
21#              * Functionality based on different values                       #
22#                                                                              #
23# Reference:                                                                   #
24#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html       #
25#           option_mysqld_slow_launch_time                                     #
26#                                                                              #
27################################################################################
28
29#
30# Setup
31#
32
33--source include/not_embedded.inc
34--source include/not_threadpool.inc
35--source include/not_valgrind.inc
36
37SET @global_slow_launch_time = @@GLOBAL.slow_launch_time;
38
39--echo '#--------------------FN_DYNVARS_124_01-------------------------#'
40
41########################################################################
42# Reveal that a new connect gets counted as "slow launched thread" if  #
43# @@GLOBAL.slow_launch_time = 0.                                       #
44# The value of slow_launch_threads must be increased by 1.             #
45########################################################################
46
47SET @@GLOBAL.slow_launch_time=0;
48SELECT @@GLOBAL.slow_launch_time;
49
50let $value_before=
51   query_get_value(show status like 'slow_launch_threads', Value, 1);
52--echo ** Connecting conn1 using username 'root' **
53CONNECT (conn1,localhost,root,,);
54# To assure that the connection has been established.
55SELECT 1;
56let $value_after=
57   query_get_value(show status like 'slow_launch_threads', Value, 1);
58if (!`SELECT $value_after = $value_before + 1`)
59{
60   --echo ERROR: Subtest FN_DYNVARS_124_01 failed
61   --echo A new connect should be counted as 'slow_launch_thread' if
62   --echo @@GLOBAL.slow_launch_time=0
63   SELECT @@GLOBAL.slow_launch_time;
64   echo Number of slow_launch_threads before new connect: $value_before;
65   echo Number of slow_launch_threads after new connect: $value_after;
66}
67disconnect conn1;
68source include/wait_until_disconnected.inc;
69--echo ** Switch to connection default and disconnect conn1 **
70connection default;
71
72--echo '#--------------------FN_DYNVARS_124_02-------------------------#'
73
74########################################################################
75# Reveal that a new connect gets not counted as "slow launched thread" #
76# if @@GLOBAL.slow_launch_time is sufficient big.                      #
77# The value of slow_launch_threads must not change.                    #
78########################################################################
79
80SET @@GLOBAL.slow_launch_time= 10000;
81SELECT @@GLOBAL.slow_launch_time;
82
83let $value_before=
84   query_get_value(show status like 'slow_launch_threads', Value, 1);
85--echo ** Connecting conn2 using username 'root' **
86CONNECT (conn2,localhost,root,,);
87SELECT 1;
88let $value_after=
89   query_get_value(show status like 'slow_launch_threads', Value, 1);
90if ($value_after != $value_before)
91{
92   --echo ERROR: Subtest FN_DYNVARS_124_02 failed
93   --echo A new connect must not be counted as 'slow_launch_thread' if
94   --echo @@GLOBAL.slow_launch_time is sufficient big.
95   SELECT @@GLOBAL.slow_launch_time;
96   echo Number of slow_launch_threads before new connect: $value_before;
97   echo Number of slow_launch_threads after new connect: $value_after;
98}
99
100#
101# Cleanup
102#
103
104--echo ** Switch to connection default and disconnect conn2 **
105connection default;
106disconnect conn2;
107SET @@GLOBAL.slow_launch_time = @global_slow_launch_time;
108