~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to mysql-test/t/query_cache_type_func.test

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
############# mysql-test\t\query_cache_type_func.test #########################
2
 
#                                                                             #
3
 
# Variable Name: query_cache_type                                             #
4
 
# Scope: GLOBAL & SESSION                                                     #
5
 
# Access Type: Dynamic                                                        #
6
 
# Data Type: enumeration                                                      #
7
 
# Default Value: ON                                                           #
8
 
# Values: ON, OFF, DEMAND                                                     #
9
 
#                                                                             #
10
 
#                                                                             #
11
 
# Creation Date: 2008-02-20                                                   #
12
 
# Author:  Sharique Abdullah                                                  #
13
 
#                                                                             #
14
 
# Description: Test Cases of Dynamic System Variable "query_cache_type"       #
15
 
#              that checks behavior of this variable in the following ways    #
16
 
#                                                                             #
17
 
# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
18
 
#            server-system-variables.html#option_mysqld_query_cache_type      #
19
 
#                                                                             #
20
 
###############################################################################
21
 
 
22
 
--echo ** Setup **
23
 
--echo
24
 
 
25
 
# Setup
26
 
#
27
 
 
28
 
#
29
 
# Save initial value
30
 
#
31
 
 
32
 
--echo ** Connecting to con0 using root **
33
 
connect (con0,localhost,root,,);
34
 
--echo ** Connection con0 **
35
 
connection con0;
36
 
 
37
 
SET @start_global_value = @@GLOBAL.query_cache_type;
38
 
SET @start_session_value = @@SESSION.query_cache_type;
39
 
 
40
 
#
41
 
# Creating test table
42
 
#
43
 
 
44
 
CREATE TABLE t1(id int, value varchar(10));
45
 
 
46
 
INSERT INTO t1 VALUES(1, 'val1');
47
 
INSERT INTO t1 VALUES(2, 'val2');
48
 
INSERT INTO t1 VALUES(3, 'val3');
49
 
 
50
 
#
51
 
# Clearing the query cache and setting up cache size
52
 
#
53
 
 
54
 
SET @@GLOBAL.query_cache_size = 65536;
55
 
 
56
 
--echo FLUSHING CACHE
57
 
SET @@GLOBAL.query_cache_size = 0;
58
 
SET @@GLOBAL.query_cache_size = 65536;
59
 
 
60
 
#
61
 
# SESSION SCOPE
62
 
#
63
 
 
64
 
--echo ** TESTING SESSION SCOPE **
65
 
 
66
 
--echo '#--------------------FN_DYNVARS_135_01-------------------------#'
67
 
#
68
 
# Testing default value it should be ON by default
69
 
#
70
 
 
71
 
SET @@query_cache_type = DEFAULT;
72
 
SELECT @@query_cache_type;
73
 
--echo ON Expected
74
 
 
75
 
--echo '#--------------------FN_DYNVARS_135_02-------------------------#'
76
 
#
77
 
# Testing valid possible values
78
 
#
79
 
 
80
 
--error ER_WRONG_VALUE_FOR_VAR
81
 
SET @@query_cache_type = NULL;
82
 
--echo Expected error: Wrong value for variable
83
 
 
84
 
SET @@query_cache_type = ON;
85
 
SELECT @@query_cache_type;
86
 
--echo ON Expected
87
 
 
88
 
SET @@query_cache_type = OFF;
89
 
SELECT @@query_cache_type;
90
 
--echo OFF Expected
91
 
 
92
 
SET @@query_cache_type = DEMAND;
93
 
SELECT @@query_cache_type;
94
 
--echo DEMAND Expected
95
 
 
96
 
--error ER_WRONG_VALUE_FOR_VAR
97
 
SET @@query_cache_type = XYZ;
98
 
--echo Expected error: Wrong value for variable
99
 
 
100
 
 
101
 
#
102
 
# TESTING FOR VALUE ON or 1
103
 
#
104
 
 
105
 
--echo ** Turning cache to ON **
106
 
 
107
 
SET @@query_cache_type = ON;
108
 
 
109
 
--echo '#--------------------FN_DYNVARS_135_03-------------------------#'
110
 
#
111
 
# TESTING CACHE ADDITION
112
 
#
113
 
 
114
 
--echo ** CACHE ADDITION **
115
 
--echo
116
 
 
117
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
118
 
--echo 0 Expected
119
 
 
120
 
SELECT * FROM t1;
121
 
 
122
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
123
 
--echo 1 Expected
124
 
 
125
 
SELECT value FROM t1;
126
 
 
127
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
128
 
--echo 2 Expected
129
 
 
130
 
--echo '#--------------------FN_DYNVARS_135_04-------------------------#'
131
 
#
132
 
# TESTING CACHE HIT
133
 
#
134
 
 
135
 
--echo ** CACHE HIT **
136
 
 
137
 
SELECT * FROM t1;
138
 
 
139
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
140
 
--echo 2 Expected
141
 
 
142
 
SELECT SQL_CACHE value FROM t1;
143
 
 
144
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
145
 
--echo 3 Expected
146
 
 
147
 
SELECT SQL_NO_CACHE value FROM t1;
148
 
 
149
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
150
 
--echo 3 Expected
151
 
 
152
 
--echo '#--------------------FN_DYNVARS_135_05-------------------------#'
153
 
#
154
 
# Testing with store procedure
155
 
#
156
 
 
157
 
--echo Testing with store procedure
158
 
 
159
 
delimiter |;
160
 
 
161
 
CREATE PROCEDURE testProcHit()
162
 
BEGIN
163
 
        SELECT * FROM t1;
164
 
        SELECT SQL_CACHE value FROM t1;
165
 
END|
166
 
 
167
 
delimiter ;|
168
 
 
169
 
CALL testProcHit();
170
 
 
171
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
172
 
--echo Expected value : 3
173
 
--echo ==================
174
 
--echo Bug#35388: Stored procedure execution causes improper behavior of query cache.
175
 
 
176
 
 
177
 
--echo '#--------------------FN_DYNVARS_135_06-------------------------#'
178
 
#
179
 
# TESTING FOR VALUE OFF or 0
180
 
#
181
 
 
182
 
--echo FLUSHING CACHE
183
 
SET @@GLOBAL.query_cache_size = 0;
184
 
SET @@GLOBAL.query_cache_size = 65536;
185
 
 
186
 
--echo ** Turning cache to OFF **
187
 
 
188
 
SET @@query_cache_type = OFF;
189
 
SELECT @@query_cache_type;
190
 
 
191
 
SELECT id FROM t1;
192
 
 
193
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
194
 
--echo 0 Expected
195
 
 
196
 
--echo '#--------------------FN_DYNVARS_135_07-------------------------#'
197
 
#
198
 
# TESTING QUERY WITH SQL_CACHE
199
 
#
200
 
 
201
 
SELECT SQL_CACHE id FROM t1;
202
 
 
203
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
204
 
--echo 0 Expected
205
 
 
206
 
SELECT SQL_CACHE * FROM t1;
207
 
 
208
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
209
 
--echo 0 Expected
210
 
 
211
 
--echo '#--------------------FN_DYNVARS_135_08-------------------------#'
212
 
#
213
 
# TESTING FOR VALUE DEMAND or 2
214
 
#
215
 
 
216
 
--echo FLUSHING CACHE
217
 
SET @@GLOBAL.query_cache_size = 0;
218
 
SET @@GLOBAL.query_cache_size = 65536;
219
 
 
220
 
--echo ** Turning cache to DEMAND **
221
 
 
222
 
SET @@query_cache_type = DEMAND;
223
 
SELECT @@query_cache_type;
224
 
 
225
 
--echo '#--------------------FN_DYNVARS_135_09-------------------------#'
226
 
#
227
 
# TESTING NORMAL QUERY
228
 
#
229
 
 
230
 
SELECT value,id FROM t1;
231
 
 
232
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
233
 
--echo 0 Expected
234
 
 
235
 
SELECT SQL_CACHE * FROM t1;
236
 
 
237
 
SHOW STATUS LIKE 'Qcache_queries_in_cache';
238
 
--echo 0 Expected
239
 
 
240
 
#
241
 
#       GLOBAL SCOPE
242
 
#
243
 
 
244
 
--echo ** TESTING GLOBAL SCOPE **
245
 
 
246
 
--echo '#--------------------FN_DYNVARS_135_10-------------------------#'
247
 
#
248
 
# Turning global cache to OFF
249
 
#
250
 
 
251
 
SET @@GLOBAL.query_cache_type = OFF;
252
 
 
253
 
--echo ** Connecting con1 using root **
254
 
connect (con1,localhost,root,,);
255
 
 
256
 
--echo ** Connection con1 **
257
 
connection con1;
258
 
 
259
 
SELECT @@query_cache_type;
260
 
--echo OFF Expected
261
 
 
262
 
--echo '#--------------------FN_DYNVARS_135_11-------------------------#'
263
 
#
264
 
# Turning global cache to DEMAND
265
 
#
266
 
SET @@GLOBAL.query_cache_type = DEMAND;
267
 
 
268
 
--echo ** Connecting con2 using root **
269
 
connect (con2,localhost,root,,);
270
 
 
271
 
--echo ** Connection con2 **
272
 
connection con2;
273
 
 
274
 
SELECT @@query_cache_type;
275
 
--echo DEMAND Expected
276
 
 
277
 
--echo '#--------------------FN_DYNVARS_135_12-------------------------#'
278
 
#
279
 
# Turning global cache to ON
280
 
#
281
 
SET @@GLOBAL.query_cache_type = ON;
282
 
 
283
 
--echo ** Connecting con3 using root **
284
 
connect (con3,localhost,root,,);
285
 
--echo ** Connection con3 **
286
 
connection con3;
287
 
 
288
 
SELECT @@query_cache_type;
289
 
--echo ON Expected
290
 
 
291
 
--echo
292
 
--echo ** Cleanup **
293
 
--echo
294
 
#
295
 
# Cleanup
296
 
#
297
 
 
298
 
--echo Disconnecting con1,con2,con3
299
 
disconnect con1;
300
 
disconnect con2;
301
 
disconnect con3;
302
 
 
303
 
--echo ** Connection con0 **
304
 
connection con0;
305
 
 
306
 
SET @@GLOBAL.query_cache_type = @start_global_value;
307
 
SET @@SESSION.query_cache_type = @start_session_value;
308
 
 
309
 
DROP TABLE t1;
310
 
 
311
 
DROP PROCEDURE testProcHit;
312
 
 
313
 
--echo Disconnecting con0
314
 
disconnect con0;