1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
############# mysql-test\t\Query_cache_limit_func.test ########################
# #
# Variable Name: Query_cache_limit #
# Scope: SESSION #
# Access Type: Dynamic #
# Data Type: NUMERIC #
# Default Value: 1048576 #
# Min Value: 0 #
# #
# #
# Creation Date: 2008-03-02 #
# Author: Sharique Abdullah #
# #
# Description: Test Cases of Dynamic System Variable "Query_cache_limit" #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
# #
# Reference: #
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--echo ** Setup **
--echo
#
# Setup
#
SET @global_query_cache_limit = @@global.query_cache_limit;
SET @global_query_cache_size = @@global.query_cache_size;
SET @global_query_cache_type = @@global.query_cache_type;
SET GLOBAL query_cache_type= ON;
SET LOCAL query_cache_type= ON;
--echo ** warnings **
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
#creating table#
--echo ** creating table **
CREATE TABLE t
(
id INT AUTO_INCREMENT PRIMARY KEY,
c TEXT(30)
);
#inserting value#
--echo **inserting value **
INSERT INTO t set c = repeat('x',29);
INSERT INTO t set c = concat(repeat('x',28),'r','x');
INSERT INTO t set c = concat(repeat('x',28),'s','y');
INSERT INTO t set c = concat(repeat('x',28),'g','w');
# Reset cache & flush status
--echo ** Reset cache values **
FLUSH GLOBAL STATUS;
RESET QUERY CACHE;
# set query cache type value to on and allocating cache size
--echo ** On query_cache_type **
SET GLOBAL query_cache_type = ON;
--echo ** Allocating cache size **
SET GLOBAL query_cache_size = 131072;
# reset values
--echo ** Reset values
SET GLOBAL query_cache_size = 0;
SET GLOBAL query_cache_size = 131072;
SET GLOBAL query_cache_type = ON;
--disable_cursor_protocol
--echo '#---------------------FN_DYNVARS_132_01----------------------#'
#
#Check if results are cacheing on default value #
#
# Reset cache & flush status
--echo ** Reset cache values **
FLUSH GLOBAL STATUS;
RESET QUERY CACHE;
#fetching results#
--echo ** fetching results **
SELECT * FROM t;
# Check status
--echo ** check status on not setting query_cache_limit value **
SHOW STATUS LIKE 'Qcache_not_cached';
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo '#---------------------FN_DYNVARS_132_02----------------------#'
#
#Check if results are cacheing on setting value to 0 i.e. no caching#
#
# Reset cache & flush status
--echo ** Reset cache values **
FLUSH GLOBAL STATUS;
RESET QUERY CACHE;
#set cache limit
--echo ** set cache limit **
SET @@GLOBAL.query_cache_limit = 0;
#fetching results#
--echo ** fetching results **
--disable_ps2_protocol
SELECT * FROM t;
--enable_ps2_protocol
# Check status after setting value#
--echo ** Check status after setting value **
SHOW STATUS LIKE 'Qcache_not_cached';
--echo 1 Expected
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 0 Expected
--echo '#---------------------FN_DYNVARS_132_03----------------------#'
#
# Check if setting to 0 makes any difference to the cache or not #
#
#set cache limit to default
--echo ** set cache limit **
SET @@GLOBAL.query_cache_limit = DEFAULT;
# Reset cache & flush status
--echo ** Reset cache values **
FLUSH GLOBAL STATUS;
RESET QUERY CACHE;
#fetching results#
--echo ** fetching results **
SELECT * FROM t;
SHOW STATUS LIKE 'Qcache_not_cached';
--echo 0 Expected
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
SET @@GLOBAL.query_cache_limit = 0;
SHOW STATUS LIKE 'Qcache_not_cached';
--echo 0 Expected
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
#fetching results#
--echo ** fetching results **
SELECT * FROM t;
# Check status after setting value#
--echo ** Check status after setting value **
SHOW STATUS LIKE 'Qcache_not_cached';
--echo 0 Expected
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
--enable_cursor_protocol
#
# Cleanup
#
SET @@GLOBAL.query_cache_limit = @global_query_cache_limit;
SET GLOBAL query_cache_size = @global_query_cache_size;
SET GLOBAL query_cache_type = @global_query_cache_type;
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
|