summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sys_vars/r/query_cache_type_func.result
blob: 941e7d41886bb2599d9626d89921ec9978c656eb (plain)
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
** Setup **

connect  con0,localhost,root,,;
connection con0;
SET @start_global_value = @@GLOBAL.query_cache_type;
SET @start_session_value = @@SESSION.query_cache_type;
SET @start_query_cache_size= @@global.query_cache_size;
CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
SET @@GLOBAL.query_cache_size = 65536;
FLUSHING CACHE
SET @@GLOBAL.query_cache_size = 0;
SET @@GLOBAL.query_cache_size = 65536;
** TESTING SESSION SCOPE **
'#--------------------FN_DYNVARS_135_01-------------------------#'
SET @@query_cache_type = DEFAULT;
SELECT @@query_cache_type;
@@query_cache_type
OFF
OFF Expected
SET @@query_cache_type = ON;
ERROR HY000: Query cache is globally disabled and you can't enable it only for this session
'#--------------------FN_DYNVARS_135_02-------------------------#'
SET GLOBAL query_cache_type= ON;
SET @@query_cache_type = NULL;
ERROR 42000: Variable 'query_cache_type' can't be set to the value of 'NULL'
Expected error: Wrong value for variable
SET @@query_cache_type = ON;
SELECT @@query_cache_type;
@@query_cache_type
ON
ON Expected
SET @@query_cache_type = OFF;
SELECT @@query_cache_type;
@@query_cache_type
OFF
OFF Expected
SET @@query_cache_type = DEMAND;
SELECT @@query_cache_type;
@@query_cache_type
DEMAND
DEMAND Expected
SET @@query_cache_type = XYZ;
ERROR 42000: Variable 'query_cache_type' can't be set to the value of 'XYZ'
Expected error: Wrong value for variable
** Turning cache to ON **
SET @@query_cache_type = ON;
'#--------------------FN_DYNVARS_135_03-------------------------#'
** CACHE ADDITION **

SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	0
0 Expected
SELECT * FROM t1;
id	value
1	val1
2	val2
3	val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	1
1 Expected
SELECT value FROM t1;
value
val1
val2
val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	2
2 Expected
'#--------------------FN_DYNVARS_135_04-------------------------#'
** CACHE HIT **
SELECT * FROM t1;
id	value
1	val1
2	val2
3	val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	2
2 Expected
SELECT SQL_CACHE value FROM t1;
value
val1
val2
val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	3
3 Expected
SELECT SQL_NO_CACHE value FROM t1;
value
val1
val2
val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	3
3 Expected
'#--------------------FN_DYNVARS_135_05-------------------------#'
Testing with store procedure
CREATE PROCEDURE testProcHit()
BEGIN
SELECT * FROM t1;
SELECT SQL_CACHE value FROM t1;
END|
CALL testProcHit();
id	value
1	val1
2	val2
3	val3
value
val1
val2
val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	5
Expected value : 3
==================
Bug#35388: Stored procedure execution causes improper behavior of query cache.
'#--------------------FN_DYNVARS_135_06-------------------------#'
FLUSHING CACHE
SET @@GLOBAL.query_cache_size = 0;
SET @@GLOBAL.query_cache_size = 65536;
** Turning cache to OFF **
SET @@query_cache_type = OFF;
SELECT @@query_cache_type;
@@query_cache_type
OFF
SELECT id FROM t1;
id
1
2
3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	0
0 Expected
'#--------------------FN_DYNVARS_135_07-------------------------#'
SELECT SQL_CACHE id FROM t1;
id
1
2
3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	0
0 Expected
SELECT SQL_CACHE * FROM t1;
id	value
1	val1
2	val2
3	val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	0
0 Expected
'#--------------------FN_DYNVARS_135_08-------------------------#'
FLUSHING CACHE
SET @@GLOBAL.query_cache_size = 0;
SET @@GLOBAL.query_cache_size = 65536;
** Turning cache to DEMAND **
SET @@query_cache_type = DEMAND;
SELECT @@query_cache_type;
@@query_cache_type
DEMAND
'#--------------------FN_DYNVARS_135_09-------------------------#'
SELECT value,id FROM t1;
value	id
val1	1
val2	2
val3	3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	0
0 Expected
SELECT SQL_CACHE * FROM t1;
id	value
1	val1
2	val2
3	val3
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name	Value
Qcache_queries_in_cache	1
0 Expected
** TESTING GLOBAL SCOPE **
'#--------------------FN_DYNVARS_135_10-------------------------#'
SET @@GLOBAL.query_cache_type = OFF;
connect  con1,localhost,root,,;
connection con1;
SELECT @@query_cache_type;
@@query_cache_type
OFF
OFF Expected
'#--------------------FN_DYNVARS_135_11-------------------------#'
SET @@GLOBAL.query_cache_type = DEMAND;
connect  con2,localhost,root,,;
connection con2;
SELECT @@query_cache_type;
@@query_cache_type
DEMAND
DEMAND Expected
'#--------------------FN_DYNVARS_135_12-------------------------#'
SET @@GLOBAL.query_cache_type = ON;
connect  con3,localhost,root,,;
connection con3;
SELECT @@query_cache_type;
@@query_cache_type
ON
ON Expected

** Cleanup **

disconnect con1;
disconnect con2;
disconnect con3;
connection con0;
SET @@GLOBAL.query_cache_type = @start_global_value;
SET @@SESSION.query_cache_type = @start_session_value;
SET GLOBAL query_cache_size = @start_query_cache_size;
DROP TABLE t1;
DROP PROCEDURE testProcHit;
disconnect con0;