Debian Codegraph @

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

raw
1 ############# mysql-test\t\thread_cache_size_func.test ##########################
2 # #
3 # Variable Name: thread_cache_size #
4 # Scope: SESSION #
5 # Access Type: Dynamic #
6 # Data Type: Enumeration #
7 # Default Value: 0 #
8 # Values: 0-16384 #
9 # #
10 # #
11 # Creation Date: 2008-03-02 #
12 # Author: Sharique Abdullah #
13 # #
14 # Modified: HHunger 2008-08-27 Reduced test to needed function and inserted #
15 # wait-loops #
16 # #
17 # Description: Test Cases of Dynamic System Variable "thread_cache_size" #
18 # that checks behavior of this variable in the following ways #
19 # * Functionality based on different values #
20 # #
21 # Reference: #
22 # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
23 # #
24 #################################################################################
25
26 #
27 # Setup
28 #
29
30 --source include/not_threadpool.inc
31
32 SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
33
34 FLUSH STATUS;
35
36 -- ECHO '# Test1#'
37 SET @@GLOBAL.thread_cache_size=3;
38 SHOW STATUS LIKE 'Threads_cached';
39 --echo 0 Expected
40
41 ##################################
42 # Make 4 connections #
43 ##################################
44
45 --echo ** Connecting conn1 using username 'root' **
46 CONNECT (conn1,localhost,root,,);
47 --echo ** Connecting conn2 using username 'root' **
48 CONNECT (conn2,localhost,root,,);
49 --echo ** Connecting conn3 using username 'root' **
50 CONNECT (conn3,localhost,root,,);
51 --echo ** Connecting conn4 using username 'root' **
52 CONNECT (conn4,localhost,root,,);
53
54 --echo ** Connection default **
55 CONNECTION default;
56
57 # Wait until all connections done
58 let $wait_condition= SELECT COUNT(*)= 6 FROM INFORMATION_SCHEMA.PROCESSLIST;
59 --source include/wait_condition.inc
60
61 SHOW STATUS LIKE 'Threads_cached';
62 --echo 0 Expected
63
64 ####################################
65 #Disconnecting all the connections #
66 ####################################
67
68 --echo ** Disconnecting conn1,conn2,conn3,conn4 **
69 DISCONNECT conn1;
70 DISCONNECT conn2;
71 DISCONNECT conn3;
72 DISCONNECT conn4;
73
74 #
75 # Checking the status
76 #
77
78 # Wait until all disconnects ready
79 let $wait_condition= SELECT COUNT(*)= 2 FROM INFORMATION_SCHEMA.PROCESSLIST;
80 --source include/wait_condition.inc
81
82 SHOW STATUS LIKE 'Threads_cached';
83 --echo 3 Expected
84
85 #
86 # Decreasing cache size to 1
87 #
88 SET @@GLOBAL.thread_cache_size= 1;
89
90 --echo ** Connecting conn1 using username 'root' **
91 CONNECT (conn1,localhost,root,,);
92 --echo ** Connecting conn2 using username 'root' **
93 CONNECT (conn2,localhost,root,,);
94
95 --echo connection default;
96 CONNECTION default;
97
98 # Wait until all connects ready
99 let $wait_condition= SELECT COUNT(*)= 4 FROM INFORMATION_SCHEMA.PROCESSLIST;
100 --source include/wait_condition.inc
101
102 --echo ** Disconnecting conn1,conn2 **
103 DISCONNECT conn1;
104 DISCONNECT conn2;
105
106 # Wait until all disconnects ready
107 let $wait_condition= SELECT COUNT(*)= 2 FROM INFORMATION_SCHEMA.PROCESSLIST;
108 --source include/wait_condition.inc
109
110 SHOW STATUS LIKE 'Threads_cached';
111 --echo 1 Expected
112
113 #
114 # Cleanup
115 #
116
117 SET @@GLOBAL.thread_cache_size = @global_thread_cache_size;
118