| 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 |
|
| 31 |
--source include/one_thread_per_connection.inc |
| 32 |
SET @global_thread_cache_size = @@GLOBAL.thread_cache_size; |
| 33 |
|
| 34 |
-- ECHO '# Test1#' |
| 35 |
SET @@GLOBAL.thread_cache_size=3; |
| 36 |
FLUSH THREADS; |
| 37 |
select variable_value<=@@global.thread_cache_size from information_schema.global_status where variable_name="Threads_cached"; |
| 38 |
|
| 39 |
################################## |
| 40 |
# Make 4 connections # |
| 41 |
################################## |
| 42 |
|
| 43 |
CONNECT (conn1,localhost,root,,); |
| 44 |
CONNECT (conn2,localhost,root,,); |
| 45 |
CONNECT (conn3,localhost,root,,); |
| 46 |
CONNECT (conn4,localhost,root,,); |
| 47 |
|
| 48 |
CONNECTION default; |
| 49 |
|
| 50 |
# Wait until all connections done |
| 51 |
let $wait_condition= SELECT COUNT(*)= 5 FROM INFORMATION_SCHEMA.PROCESSLIST; |
| 52 |
--source include/wait_condition.inc |
| 53 |
|
| 54 |
select variable_value<=@@global.thread_cache_size from information_schema.global_status where variable_name="Threads_cached"; |
| 55 |
|
| 56 |
#################################### |
| 57 |
#Disconnecting all the connections # |
| 58 |
#################################### |
| 59 |
|
| 60 |
DISCONNECT conn1; |
| 61 |
DISCONNECT conn2; |
| 62 |
DISCONNECT conn3; |
| 63 |
DISCONNECT conn4; |
| 64 |
|
| 65 |
# |
| 66 |
# Checking the status |
| 67 |
# |
| 68 |
|
| 69 |
# Wait until all disconnects ready |
| 70 |
let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST; |
| 71 |
--source include/wait_condition.inc |
| 72 |
|
| 73 |
# Wait until thread cache becomes 3 |
| 74 |
let $wait_condition= SELECT variable_value = 3 FROM INFORMATION_SCHEMA.global_status where variable_name="Threads_cached"; |
| 75 |
--source include/wait_condition.inc |
| 76 |
|
| 77 |
# |
| 78 |
# Decreasing cache size to 1 |
| 79 |
# |
| 80 |
SET @@GLOBAL.thread_cache_size= 1; |
| 81 |
FLUSH THREADS; |
| 82 |
|
| 83 |
CONNECT (conn1,localhost,root,,); |
| 84 |
CONNECT (conn2,localhost,root,,); |
| 85 |
|
| 86 |
CONNECTION default; |
| 87 |
|
| 88 |
# Wait until all connects ready |
| 89 |
let $wait_condition= SELECT COUNT(*)= 3 FROM INFORMATION_SCHEMA.PROCESSLIST; |
| 90 |
--source include/wait_condition.inc |
| 91 |
|
| 92 |
DISCONNECT conn1; |
| 93 |
DISCONNECT conn2; |
| 94 |
|
| 95 |
# Wait until all disconnects ready |
| 96 |
let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST; |
| 97 |
--source include/wait_condition.inc |
| 98 |
|
| 99 |
# Wait until thread cache becomes 1 |
| 100 |
let $wait_condition= SELECT variable_value = 1 FROM INFORMATION_SCHEMA.global_status where variable_name="Threads_cached"; |
| 101 |
--source include/wait_condition.inc |
| 102 |
|
| 103 |
# |
| 104 |
# Cleanup |
| 105 |
# |
| 106 |
|
| 107 |
SET @@GLOBAL.thread_cache_size = @global_thread_cache_size; |