]>
Commit | Line | Data |
---|---|---|
b4e1fa2c AM |
1 | # name : query_cache_with_comments.patch |
2 | # introduced : 11 or before | |
3 | # maintainer : Oleg | |
4 | # | |
5 | #!!! notice !!! | |
6 | # Any small change to this file in the main branch | |
7 | # should be done or reviewed by the maintainer! | |
db82db79 AM |
8 | --- /dev/null |
9 | +++ b/patch_info/query_cache_enhance.patch | |
b4e1fa2c AM |
10 | @@ -0,0 +1,15 @@ |
11 | +File=query_cache_enhance.patch | |
12 | +Name= query cache Percona's cumulative patch | |
13 | +Version=1.0 | |
14 | +Author=Percona <info@percona.com> | |
15 | +License=GPL | |
16 | +Comment= 1) Add new status - Waiting on query cache mutex (status_wait_query_cache_mutex.patch) | |
17 | + 2) Remove comments from query (need for cache hit) (query_cache_with_comments.patch) | |
18 | + 3) Totally disable query cache (query_cache_totally_disable.info) | |
19 | +2010-05 - First version avaliable (query_cache_with_comments.patch) | |
20 | +2010-07 - First version avaliable (status_wait_query_cache_mutex.patch | |
21 | +2010-07 - First version avaliable (query_cache_totally_disable.info) | |
22 | +2010-07 - Fix crash (query_cache_with_comments.patch) | |
23 | +2010-07 - Fix incorrect behavior diff (query_cache_with_comments.patch) | |
24 | +2010-09 - Merge patches to one | |
25 | +2010-11 - Ported to 5.5 | |
db82db79 AM |
26 | --- a/sql/mysqld.cc |
27 | +++ b/sql/mysqld.cc | |
28 | @@ -904,6 +904,7 @@ | |
b4e1fa2c AM |
29 | #endif |
30 | #ifdef HAVE_QUERY_CACHE | |
31 | ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE; | |
32 | +my_bool opt_query_cache_strip_comments= FALSE; | |
33 | Query_cache query_cache; | |
34 | #endif | |
35 | #ifdef HAVE_SMEM | |
db82db79 AM |
36 | --- a/sql/mysqld.h |
37 | +++ b/sql/mysqld.h | |
b4e1fa2c AM |
38 | @@ -91,6 +91,7 @@ |
39 | extern my_bool opt_log, opt_slow_log; | |
40 | extern my_bool opt_backup_history_log; | |
41 | extern my_bool opt_backup_progress_log; | |
42 | +extern my_bool opt_query_cache_strip_comments; | |
43 | extern ulonglong log_output_options; | |
44 | extern ulong log_backup_output_options; | |
45 | extern my_bool opt_log_queries_not_using_indexes; | |
db82db79 AM |
46 | --- /dev/null |
47 | +++ b/sql/query_strip_comments.h | |
b4e1fa2c AM |
48 | @@ -0,0 +1,37 @@ |
49 | +#ifndef _SQL_QUERY_STRIPC_COMMENTS_H_ | |
50 | +#define _SQL_QUERY_STRIPC_COMMENTS_H_ | |
51 | +#ifdef HAVE_QUERY_CACHE | |
52 | + | |
53 | +// implemented in sql_cache.cc | |
54 | +class QueryStripComments | |
55 | +{ | |
56 | +private: | |
57 | + QueryStripComments(const QueryStripComments&); | |
58 | + QueryStripComments& operator=(const QueryStripComments&); | |
59 | +public: | |
60 | + QueryStripComments(); | |
61 | + ~QueryStripComments(); | |
62 | + void set(const char* a_query, uint a_query_length, uint a_additional_length); | |
63 | + | |
64 | + char* query() { return buffer; } | |
65 | + uint query_length() { return length; } | |
66 | +private: | |
67 | + void cleanup(); | |
68 | +private: | |
69 | + char* buffer; | |
70 | + uint length /*query length, not buffer length*/; | |
71 | + uint buffer_length; | |
72 | +}; | |
73 | +class QueryStripComments_Backup | |
74 | +{ | |
75 | +public: | |
76 | + QueryStripComments_Backup(THD* a_thd,QueryStripComments* qsc); | |
77 | + ~QueryStripComments_Backup(); | |
78 | +private: | |
79 | + THD* thd; | |
80 | + char* query; | |
81 | + uint length; | |
82 | +}; | |
83 | + | |
84 | +#endif // HAVE_QUERY_CACHE | |
85 | +#endif // _SQL_QUERY_STRIPC_COMMENTS_H_ | |
db82db79 AM |
86 | --- a/sql/sql_cache.cc |
87 | +++ b/sql/sql_cache.cc | |
b4e1fa2c AM |
88 | @@ -344,6 +344,181 @@ |
89 | #include "probes_mysql.h" | |
90 | #include "transaction.h" | |
91 | ||
92 | +#include "query_strip_comments.h" | |
93 | + | |
94 | +QueryStripComments::QueryStripComments() | |
95 | +{ | |
96 | + buffer = 0; | |
97 | + length = 0; | |
98 | + buffer_length = 0; | |
99 | +} | |
100 | +QueryStripComments::~QueryStripComments() | |
101 | +{ | |
102 | + cleanup(); | |
103 | +} | |
104 | + | |
105 | +inline bool query_strip_comments_is_white_space(char c) | |
106 | +{ | |
107 | + return ((' ' == c) || ('\t' == c) || ('\r' == c) || ('\n' ==c )); | |
108 | +} | |
109 | +void QueryStripComments::set(const char* query, uint query_length, uint additional_length) | |
110 | +{ | |
111 | + uint new_buffer_length = query_length + additional_length; | |
112 | + if(new_buffer_length > buffer_length) | |
113 | + { | |
114 | + cleanup(); | |
115 | + buffer = (char*)my_malloc(new_buffer_length,MYF(0)); | |
116 | + } | |
117 | + uint query_position = 0; | |
118 | + uint position = 0; | |
119 | + // Skip whitespaces from begin | |
120 | + while((query_position < query_length) && query_strip_comments_is_white_space(query[query_position])) | |
121 | + { | |
122 | + ++query_position; | |
123 | + } | |
124 | + long int last_space = -1; | |
125 | + while(query_position < query_length) | |
126 | + { | |
127 | + char current = query[query_position]; | |
128 | + bool insert_space = false; // insert space to buffer, (IMPORTANT) don't update query_position | |
129 | + switch(current) | |
130 | + { | |
131 | + case '\'': | |
132 | + case '"': | |
133 | + { | |
134 | + buffer[position++] = query[query_position++]; // copy current symbol | |
135 | + while(query_position < query_length) | |
136 | + { | |
137 | + if(current == query[query_position]) // found pair quote | |
138 | + { | |
139 | + break; | |
140 | + } | |
141 | + buffer[position++] = query[query_position++]; // copy current symbol | |
142 | + } | |
143 | + break; | |
144 | + } | |
145 | + case '/': | |
146 | + { | |
147 | + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2])) | |
148 | + { | |
149 | + query_position += 2; // skip "/*" | |
150 | + do | |
151 | + { | |
152 | + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/" | |
153 | + { | |
154 | + query_position += 2; // skip "*/" | |
155 | + insert_space = true; | |
156 | + break; | |
157 | + } | |
158 | + else | |
159 | + { | |
160 | + ++query_position; | |
161 | + } | |
162 | + } | |
163 | + while(query_position < query_length); | |
164 | + if(!insert_space) | |
165 | + { | |
166 | + continue; | |
167 | + } | |
168 | + } | |
169 | + break; | |
170 | + } | |
171 | + case '-': | |
172 | + { | |
173 | + if(query[query_position+1] == '-') | |
174 | + { | |
175 | + ++query_position; // skip "-", and go to search of "\n" | |
176 | + } | |
177 | + else | |
178 | + { | |
179 | + break; | |
180 | + } | |
181 | + } | |
182 | + case '#': | |
183 | + { | |
184 | + do | |
185 | + { | |
186 | + ++query_position; // skip current symbol (# or -) | |
187 | + if('\n' == query[query_position]) // check for '\n' | |
188 | + { | |
189 | + ++query_position; // skip '\n' | |
190 | + insert_space = true; | |
191 | + break; | |
192 | + } | |
193 | + } | |
194 | + while(query_position < query_length); | |
195 | + if(insert_space) | |
196 | + { | |
197 | + break; | |
198 | + } | |
199 | + else | |
200 | + { | |
201 | + continue; | |
202 | + } | |
203 | + } | |
204 | + default: | |
205 | + if(query_strip_comments_is_white_space(current)) | |
206 | + { | |
207 | + insert_space = true; | |
208 | + ++query_position; | |
209 | + } | |
210 | + break; // make gcc happy | |
211 | + } | |
212 | + if(insert_space) | |
213 | + { | |
214 | + if((last_space + 1) != position) | |
215 | + { | |
216 | + last_space = position; | |
217 | + buffer[position++] = ' '; | |
218 | + } | |
219 | + } | |
220 | + else | |
221 | + { | |
222 | + buffer[position++] = query[query_position++]; | |
223 | + } | |
224 | + } | |
225 | + while((0 < position) && query_strip_comments_is_white_space(buffer[position - 1])) | |
226 | + { | |
227 | + --position; | |
228 | + } | |
229 | + buffer[position] = 0; | |
230 | + length = position; | |
231 | +} | |
232 | +void QueryStripComments::cleanup() | |
233 | +{ | |
234 | + if(buffer) | |
235 | + { | |
236 | + my_free(buffer); | |
237 | + } | |
238 | + buffer = 0; | |
239 | + length = 0; | |
240 | + buffer_length = 0; | |
241 | +} | |
242 | +QueryStripComments_Backup::QueryStripComments_Backup(THD* a_thd,QueryStripComments* qsc) | |
243 | +{ | |
244 | + if(opt_query_cache_strip_comments) | |
245 | + { | |
246 | + thd = a_thd; | |
247 | + query = thd->query(); | |
248 | + length = thd->query_length(); | |
249 | + qsc->set(query,length,thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE); | |
250 | + thd->set_query(qsc->query(),qsc->query_length()); | |
251 | + } | |
252 | + else | |
253 | + { | |
254 | + thd = 0; | |
255 | + query = 0; | |
256 | + length = 0; | |
257 | + } | |
258 | +} | |
259 | +QueryStripComments_Backup::~QueryStripComments_Backup() | |
260 | +{ | |
261 | + if(thd) | |
262 | + { | |
263 | + thd->set_query(query,length); | |
264 | + } | |
265 | +} | |
266 | + | |
267 | #ifdef EMBEDDED_LIBRARY | |
268 | #include "emb_qcache.h" | |
269 | #endif | |
9dd04cbc | 270 | @@ -454,7 +629,12 @@ |
b4e1fa2c AM |
271 | Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__); |
272 | DBUG_ENTER("Query_cache::try_lock"); | |
273 | ||
274 | + const char* old_proc_info= thd->proc_info; | |
275 | + thd_proc_info(thd,"Waiting on query cache mutex"); | |
9dd04cbc | 276 | + DEBUG_SYNC(thd, "before_query_cache_mutex"); |
b4e1fa2c | 277 | mysql_mutex_lock(&structure_guard_mutex); |
9dd04cbc | 278 | + DEBUG_SYNC(thd, "after_query_cache_mutex"); |
db82db79 | 279 | + thd->proc_info = old_proc_info; |
b4e1fa2c AM |
280 | while (1) |
281 | { | |
282 | if (m_cache_lock_status == Query_cache::UNLOCKED) | |
9dd04cbc | 283 | @@ -1274,6 +1454,8 @@ |
b4e1fa2c AM |
284 | unlock(); |
285 | DBUG_VOID_RETURN; | |
286 | } | |
287 | + QueryStripComments *query_strip_comments = &(thd->query_strip_comments); | |
288 | + QueryStripComments_Backup backup(thd,query_strip_comments); | |
289 | ||
290 | /* Key is query + database + flag */ | |
291 | if (thd->db_length) | |
9dd04cbc | 292 | @@ -1451,6 +1633,9 @@ |
b4e1fa2c AM |
293 | Query_cache_block_table *block_table, *block_table_end; |
294 | ulong tot_length; | |
295 | Query_cache_query_flags flags; | |
296 | + QueryStripComments *query_strip_comments = &(thd->query_strip_comments); | |
297 | + char *sql_backup = sql; | |
298 | + uint query_length_backup = query_length; | |
299 | DBUG_ENTER("Query_cache::send_result_to_client"); | |
300 | ||
301 | /* | |
9dd04cbc | 302 | @@ -1472,21 +1657,103 @@ |
b4e1fa2c AM |
303 | |
304 | { | |
305 | uint i= 0; | |
306 | - /* | |
307 | - Skip '(' characters in queries like following: | |
308 | - (select a from t1) union (select a from t1); | |
309 | - */ | |
310 | - while (sql[i]=='(') | |
311 | - i++; | |
312 | + if(opt_query_cache_strip_comments) | |
313 | + { | |
314 | + /* Skip all comments and non-letter symbols */ | |
315 | + uint& query_position = i; | |
316 | + char* query = sql; | |
317 | + while(query_position < query_length) | |
318 | + { | |
319 | + bool check = false; | |
320 | + char current = query[query_position]; | |
321 | + switch(current) | |
322 | + { | |
323 | + case '/': | |
324 | + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2])) | |
325 | + { | |
326 | + query_position += 2; // skip "/*" | |
327 | + do | |
328 | + { | |
329 | + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/" (without space) | |
330 | + { | |
331 | + query_position += 2; // skip "*/" (without space) | |
332 | + break; | |
333 | + } | |
334 | + else | |
335 | + { | |
336 | + ++query_position; | |
337 | + } | |
338 | + } | |
339 | + while(query_position < query_length); | |
340 | + continue; // analyze current symbol | |
341 | + } | |
342 | + break; | |
343 | + case '-': | |
344 | + if(query[query_position+1] == '-') | |
345 | + { | |
346 | + ++query_position; // skip "-" | |
347 | + } | |
348 | + else | |
349 | + { | |
350 | + break; | |
351 | + } | |
352 | + case '#': | |
353 | + do | |
354 | + { | |
355 | + ++query_position; // skip current symbol | |
356 | + if('\n' == query[query_position]) // check for '\n' | |
357 | + { | |
358 | + ++query_position; // skip '\n' | |
359 | + break; | |
360 | + } | |
361 | + } | |
362 | + while(query_position < query_length); | |
363 | + continue; // analyze current symbol | |
364 | + case '\r': | |
365 | + case '\n': | |
366 | + case '\t': | |
367 | + case ' ': | |
368 | + case '(': | |
369 | + case ')': | |
370 | + break; | |
371 | + default: | |
372 | + check = true; | |
373 | + break; // make gcc happy | |
374 | + } // switch(current) | |
375 | + if(check) | |
376 | + { | |
377 | + if(query_position + 2 < query_length) | |
378 | + { | |
379 | + // cacheable | |
380 | + break; | |
381 | + } | |
382 | + else | |
383 | + { | |
384 | + DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached")); | |
385 | + goto err; | |
386 | + } | |
387 | + } // if(check) | |
388 | + ++query_position; | |
389 | + } // while(query_position < query_length) | |
390 | + } | |
391 | + else // if(opt_query_cache_strip_comments) | |
392 | + { | |
393 | + /* | |
394 | + Skip '(' characters in queries like following: | |
395 | + (select a from t1) union (select a from t1); | |
396 | + */ | |
397 | + while (sql[i]=='(') | |
398 | + i++; | |
399 | ||
400 | - /* | |
401 | - Test if the query is a SELECT | |
402 | - (pre-space is removed in dispatch_command). | |
403 | + } // if(opt_query_cache_strip_comments) | |
404 | + /* | |
405 | + Test if the query is a SELECT | |
406 | + (pre-space is removed in dispatch_command). | |
407 | ||
408 | - First '/' looks like comment before command it is not | |
409 | - frequently appeared in real life, consequently we can | |
410 | - check all such queries, too. | |
411 | - */ | |
412 | + First '/' looks like comment before command it is not | |
413 | + frequently appeared in real life, consequently we can | |
414 | + check all such queries, too. | |
415 | + */ | |
416 | if ((my_toupper(system_charset_info, sql[i]) != 'S' || | |
417 | my_toupper(system_charset_info, sql[i + 1]) != 'E' || | |
418 | my_toupper(system_charset_info, sql[i + 2]) != 'L') && | |
9dd04cbc | 419 | @@ -1521,6 +1788,12 @@ |
b4e1fa2c AM |
420 | goto err_unlock; |
421 | ||
422 | Query_cache_block *query_block; | |
423 | + if(opt_query_cache_strip_comments) | |
424 | + { | |
425 | + query_strip_comments->set(sql, query_length, thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE); | |
426 | + sql = query_strip_comments->query(); | |
427 | + query_length = query_strip_comments->query_length(); | |
428 | + } | |
429 | ||
430 | tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE; | |
431 | if (thd->db_length) | |
9dd04cbc | 432 | @@ -1587,6 +1860,8 @@ |
b4e1fa2c AM |
433 | (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE); |
434 | query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql, | |
435 | tot_length); | |
436 | + sql = sql_backup; | |
437 | + query_length = query_length_backup; | |
438 | /* Quick abort on unlocked data */ | |
439 | if (query_block == 0 || | |
440 | query_block->query()->result() == 0 || | |
db82db79 AM |
441 | --- a/sql/sql_class.h |
442 | +++ b/sql/sql_class.h | |
b4e1fa2c AM |
443 | @@ -40,6 +40,9 @@ |
444 | #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, | |
445 | THR_LOCK_INFO */ | |
446 | ||
447 | +#ifdef HAVE_QUERY_CACHE | |
448 | +#include "query_strip_comments.h" | |
449 | +#endif // HAVE_QUERY_CACHE | |
450 | ||
451 | class Reprepare_observer; | |
452 | class Relay_log_info; | |
734d6226 | 453 | @@ -764,6 +767,9 @@ |
b4e1fa2c AM |
454 | statement lifetime. FIXME: must be const |
455 | */ | |
456 | ulong id; | |
457 | +#ifdef HAVE_QUERY_CACHE | |
458 | + QueryStripComments query_strip_comments; // see sql_cache.cc | |
459 | +#endif //HAVE_QUERY_CACHE | |
460 | ||
461 | /* | |
462 | MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to | |
db82db79 AM |
463 | --- a/sql/sys_vars.cc |
464 | +++ b/sql/sys_vars.cc | |
734d6226 | 465 | @@ -1809,6 +1809,11 @@ |
b4e1fa2c AM |
466 | NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), |
467 | ON_UPDATE(fix_query_cache_size)); | |
468 | ||
469 | +static Sys_var_mybool Sys_query_cache_strip_comments( | |
470 | + "query_cache_strip_comments", "Enable and disable optimisation \"strip comment for query cache\" - optimisation strip all comments from query while search query result in query cache", | |
471 | + GLOBAL_VAR(opt_query_cache_strip_comments), CMD_LINE(OPT_ARG), | |
472 | + DEFAULT(FALSE)); | |
473 | + | |
474 | static Sys_var_ulong Sys_query_cache_limit( | |
475 | "query_cache_limit", | |
476 | "Don't cache results that are bigger than this", | |
48b678b4 AM |
477 | --- /dev/null |
478 | +++ b/mysql-test/include/percona_query_cache_with_comments.inc | |
479 | @@ -0,0 +1,95 @@ | |
480 | +--source include/percona_query_cache_with_comments_clear.inc | |
481 | +let $query=/* with comment first */select * from t1; | |
482 | +eval $query; | |
483 | +--source include/percona_query_cache_with_comments_eval.inc | |
484 | + | |
485 | +let $query=# with comment first | |
486 | +select * from t1; | |
487 | +--source include/percona_query_cache_with_comments_eval.inc | |
488 | + | |
489 | +let $query=-- with comment first | |
490 | +select * from t1; | |
491 | +--source include/percona_query_cache_with_comments_eval.inc | |
492 | + | |
493 | +let $query=/* with comment first and "quote" */select * from t1; | |
494 | +--source include/percona_query_cache_with_comments_eval.inc | |
495 | + | |
496 | +let $query=# with comment first and "quote" | |
497 | +select * from t1; | |
498 | +--source include/percona_query_cache_with_comments_eval.inc | |
499 | + | |
500 | +let $query=-- with comment first and "quote" | |
501 | +select * from t1; | |
502 | +--source include/percona_query_cache_with_comments_eval.inc | |
503 | + | |
504 | +let $query= | |
505 | + /* with comment and whitespaces first */select * from t1; | |
506 | +--source include/percona_query_cache_with_comments_eval.inc | |
507 | + | |
508 | +let $query= | |
509 | + # with comment and whitespaces first | |
510 | +select * from t1; | |
511 | +--source include/percona_query_cache_with_comments_eval.inc | |
512 | + | |
513 | +let $query= | |
514 | + -- with comment and whitespaces first | |
515 | +select * from t1; | |
516 | +--source include/percona_query_cache_with_comments_eval.inc | |
517 | + | |
518 | +let $internal=* internal comment *; | |
519 | + | |
520 | +let $query=select * /$internal/ from t1; | |
521 | +--source include/percona_query_cache_with_comments_eval.inc | |
522 | +let $query=select */$internal/ from t1; | |
523 | +--source include/percona_query_cache_with_comments_eval.inc | |
524 | +let $query=select */$internal/from t1; | |
525 | +--source include/percona_query_cache_with_comments_eval.inc | |
526 | + | |
527 | +let $internal=* internal comment with "quote" *; | |
528 | + | |
529 | +let $query=select * /$internal/ from t1; | |
530 | +--source include/percona_query_cache_with_comments_eval.inc | |
531 | +let $query=select */$internal/ from t1; | |
532 | +--source include/percona_query_cache_with_comments_eval.inc | |
533 | +let $query=select */$internal/from t1; | |
534 | +--source include/percona_query_cache_with_comments_eval.inc | |
535 | + | |
536 | +let $query=select * from t1 | |
537 | +; | |
538 | +--source include/percona_query_cache_with_comments_eval.inc | |
539 | + | |
540 | +let $query=select * from t1 ; | |
541 | +--source include/percona_query_cache_with_comments_eval.inc | |
542 | + | |
543 | +let $query=select * from t1 ; | |
544 | +--source include/percona_query_cache_with_comments_eval.inc | |
545 | + | |
546 | +let $query=select * from t1 | |
547 | +/* comment in the end */; | |
548 | +--source include/percona_query_cache_with_comments_eval.inc | |
549 | + | |
550 | +let $query=select * from t1 | |
551 | +/* *\/ */; | |
552 | +--source include/percona_query_cache_with_comments_eval.inc | |
553 | + | |
554 | +let $query=select * from t1 | |
555 | +/* comment in the end */ | |
556 | +; | |
557 | +--source include/percona_query_cache_with_comments_eval.inc | |
558 | + | |
559 | +let $query=select * from t1 #comment in the end; | |
560 | +--source include/percona_query_cache_with_comments_eval.inc | |
561 | + | |
562 | +let $query=select * from t1 #comment in the end | |
563 | +; | |
564 | +--source include/percona_query_cache_with_comments_eval.inc | |
565 | + | |
566 | +let $query=select * from t1 -- comment in the end; | |
567 | +--source include/percona_query_cache_with_comments_eval.inc | |
568 | + | |
569 | +let $query=select * from t1 -- comment in the end | |
570 | +; | |
571 | +--source include/percona_query_cache_with_comments_eval.inc | |
572 | + | |
573 | +let $query=select ' \' ' from t1; | |
574 | +--source include/percona_query_cache_with_comments_eval.inc | |
575 | --- /dev/null | |
576 | +++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc | |
577 | @@ -0,0 +1,12 @@ | |
578 | +-- source include/have_query_cache.inc | |
579 | + | |
580 | +set GLOBAL query_cache_size=1355776; | |
581 | + | |
582 | +--disable_warnings | |
583 | +drop table if exists t1; | |
584 | +--enable_warnings | |
585 | + | |
586 | +create table t1 (a int not null); | |
587 | +insert into t1 values (1),(2),(3); | |
588 | + | |
589 | +--source include/percona_query_cache_with_comments_clear.inc | |
590 | --- /dev/null | |
591 | +++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc | |
592 | @@ -0,0 +1,5 @@ | |
593 | +# Reset query cache variables. | |
594 | +flush query cache; # This crashed in some versions | |
595 | +flush query cache; # This crashed in some versions | |
596 | +reset query cache; | |
597 | +flush status; | |
598 | --- /dev/null | |
599 | +++ b/mysql-test/include/percona_query_cache_with_comments_end.inc | |
600 | @@ -0,0 +1,3 @@ | |
601 | +DROP TABLE t1; | |
602 | +SET GLOBAL query_cache_size=default; | |
603 | +set global query_cache_strip_comments=OFF; | |
604 | --- /dev/null | |
605 | +++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc | |
606 | @@ -0,0 +1,7 @@ | |
607 | +echo -----------------------------------------------------; | |
608 | +echo $query; | |
609 | +echo -----------------------------------------------------; | |
610 | +--source include/percona_query_cache_with_comments_show.inc | |
611 | +eval $query; | |
612 | +eval $query; | |
613 | +--source include/percona_query_cache_with_comments_show.inc | |
614 | --- /dev/null | |
615 | +++ b/mysql-test/include/percona_query_cache_with_comments_show.inc | |
616 | @@ -0,0 +1,8 @@ | |
617 | +let $show=show status like "Qcache_queries_in_cache"; | |
618 | +eval $show; | |
619 | +let $show=show status like "Qcache_inserts"; | |
620 | +eval $show; | |
621 | +let $show=show status like "Qcache_hits"; | |
622 | +eval $show; | |
623 | + | |
624 | + | |
625 | --- /dev/null | |
626 | +++ b/mysql-test/r/percona_query_cache_with_comments.result | |
627 | @@ -0,0 +1,866 @@ | |
628 | +set global query_cache_strip_comments=ON; | |
629 | +set GLOBAL query_cache_size=1355776; | |
630 | +drop table if exists t1; | |
631 | +create table t1 (a int not null); | |
632 | +insert into t1 values (1),(2),(3); | |
633 | +flush query cache; | |
634 | +flush query cache; | |
635 | +reset query cache; | |
636 | +flush status; | |
637 | +flush query cache; | |
638 | +flush query cache; | |
639 | +reset query cache; | |
640 | +flush status; | |
641 | +/* with comment first */select * from t1; | |
642 | +a | |
643 | +1 | |
644 | +2 | |
645 | +3 | |
646 | +----------------------------------------------------- | |
647 | +/* with comment first */select * from t1 | |
648 | +----------------------------------------------------- | |
649 | +show status like "Qcache_queries_in_cache"; | |
650 | +Variable_name Value | |
651 | +Qcache_queries_in_cache 1 | |
652 | +show status like "Qcache_inserts"; | |
653 | +Variable_name Value | |
654 | +Qcache_inserts 1 | |
655 | +show status like "Qcache_hits"; | |
656 | +Variable_name Value | |
657 | +Qcache_hits 0 | |
658 | +/* with comment first */select * from t1; | |
659 | +a | |
660 | +1 | |
661 | +2 | |
662 | +3 | |
663 | +/* with comment first */select * from t1; | |
664 | +a | |
665 | +1 | |
666 | +2 | |
667 | +3 | |
668 | +show status like "Qcache_queries_in_cache"; | |
669 | +Variable_name Value | |
670 | +Qcache_queries_in_cache 1 | |
671 | +show status like "Qcache_inserts"; | |
672 | +Variable_name Value | |
673 | +Qcache_inserts 1 | |
674 | +show status like "Qcache_hits"; | |
675 | +Variable_name Value | |
676 | +Qcache_hits 2 | |
677 | +----------------------------------------------------- | |
678 | +# with comment first | |
679 | +select * from t1 | |
680 | +----------------------------------------------------- | |
681 | +show status like "Qcache_queries_in_cache"; | |
682 | +Variable_name Value | |
683 | +Qcache_queries_in_cache 1 | |
684 | +show status like "Qcache_inserts"; | |
685 | +Variable_name Value | |
686 | +Qcache_inserts 1 | |
687 | +show status like "Qcache_hits"; | |
688 | +Variable_name Value | |
689 | +Qcache_hits 2 | |
690 | +# with comment first | |
691 | +select * from t1; | |
692 | +a | |
693 | +1 | |
694 | +2 | |
695 | +3 | |
696 | +# with comment first | |
697 | +select * from t1; | |
698 | +a | |
699 | +1 | |
700 | +2 | |
701 | +3 | |
702 | +show status like "Qcache_queries_in_cache"; | |
703 | +Variable_name Value | |
704 | +Qcache_queries_in_cache 1 | |
705 | +show status like "Qcache_inserts"; | |
706 | +Variable_name Value | |
707 | +Qcache_inserts 1 | |
708 | +show status like "Qcache_hits"; | |
709 | +Variable_name Value | |
710 | +Qcache_hits 4 | |
711 | +----------------------------------------------------- | |
712 | +-- with comment first | |
713 | +select * from t1 | |
714 | +----------------------------------------------------- | |
715 | +show status like "Qcache_queries_in_cache"; | |
716 | +Variable_name Value | |
717 | +Qcache_queries_in_cache 1 | |
718 | +show status like "Qcache_inserts"; | |
719 | +Variable_name Value | |
720 | +Qcache_inserts 1 | |
721 | +show status like "Qcache_hits"; | |
722 | +Variable_name Value | |
723 | +Qcache_hits 4 | |
724 | +-- with comment first | |
725 | +select * from t1; | |
726 | +a | |
727 | +1 | |
728 | +2 | |
729 | +3 | |
730 | +-- with comment first | |
731 | +select * from t1; | |
732 | +a | |
733 | +1 | |
734 | +2 | |
735 | +3 | |
736 | +show status like "Qcache_queries_in_cache"; | |
737 | +Variable_name Value | |
738 | +Qcache_queries_in_cache 1 | |
739 | +show status like "Qcache_inserts"; | |
740 | +Variable_name Value | |
741 | +Qcache_inserts 1 | |
742 | +show status like "Qcache_hits"; | |
743 | +Variable_name Value | |
744 | +Qcache_hits 6 | |
745 | +----------------------------------------------------- | |
746 | +/* with comment first and "quote" */select * from t1 | |
747 | +----------------------------------------------------- | |
748 | +show status like "Qcache_queries_in_cache"; | |
749 | +Variable_name Value | |
750 | +Qcache_queries_in_cache 1 | |
751 | +show status like "Qcache_inserts"; | |
752 | +Variable_name Value | |
753 | +Qcache_inserts 1 | |
754 | +show status like "Qcache_hits"; | |
755 | +Variable_name Value | |
756 | +Qcache_hits 6 | |
757 | +/* with comment first and "quote" */select * from t1; | |
758 | +a | |
759 | +1 | |
760 | +2 | |
761 | +3 | |
762 | +/* with comment first and "quote" */select * from t1; | |
763 | +a | |
764 | +1 | |
765 | +2 | |
766 | +3 | |
767 | +show status like "Qcache_queries_in_cache"; | |
768 | +Variable_name Value | |
769 | +Qcache_queries_in_cache 1 | |
770 | +show status like "Qcache_inserts"; | |
771 | +Variable_name Value | |
772 | +Qcache_inserts 1 | |
773 | +show status like "Qcache_hits"; | |
774 | +Variable_name Value | |
775 | +Qcache_hits 8 | |
776 | +----------------------------------------------------- | |
777 | +# with comment first and "quote" | |
778 | +select * from t1 | |
779 | +----------------------------------------------------- | |
780 | +show status like "Qcache_queries_in_cache"; | |
781 | +Variable_name Value | |
782 | +Qcache_queries_in_cache 1 | |
783 | +show status like "Qcache_inserts"; | |
784 | +Variable_name Value | |
785 | +Qcache_inserts 1 | |
786 | +show status like "Qcache_hits"; | |
787 | +Variable_name Value | |
788 | +Qcache_hits 8 | |
789 | +# with comment first and "quote" | |
790 | +select * from t1; | |
791 | +a | |
792 | +1 | |
793 | +2 | |
794 | +3 | |
795 | +# with comment first and "quote" | |
796 | +select * from t1; | |
797 | +a | |
798 | +1 | |
799 | +2 | |
800 | +3 | |
801 | +show status like "Qcache_queries_in_cache"; | |
802 | +Variable_name Value | |
803 | +Qcache_queries_in_cache 1 | |
804 | +show status like "Qcache_inserts"; | |
805 | +Variable_name Value | |
806 | +Qcache_inserts 1 | |
807 | +show status like "Qcache_hits"; | |
808 | +Variable_name Value | |
809 | +Qcache_hits 10 | |
810 | +----------------------------------------------------- | |
811 | +-- with comment first and "quote" | |
812 | +select * from t1 | |
813 | +----------------------------------------------------- | |
814 | +show status like "Qcache_queries_in_cache"; | |
815 | +Variable_name Value | |
816 | +Qcache_queries_in_cache 1 | |
817 | +show status like "Qcache_inserts"; | |
818 | +Variable_name Value | |
819 | +Qcache_inserts 1 | |
820 | +show status like "Qcache_hits"; | |
821 | +Variable_name Value | |
822 | +Qcache_hits 10 | |
823 | +-- with comment first and "quote" | |
824 | +select * from t1; | |
825 | +a | |
826 | +1 | |
827 | +2 | |
828 | +3 | |
829 | +-- with comment first and "quote" | |
830 | +select * from t1; | |
831 | +a | |
832 | +1 | |
833 | +2 | |
834 | +3 | |
835 | +show status like "Qcache_queries_in_cache"; | |
836 | +Variable_name Value | |
837 | +Qcache_queries_in_cache 1 | |
838 | +show status like "Qcache_inserts"; | |
839 | +Variable_name Value | |
840 | +Qcache_inserts 1 | |
841 | +show status like "Qcache_hits"; | |
842 | +Variable_name Value | |
843 | +Qcache_hits 12 | |
844 | +----------------------------------------------------- | |
845 | +/* with comment and whitespaces first */select * from t1 | |
846 | +----------------------------------------------------- | |
847 | +show status like "Qcache_queries_in_cache"; | |
848 | +Variable_name Value | |
849 | +Qcache_queries_in_cache 1 | |
850 | +show status like "Qcache_inserts"; | |
851 | +Variable_name Value | |
852 | +Qcache_inserts 1 | |
853 | +show status like "Qcache_hits"; | |
854 | +Variable_name Value | |
855 | +Qcache_hits 12 | |
856 | +/* with comment and whitespaces first */select * from t1; | |
857 | +a | |
858 | +1 | |
859 | +2 | |
860 | +3 | |
861 | +/* with comment and whitespaces first */select * from t1; | |
862 | +a | |
863 | +1 | |
864 | +2 | |
865 | +3 | |
866 | +show status like "Qcache_queries_in_cache"; | |
867 | +Variable_name Value | |
868 | +Qcache_queries_in_cache 1 | |
869 | +show status like "Qcache_inserts"; | |
870 | +Variable_name Value | |
871 | +Qcache_inserts 1 | |
872 | +show status like "Qcache_hits"; | |
873 | +Variable_name Value | |
874 | +Qcache_hits 14 | |
875 | +----------------------------------------------------- | |
876 | +# with comment and whitespaces first | |
877 | +select * from t1 | |
878 | +----------------------------------------------------- | |
879 | +show status like "Qcache_queries_in_cache"; | |
880 | +Variable_name Value | |
881 | +Qcache_queries_in_cache 1 | |
882 | +show status like "Qcache_inserts"; | |
883 | +Variable_name Value | |
884 | +Qcache_inserts 1 | |
885 | +show status like "Qcache_hits"; | |
886 | +Variable_name Value | |
887 | +Qcache_hits 14 | |
888 | +# with comment and whitespaces first | |
889 | +select * from t1; | |
890 | +a | |
891 | +1 | |
892 | +2 | |
893 | +3 | |
894 | +# with comment and whitespaces first | |
895 | +select * from t1; | |
896 | +a | |
897 | +1 | |
898 | +2 | |
899 | +3 | |
900 | +show status like "Qcache_queries_in_cache"; | |
901 | +Variable_name Value | |
902 | +Qcache_queries_in_cache 1 | |
903 | +show status like "Qcache_inserts"; | |
904 | +Variable_name Value | |
905 | +Qcache_inserts 1 | |
906 | +show status like "Qcache_hits"; | |
907 | +Variable_name Value | |
908 | +Qcache_hits 16 | |
909 | +----------------------------------------------------- | |
910 | +-- with comment and whitespaces first | |
911 | +select * from t1 | |
912 | +----------------------------------------------------- | |
913 | +show status like "Qcache_queries_in_cache"; | |
914 | +Variable_name Value | |
915 | +Qcache_queries_in_cache 1 | |
916 | +show status like "Qcache_inserts"; | |
917 | +Variable_name Value | |
918 | +Qcache_inserts 1 | |
919 | +show status like "Qcache_hits"; | |
920 | +Variable_name Value | |
921 | +Qcache_hits 16 | |
922 | +-- with comment and whitespaces first | |
923 | +select * from t1; | |
924 | +a | |
925 | +1 | |
926 | +2 | |
927 | +3 | |
928 | +-- with comment and whitespaces first | |
929 | +select * from t1; | |
930 | +a | |
931 | +1 | |
932 | +2 | |
933 | +3 | |
934 | +show status like "Qcache_queries_in_cache"; | |
935 | +Variable_name Value | |
936 | +Qcache_queries_in_cache 1 | |
937 | +show status like "Qcache_inserts"; | |
938 | +Variable_name Value | |
939 | +Qcache_inserts 1 | |
940 | +show status like "Qcache_hits"; | |
941 | +Variable_name Value | |
942 | +Qcache_hits 18 | |
943 | +----------------------------------------------------- | |
944 | +select * /* internal comment */ from t1 | |
945 | +----------------------------------------------------- | |
946 | +show status like "Qcache_queries_in_cache"; | |
947 | +Variable_name Value | |
948 | +Qcache_queries_in_cache 1 | |
949 | +show status like "Qcache_inserts"; | |
950 | +Variable_name Value | |
951 | +Qcache_inserts 1 | |
952 | +show status like "Qcache_hits"; | |
953 | +Variable_name Value | |
954 | +Qcache_hits 18 | |
955 | +select * /* internal comment */ from t1; | |
956 | +a | |
957 | +1 | |
958 | +2 | |
959 | +3 | |
960 | +select * /* internal comment */ from t1; | |
961 | +a | |
962 | +1 | |
963 | +2 | |
964 | +3 | |
965 | +show status like "Qcache_queries_in_cache"; | |
966 | +Variable_name Value | |
967 | +Qcache_queries_in_cache 1 | |
968 | +show status like "Qcache_inserts"; | |
969 | +Variable_name Value | |
970 | +Qcache_inserts 1 | |
971 | +show status like "Qcache_hits"; | |
972 | +Variable_name Value | |
973 | +Qcache_hits 20 | |
974 | +----------------------------------------------------- | |
975 | +select */* internal comment */ from t1 | |
976 | +----------------------------------------------------- | |
977 | +show status like "Qcache_queries_in_cache"; | |
978 | +Variable_name Value | |
979 | +Qcache_queries_in_cache 1 | |
980 | +show status like "Qcache_inserts"; | |
981 | +Variable_name Value | |
982 | +Qcache_inserts 1 | |
983 | +show status like "Qcache_hits"; | |
984 | +Variable_name Value | |
985 | +Qcache_hits 20 | |
986 | +select */* internal comment */ from t1; | |
987 | +a | |
988 | +1 | |
989 | +2 | |
990 | +3 | |
991 | +select */* internal comment */ from t1; | |
992 | +a | |
993 | +1 | |
994 | +2 | |
995 | +3 | |
996 | +show status like "Qcache_queries_in_cache"; | |
997 | +Variable_name Value | |
998 | +Qcache_queries_in_cache 1 | |
999 | +show status like "Qcache_inserts"; | |
1000 | +Variable_name Value | |
1001 | +Qcache_inserts 1 | |
1002 | +show status like "Qcache_hits"; | |
1003 | +Variable_name Value | |
1004 | +Qcache_hits 22 | |
1005 | +----------------------------------------------------- | |
1006 | +select */* internal comment */from t1 | |
1007 | +----------------------------------------------------- | |
1008 | +show status like "Qcache_queries_in_cache"; | |
1009 | +Variable_name Value | |
1010 | +Qcache_queries_in_cache 1 | |
1011 | +show status like "Qcache_inserts"; | |
1012 | +Variable_name Value | |
1013 | +Qcache_inserts 1 | |
1014 | +show status like "Qcache_hits"; | |
1015 | +Variable_name Value | |
1016 | +Qcache_hits 22 | |
1017 | +select */* internal comment */from t1; | |
1018 | +a | |
1019 | +1 | |
1020 | +2 | |
1021 | +3 | |
1022 | +select */* internal comment */from t1; | |
1023 | +a | |
1024 | +1 | |
1025 | +2 | |
1026 | +3 | |
1027 | +show status like "Qcache_queries_in_cache"; | |
1028 | +Variable_name Value | |
1029 | +Qcache_queries_in_cache 1 | |
1030 | +show status like "Qcache_inserts"; | |
1031 | +Variable_name Value | |
1032 | +Qcache_inserts 1 | |
1033 | +show status like "Qcache_hits"; | |
1034 | +Variable_name Value | |
1035 | +Qcache_hits 24 | |
1036 | +----------------------------------------------------- | |
1037 | +select * /* internal comment with "quote" */ from t1 | |
1038 | +----------------------------------------------------- | |
1039 | +show status like "Qcache_queries_in_cache"; | |
1040 | +Variable_name Value | |
1041 | +Qcache_queries_in_cache 1 | |
1042 | +show status like "Qcache_inserts"; | |
1043 | +Variable_name Value | |
1044 | +Qcache_inserts 1 | |
1045 | +show status like "Qcache_hits"; | |
1046 | +Variable_name Value | |
1047 | +Qcache_hits 24 | |
1048 | +select * /* internal comment with "quote" */ from t1; | |
1049 | +a | |
1050 | +1 | |
1051 | +2 | |
1052 | +3 | |
1053 | +select * /* internal comment with "quote" */ from t1; | |
1054 | +a | |
1055 | +1 | |
1056 | +2 | |
1057 | +3 | |
1058 | +show status like "Qcache_queries_in_cache"; | |
1059 | +Variable_name Value | |
1060 | +Qcache_queries_in_cache 1 | |
1061 | +show status like "Qcache_inserts"; | |
1062 | +Variable_name Value | |
1063 | +Qcache_inserts 1 | |
1064 | +show status like "Qcache_hits"; | |
1065 | +Variable_name Value | |
1066 | +Qcache_hits 26 | |
1067 | +----------------------------------------------------- | |
1068 | +select */* internal comment with "quote" */ from t1 | |
1069 | +----------------------------------------------------- | |
1070 | +show status like "Qcache_queries_in_cache"; | |
1071 | +Variable_name Value | |
1072 | +Qcache_queries_in_cache 1 | |
1073 | +show status like "Qcache_inserts"; | |
1074 | +Variable_name Value | |
1075 | +Qcache_inserts 1 | |
1076 | +show status like "Qcache_hits"; | |
1077 | +Variable_name Value | |
1078 | +Qcache_hits 26 | |
1079 | +select */* internal comment with "quote" */ from t1; | |
1080 | +a | |
1081 | +1 | |
1082 | +2 | |
1083 | +3 | |
1084 | +select */* internal comment with "quote" */ from t1; | |
1085 | +a | |
1086 | +1 | |
1087 | +2 | |
1088 | +3 | |
1089 | +show status like "Qcache_queries_in_cache"; | |
1090 | +Variable_name Value | |
1091 | +Qcache_queries_in_cache 1 | |
1092 | +show status like "Qcache_inserts"; | |
1093 | +Variable_name Value | |
1094 | +Qcache_inserts 1 | |
1095 | +show status like "Qcache_hits"; | |
1096 | +Variable_name Value | |
1097 | +Qcache_hits 28 | |
1098 | +----------------------------------------------------- | |
1099 | +select */* internal comment with "quote" */from t1 | |
1100 | +----------------------------------------------------- | |
1101 | +show status like "Qcache_queries_in_cache"; | |
1102 | +Variable_name Value | |
1103 | +Qcache_queries_in_cache 1 | |
1104 | +show status like "Qcache_inserts"; | |
1105 | +Variable_name Value | |
1106 | +Qcache_inserts 1 | |
1107 | +show status like "Qcache_hits"; | |
1108 | +Variable_name Value | |
1109 | +Qcache_hits 28 | |
1110 | +select */* internal comment with "quote" */from t1; | |
1111 | +a | |
1112 | +1 | |
1113 | +2 | |
1114 | +3 | |
1115 | +select */* internal comment with "quote" */from t1; | |
1116 | +a | |
1117 | +1 | |
1118 | +2 | |
1119 | +3 | |
1120 | +show status like "Qcache_queries_in_cache"; | |
1121 | +Variable_name Value | |
1122 | +Qcache_queries_in_cache 1 | |
1123 | +show status like "Qcache_inserts"; | |
1124 | +Variable_name Value | |
1125 | +Qcache_inserts 1 | |
1126 | +show status like "Qcache_hits"; | |
1127 | +Variable_name Value | |
1128 | +Qcache_hits 30 | |
1129 | +----------------------------------------------------- | |
1130 | +select * from t1 | |
1131 | + | |
1132 | +----------------------------------------------------- | |
1133 | +show status like "Qcache_queries_in_cache"; | |
1134 | +Variable_name Value | |
1135 | +Qcache_queries_in_cache 1 | |
1136 | +show status like "Qcache_inserts"; | |
1137 | +Variable_name Value | |
1138 | +Qcache_inserts 1 | |
1139 | +show status like "Qcache_hits"; | |
1140 | +Variable_name Value | |
1141 | +Qcache_hits 30 | |
1142 | +select * from t1 | |
1143 | +; | |
1144 | +a | |
1145 | +1 | |
1146 | +2 | |
1147 | +3 | |
1148 | +select * from t1 | |
1149 | +; | |
1150 | +a | |
1151 | +1 | |
1152 | +2 | |
1153 | +3 | |
1154 | +show status like "Qcache_queries_in_cache"; | |
1155 | +Variable_name Value | |
1156 | +Qcache_queries_in_cache 1 | |
1157 | +show status like "Qcache_inserts"; | |
1158 | +Variable_name Value | |
1159 | +Qcache_inserts 1 | |
1160 | +show status like "Qcache_hits"; | |
1161 | +Variable_name Value | |
1162 | +Qcache_hits 32 | |
1163 | +----------------------------------------------------- | |
1164 | +select * from t1 | |
1165 | +----------------------------------------------------- | |
1166 | +show status like "Qcache_queries_in_cache"; | |
1167 | +Variable_name Value | |
1168 | +Qcache_queries_in_cache 1 | |
1169 | +show status like "Qcache_inserts"; | |
1170 | +Variable_name Value | |
1171 | +Qcache_inserts 1 | |
1172 | +show status like "Qcache_hits"; | |
1173 | +Variable_name Value | |
1174 | +Qcache_hits 32 | |
1175 | +select * from t1 ; | |
1176 | +a | |
1177 | +1 | |
1178 | +2 | |
1179 | +3 | |
1180 | +select * from t1 ; | |
1181 | +a | |
1182 | +1 | |
1183 | +2 | |
1184 | +3 | |
1185 | +show status like "Qcache_queries_in_cache"; | |
1186 | +Variable_name Value | |
1187 | +Qcache_queries_in_cache 1 | |
1188 | +show status like "Qcache_inserts"; | |
1189 | +Variable_name Value | |
1190 | +Qcache_inserts 1 | |
1191 | +show status like "Qcache_hits"; | |
1192 | +Variable_name Value | |
1193 | +Qcache_hits 34 | |
1194 | +----------------------------------------------------- | |
1195 | +select * from t1 | |
1196 | +----------------------------------------------------- | |
1197 | +show status like "Qcache_queries_in_cache"; | |
1198 | +Variable_name Value | |
1199 | +Qcache_queries_in_cache 1 | |
1200 | +show status like "Qcache_inserts"; | |
1201 | +Variable_name Value | |
1202 | +Qcache_inserts 1 | |
1203 | +show status like "Qcache_hits"; | |
1204 | +Variable_name Value | |
1205 | +Qcache_hits 34 | |
1206 | +select * from t1 ; | |
1207 | +a | |
1208 | +1 | |
1209 | +2 | |
1210 | +3 | |
1211 | +select * from t1 ; | |
1212 | +a | |
1213 | +1 | |
1214 | +2 | |
1215 | +3 | |
1216 | +show status like "Qcache_queries_in_cache"; | |
1217 | +Variable_name Value | |
1218 | +Qcache_queries_in_cache 1 | |
1219 | +show status like "Qcache_inserts"; | |
1220 | +Variable_name Value | |
1221 | +Qcache_inserts 1 | |
1222 | +show status like "Qcache_hits"; | |
1223 | +Variable_name Value | |
1224 | +Qcache_hits 36 | |
1225 | +----------------------------------------------------- | |
1226 | +select * from t1 | |
1227 | +/* comment in the end */ | |
1228 | +----------------------------------------------------- | |
1229 | +show status like "Qcache_queries_in_cache"; | |
1230 | +Variable_name Value | |
1231 | +Qcache_queries_in_cache 1 | |
1232 | +show status like "Qcache_inserts"; | |
1233 | +Variable_name Value | |
1234 | +Qcache_inserts 1 | |
1235 | +show status like "Qcache_hits"; | |
1236 | +Variable_name Value | |
1237 | +Qcache_hits 36 | |
1238 | +select * from t1 | |
1239 | +/* comment in the end */; | |
1240 | +a | |
1241 | +1 | |
1242 | +2 | |
1243 | +3 | |
1244 | +select * from t1 | |
1245 | +/* comment in the end */; | |
1246 | +a | |
1247 | +1 | |
1248 | +2 | |
1249 | +3 | |
1250 | +show status like "Qcache_queries_in_cache"; | |
1251 | +Variable_name Value | |
1252 | +Qcache_queries_in_cache 1 | |
1253 | +show status like "Qcache_inserts"; | |
1254 | +Variable_name Value | |
1255 | +Qcache_inserts 1 | |
1256 | +show status like "Qcache_hits"; | |
1257 | +Variable_name Value | |
1258 | +Qcache_hits 38 | |
1259 | +----------------------------------------------------- | |
1260 | +select * from t1 | |
1261 | +/* *\/ */ | |
1262 | +----------------------------------------------------- | |
1263 | +show status like "Qcache_queries_in_cache"; | |
1264 | +Variable_name Value | |
1265 | +Qcache_queries_in_cache 1 | |
1266 | +show status like "Qcache_inserts"; | |
1267 | +Variable_name Value | |
1268 | +Qcache_inserts 1 | |
1269 | +show status like "Qcache_hits"; | |
1270 | +Variable_name Value | |
1271 | +Qcache_hits 38 | |
1272 | +select * from t1 | |
1273 | +/* *\/ */; | |
1274 | +a | |
1275 | +1 | |
1276 | +2 | |
1277 | +3 | |
1278 | +select * from t1 | |
1279 | +/* *\/ */; | |
1280 | +a | |
1281 | +1 | |
1282 | +2 | |
1283 | +3 | |
1284 | +show status like "Qcache_queries_in_cache"; | |
1285 | +Variable_name Value | |
1286 | +Qcache_queries_in_cache 1 | |
1287 | +show status like "Qcache_inserts"; | |
1288 | +Variable_name Value | |
1289 | +Qcache_inserts 1 | |
1290 | +show status like "Qcache_hits"; | |
1291 | +Variable_name Value | |
1292 | +Qcache_hits 40 | |
1293 | +----------------------------------------------------- | |
1294 | +select * from t1 | |
1295 | +/* comment in the end */ | |
1296 | + | |
1297 | +----------------------------------------------------- | |
1298 | +show status like "Qcache_queries_in_cache"; | |
1299 | +Variable_name Value | |
1300 | +Qcache_queries_in_cache 1 | |
1301 | +show status like "Qcache_inserts"; | |
1302 | +Variable_name Value | |
1303 | +Qcache_inserts 1 | |
1304 | +show status like "Qcache_hits"; | |
1305 | +Variable_name Value | |
1306 | +Qcache_hits 40 | |
1307 | +select * from t1 | |
1308 | +/* comment in the end */ | |
1309 | +; | |
1310 | +a | |
1311 | +1 | |
1312 | +2 | |
1313 | +3 | |
1314 | +select * from t1 | |
1315 | +/* comment in the end */ | |
1316 | +; | |
1317 | +a | |
1318 | +1 | |
1319 | +2 | |
1320 | +3 | |
1321 | +show status like "Qcache_queries_in_cache"; | |
1322 | +Variable_name Value | |
1323 | +Qcache_queries_in_cache 1 | |
1324 | +show status like "Qcache_inserts"; | |
1325 | +Variable_name Value | |
1326 | +Qcache_inserts 1 | |
1327 | +show status like "Qcache_hits"; | |
1328 | +Variable_name Value | |
1329 | +Qcache_hits 42 | |
1330 | +----------------------------------------------------- | |
1331 | +select * from t1 #comment in the end | |
1332 | +----------------------------------------------------- | |
1333 | +show status like "Qcache_queries_in_cache"; | |
1334 | +Variable_name Value | |
1335 | +Qcache_queries_in_cache 1 | |
1336 | +show status like "Qcache_inserts"; | |
1337 | +Variable_name Value | |
1338 | +Qcache_inserts 1 | |
1339 | +show status like "Qcache_hits"; | |
1340 | +Variable_name Value | |
1341 | +Qcache_hits 42 | |
1342 | +select * from t1 #comment in the end; | |
1343 | +a | |
1344 | +1 | |
1345 | +2 | |
1346 | +3 | |
1347 | +select * from t1 #comment in the end; | |
1348 | +a | |
1349 | +1 | |
1350 | +2 | |
1351 | +3 | |
1352 | +show status like "Qcache_queries_in_cache"; | |
1353 | +Variable_name Value | |
1354 | +Qcache_queries_in_cache 1 | |
1355 | +show status like "Qcache_inserts"; | |
1356 | +Variable_name Value | |
1357 | +Qcache_inserts 1 | |
1358 | +show status like "Qcache_hits"; | |
1359 | +Variable_name Value | |
1360 | +Qcache_hits 44 | |
1361 | +----------------------------------------------------- | |
1362 | +select * from t1 #comment in the end | |
1363 | + | |
1364 | +----------------------------------------------------- | |
1365 | +show status like "Qcache_queries_in_cache"; | |
1366 | +Variable_name Value | |
1367 | +Qcache_queries_in_cache 1 | |
1368 | +show status like "Qcache_inserts"; | |
1369 | +Variable_name Value | |
1370 | +Qcache_inserts 1 | |
1371 | +show status like "Qcache_hits"; | |
1372 | +Variable_name Value | |
1373 | +Qcache_hits 44 | |
1374 | +select * from t1 #comment in the end | |
1375 | +; | |
1376 | +a | |
1377 | +1 | |
1378 | +2 | |
1379 | +3 | |
1380 | +select * from t1 #comment in the end | |
1381 | +; | |
1382 | +a | |
1383 | +1 | |
1384 | +2 | |
1385 | +3 | |
1386 | +show status like "Qcache_queries_in_cache"; | |
1387 | +Variable_name Value | |
1388 | +Qcache_queries_in_cache 1 | |
1389 | +show status like "Qcache_inserts"; | |
1390 | +Variable_name Value | |
1391 | +Qcache_inserts 1 | |
1392 | +show status like "Qcache_hits"; | |
1393 | +Variable_name Value | |
1394 | +Qcache_hits 46 | |
1395 | +----------------------------------------------------- | |
1396 | +select * from t1 -- comment in the end | |
1397 | +----------------------------------------------------- | |
1398 | +show status like "Qcache_queries_in_cache"; | |
1399 | +Variable_name Value | |
1400 | +Qcache_queries_in_cache 1 | |
1401 | +show status like "Qcache_inserts"; | |
1402 | +Variable_name Value | |
1403 | +Qcache_inserts 1 | |
1404 | +show status like "Qcache_hits"; | |
1405 | +Variable_name Value | |
1406 | +Qcache_hits 46 | |
1407 | +select * from t1 -- comment in the end; | |
1408 | +a | |
1409 | +1 | |
1410 | +2 | |
1411 | +3 | |
1412 | +select * from t1 -- comment in the end; | |
1413 | +a | |
1414 | +1 | |
1415 | +2 | |
1416 | +3 | |
1417 | +show status like "Qcache_queries_in_cache"; | |
1418 | +Variable_name Value | |
1419 | +Qcache_queries_in_cache 1 | |
1420 | +show status like "Qcache_inserts"; | |
1421 | +Variable_name Value | |
1422 | +Qcache_inserts 1 | |
1423 | +show status like "Qcache_hits"; | |
1424 | +Variable_name Value | |
1425 | +Qcache_hits 48 | |
1426 | +----------------------------------------------------- | |
1427 | +select * from t1 -- comment in the end | |
1428 | + | |
1429 | +----------------------------------------------------- | |
1430 | +show status like "Qcache_queries_in_cache"; | |
1431 | +Variable_name Value | |
1432 | +Qcache_queries_in_cache 1 | |
1433 | +show status like "Qcache_inserts"; | |
1434 | +Variable_name Value | |
1435 | +Qcache_inserts 1 | |
1436 | +show status like "Qcache_hits"; | |
1437 | +Variable_name Value | |
1438 | +Qcache_hits 48 | |
1439 | +select * from t1 -- comment in the end | |
1440 | +; | |
1441 | +a | |
1442 | +1 | |
1443 | +2 | |
1444 | +3 | |
1445 | +select * from t1 -- comment in the end | |
1446 | +; | |
1447 | +a | |
1448 | +1 | |
1449 | +2 | |
1450 | +3 | |
1451 | +show status like "Qcache_queries_in_cache"; | |
1452 | +Variable_name Value | |
1453 | +Qcache_queries_in_cache 1 | |
1454 | +show status like "Qcache_inserts"; | |
1455 | +Variable_name Value | |
1456 | +Qcache_inserts 1 | |
1457 | +show status like "Qcache_hits"; | |
1458 | +Variable_name Value | |
1459 | +Qcache_hits 50 | |
1460 | +----------------------------------------------------- | |
1461 | +select ' \' ' from t1 | |
1462 | +----------------------------------------------------- | |
1463 | +show status like "Qcache_queries_in_cache"; | |
1464 | +Variable_name Value | |
1465 | +Qcache_queries_in_cache 1 | |
1466 | +show status like "Qcache_inserts"; | |
1467 | +Variable_name Value | |
1468 | +Qcache_inserts 1 | |
1469 | +show status like "Qcache_hits"; | |
1470 | +Variable_name Value | |
1471 | +Qcache_hits 50 | |
1472 | +select ' \' ' from t1; | |
1473 | +' | |
1474 | + ' | |
1475 | + ' | |
1476 | + ' | |
1477 | +select ' \' ' from t1; | |
1478 | +' | |
1479 | + ' | |
1480 | + ' | |
1481 | + ' | |
1482 | +show status like "Qcache_queries_in_cache"; | |
1483 | +Variable_name Value | |
1484 | +Qcache_queries_in_cache 2 | |
1485 | +show status like "Qcache_inserts"; | |
1486 | +Variable_name Value | |
1487 | +Qcache_inserts 2 | |
1488 | +show status like "Qcache_hits"; | |
1489 | +Variable_name Value | |
1490 | +Qcache_hits 51 | |
1491 | +DROP TABLE t1; | |
1492 | +SET GLOBAL query_cache_size=default; | |
1493 | +set global query_cache_strip_comments=OFF; | |
1494 | --- /dev/null | |
1495 | +++ b/mysql-test/r/percona_query_cache_with_comments_crash.result | |
1496 | @@ -0,0 +1,21 @@ | |
1497 | +set GLOBAL query_cache_size=1355776; | |
1498 | +drop table if exists t1; | |
1499 | +create table t1 (a int not null); | |
1500 | +insert into t1 values (1),(2),(3); | |
1501 | +flush query cache; | |
1502 | +flush query cache; | |
1503 | +reset query cache; | |
1504 | +flush status; | |
1505 | +( select * from t1 ); | |
1506 | +a | |
1507 | +1 | |
1508 | +2 | |
1509 | +3 | |
1510 | +/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), @OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, @@SQL_QUOTE_SHOW_CREATE := 1 */; | |
1511 | +/* only comment */; | |
1512 | +# only comment | |
1513 | +; | |
1514 | +-- only comment | |
1515 | +; | |
1516 | +DROP TABLE t1; | |
1517 | +SET GLOBAL query_cache_size= default; | |
1518 | --- /dev/null | |
1519 | +++ b/mysql-test/r/percona_query_cache_with_comments_disable.result | |
1520 | @@ -0,0 +1,865 @@ | |
1521 | +set GLOBAL query_cache_size=1355776; | |
1522 | +drop table if exists t1; | |
1523 | +create table t1 (a int not null); | |
1524 | +insert into t1 values (1),(2),(3); | |
1525 | +flush query cache; | |
1526 | +flush query cache; | |
1527 | +reset query cache; | |
1528 | +flush status; | |
1529 | +flush query cache; | |
1530 | +flush query cache; | |
1531 | +reset query cache; | |
1532 | +flush status; | |
1533 | +/* with comment first */select * from t1; | |
1534 | +a | |
1535 | +1 | |
1536 | +2 | |
1537 | +3 | |
1538 | +----------------------------------------------------- | |
1539 | +/* with comment first */select * from t1 | |
1540 | +----------------------------------------------------- | |
1541 | +show status like "Qcache_queries_in_cache"; | |
1542 | +Variable_name Value | |
1543 | +Qcache_queries_in_cache 1 | |
1544 | +show status like "Qcache_inserts"; | |
1545 | +Variable_name Value | |
1546 | +Qcache_inserts 1 | |
1547 | +show status like "Qcache_hits"; | |
1548 | +Variable_name Value | |
1549 | +Qcache_hits 0 | |
1550 | +/* with comment first */select * from t1; | |
1551 | +a | |
1552 | +1 | |
1553 | +2 | |
1554 | +3 | |
1555 | +/* with comment first */select * from t1; | |
1556 | +a | |
1557 | +1 | |
1558 | +2 | |
1559 | +3 | |
1560 | +show status like "Qcache_queries_in_cache"; | |
1561 | +Variable_name Value | |
1562 | +Qcache_queries_in_cache 1 | |
1563 | +show status like "Qcache_inserts"; | |
1564 | +Variable_name Value | |
1565 | +Qcache_inserts 1 | |
1566 | +show status like "Qcache_hits"; | |
1567 | +Variable_name Value | |
1568 | +Qcache_hits 2 | |
1569 | +----------------------------------------------------- | |
1570 | +# with comment first | |
1571 | +select * from t1 | |
1572 | +----------------------------------------------------- | |
1573 | +show status like "Qcache_queries_in_cache"; | |
1574 | +Variable_name Value | |
1575 | +Qcache_queries_in_cache 1 | |
1576 | +show status like "Qcache_inserts"; | |
1577 | +Variable_name Value | |
1578 | +Qcache_inserts 1 | |
1579 | +show status like "Qcache_hits"; | |
1580 | +Variable_name Value | |
1581 | +Qcache_hits 2 | |
1582 | +# with comment first | |
1583 | +select * from t1; | |
1584 | +a | |
1585 | +1 | |
1586 | +2 | |
1587 | +3 | |
1588 | +# with comment first | |
1589 | +select * from t1; | |
1590 | +a | |
1591 | +1 | |
1592 | +2 | |
1593 | +3 | |
1594 | +show status like "Qcache_queries_in_cache"; | |
1595 | +Variable_name Value | |
1596 | +Qcache_queries_in_cache 2 | |
1597 | +show status like "Qcache_inserts"; | |
1598 | +Variable_name Value | |
1599 | +Qcache_inserts 2 | |
1600 | +show status like "Qcache_hits"; | |
1601 | +Variable_name Value | |
1602 | +Qcache_hits 2 | |
1603 | +----------------------------------------------------- | |
1604 | +-- with comment first | |
1605 | +select * from t1 | |
1606 | +----------------------------------------------------- | |
1607 | +show status like "Qcache_queries_in_cache"; | |
1608 | +Variable_name Value | |
1609 | +Qcache_queries_in_cache 2 | |
1610 | +show status like "Qcache_inserts"; | |
1611 | +Variable_name Value | |
1612 | +Qcache_inserts 2 | |
1613 | +show status like "Qcache_hits"; | |
1614 | +Variable_name Value | |
1615 | +Qcache_hits 2 | |
1616 | +-- with comment first | |
1617 | +select * from t1; | |
1618 | +a | |
1619 | +1 | |
1620 | +2 | |
1621 | +3 | |
1622 | +-- with comment first | |
1623 | +select * from t1; | |
1624 | +a | |
1625 | +1 | |
1626 | +2 | |
1627 | +3 | |
1628 | +show status like "Qcache_queries_in_cache"; | |
1629 | +Variable_name Value | |
1630 | +Qcache_queries_in_cache 3 | |
1631 | +show status like "Qcache_inserts"; | |
1632 | +Variable_name Value | |
1633 | +Qcache_inserts 3 | |
1634 | +show status like "Qcache_hits"; | |
1635 | +Variable_name Value | |
1636 | +Qcache_hits 2 | |
1637 | +----------------------------------------------------- | |
1638 | +/* with comment first and "quote" */select * from t1 | |
1639 | +----------------------------------------------------- | |
1640 | +show status like "Qcache_queries_in_cache"; | |
1641 | +Variable_name Value | |
1642 | +Qcache_queries_in_cache 3 | |
1643 | +show status like "Qcache_inserts"; | |
1644 | +Variable_name Value | |
1645 | +Qcache_inserts 3 | |
1646 | +show status like "Qcache_hits"; | |
1647 | +Variable_name Value | |
1648 | +Qcache_hits 2 | |
1649 | +/* with comment first and "quote" */select * from t1; | |
1650 | +a | |
1651 | +1 | |
1652 | +2 | |
1653 | +3 | |
1654 | +/* with comment first and "quote" */select * from t1; | |
1655 | +a | |
1656 | +1 | |
1657 | +2 | |
1658 | +3 | |
1659 | +show status like "Qcache_queries_in_cache"; | |
1660 | +Variable_name Value | |
1661 | +Qcache_queries_in_cache 4 | |
1662 | +show status like "Qcache_inserts"; | |
1663 | +Variable_name Value | |
1664 | +Qcache_inserts 4 | |
1665 | +show status like "Qcache_hits"; | |
1666 | +Variable_name Value | |
1667 | +Qcache_hits 3 | |
1668 | +----------------------------------------------------- | |
1669 | +# with comment first and "quote" | |
1670 | +select * from t1 | |
1671 | +----------------------------------------------------- | |
1672 | +show status like "Qcache_queries_in_cache"; | |
1673 | +Variable_name Value | |
1674 | +Qcache_queries_in_cache 4 | |
1675 | +show status like "Qcache_inserts"; | |
1676 | +Variable_name Value | |
1677 | +Qcache_inserts 4 | |
1678 | +show status like "Qcache_hits"; | |
1679 | +Variable_name Value | |
1680 | +Qcache_hits 3 | |
1681 | +# with comment first and "quote" | |
1682 | +select * from t1; | |
1683 | +a | |
1684 | +1 | |
1685 | +2 | |
1686 | +3 | |
1687 | +# with comment first and "quote" | |
1688 | +select * from t1; | |
1689 | +a | |
1690 | +1 | |
1691 | +2 | |
1692 | +3 | |
1693 | +show status like "Qcache_queries_in_cache"; | |
1694 | +Variable_name Value | |
1695 | +Qcache_queries_in_cache 5 | |
1696 | +show status like "Qcache_inserts"; | |
1697 | +Variable_name Value | |
1698 | +Qcache_inserts 5 | |
1699 | +show status like "Qcache_hits"; | |
1700 | +Variable_name Value | |
1701 | +Qcache_hits 3 | |
1702 | +----------------------------------------------------- | |
1703 | +-- with comment first and "quote" | |
1704 | +select * from t1 | |
1705 | +----------------------------------------------------- | |
1706 | +show status like "Qcache_queries_in_cache"; | |
1707 | +Variable_name Value | |
1708 | +Qcache_queries_in_cache 5 | |
1709 | +show status like "Qcache_inserts"; | |
1710 | +Variable_name Value | |
1711 | +Qcache_inserts 5 | |
1712 | +show status like "Qcache_hits"; | |
1713 | +Variable_name Value | |
1714 | +Qcache_hits 3 | |
1715 | +-- with comment first and "quote" | |
1716 | +select * from t1; | |
1717 | +a | |
1718 | +1 | |
1719 | +2 | |
1720 | +3 | |
1721 | +-- with comment first and "quote" | |
1722 | +select * from t1; | |
1723 | +a | |
1724 | +1 | |
1725 | +2 | |
1726 | +3 | |
1727 | +show status like "Qcache_queries_in_cache"; | |
1728 | +Variable_name Value | |
1729 | +Qcache_queries_in_cache 6 | |
1730 | +show status like "Qcache_inserts"; | |
1731 | +Variable_name Value | |
1732 | +Qcache_inserts 6 | |
1733 | +show status like "Qcache_hits"; | |
1734 | +Variable_name Value | |
1735 | +Qcache_hits 3 | |
1736 | +----------------------------------------------------- | |
1737 | +/* with comment and whitespaces first */select * from t1 | |
1738 | +----------------------------------------------------- | |
1739 | +show status like "Qcache_queries_in_cache"; | |
1740 | +Variable_name Value | |
1741 | +Qcache_queries_in_cache 6 | |
1742 | +show status like "Qcache_inserts"; | |
1743 | +Variable_name Value | |
1744 | +Qcache_inserts 6 | |
1745 | +show status like "Qcache_hits"; | |
1746 | +Variable_name Value | |
1747 | +Qcache_hits 3 | |
1748 | +/* with comment and whitespaces first */select * from t1; | |
1749 | +a | |
1750 | +1 | |
1751 | +2 | |
1752 | +3 | |
1753 | +/* with comment and whitespaces first */select * from t1; | |
1754 | +a | |
1755 | +1 | |
1756 | +2 | |
1757 | +3 | |
1758 | +show status like "Qcache_queries_in_cache"; | |
1759 | +Variable_name Value | |
1760 | +Qcache_queries_in_cache 7 | |
1761 | +show status like "Qcache_inserts"; | |
1762 | +Variable_name Value | |
1763 | +Qcache_inserts 7 | |
1764 | +show status like "Qcache_hits"; | |
1765 | +Variable_name Value | |
1766 | +Qcache_hits 4 | |
1767 | +----------------------------------------------------- | |
1768 | +# with comment and whitespaces first | |
1769 | +select * from t1 | |
1770 | +----------------------------------------------------- | |
1771 | +show status like "Qcache_queries_in_cache"; | |
1772 | +Variable_name Value | |
1773 | +Qcache_queries_in_cache 7 | |
1774 | +show status like "Qcache_inserts"; | |
1775 | +Variable_name Value | |
1776 | +Qcache_inserts 7 | |
1777 | +show status like "Qcache_hits"; | |
1778 | +Variable_name Value | |
1779 | +Qcache_hits 4 | |
1780 | +# with comment and whitespaces first | |
1781 | +select * from t1; | |
1782 | +a | |
1783 | +1 | |
1784 | +2 | |
1785 | +3 | |
1786 | +# with comment and whitespaces first | |
1787 | +select * from t1; | |
1788 | +a | |
1789 | +1 | |
1790 | +2 | |
1791 | +3 | |
1792 | +show status like "Qcache_queries_in_cache"; | |
1793 | +Variable_name Value | |
1794 | +Qcache_queries_in_cache 8 | |
1795 | +show status like "Qcache_inserts"; | |
1796 | +Variable_name Value | |
1797 | +Qcache_inserts 8 | |
1798 | +show status like "Qcache_hits"; | |
1799 | +Variable_name Value | |
1800 | +Qcache_hits 4 | |
1801 | +----------------------------------------------------- | |
1802 | +-- with comment and whitespaces first | |
1803 | +select * from t1 | |
1804 | +----------------------------------------------------- | |
1805 | +show status like "Qcache_queries_in_cache"; | |
1806 | +Variable_name Value | |
1807 | +Qcache_queries_in_cache 8 | |
1808 | +show status like "Qcache_inserts"; | |
1809 | +Variable_name Value | |
1810 | +Qcache_inserts 8 | |
1811 | +show status like "Qcache_hits"; | |
1812 | +Variable_name Value | |
1813 | +Qcache_hits 4 | |
1814 | +-- with comment and whitespaces first | |
1815 | +select * from t1; | |
1816 | +a | |
1817 | +1 | |
1818 | +2 | |
1819 | +3 | |
1820 | +-- with comment and whitespaces first | |
1821 | +select * from t1; | |
1822 | +a | |
1823 | +1 | |
1824 | +2 | |
1825 | +3 | |
1826 | +show status like "Qcache_queries_in_cache"; | |
1827 | +Variable_name Value | |
1828 | +Qcache_queries_in_cache 9 | |
1829 | +show status like "Qcache_inserts"; | |
1830 | +Variable_name Value | |
1831 | +Qcache_inserts 9 | |
1832 | +show status like "Qcache_hits"; | |
1833 | +Variable_name Value | |
1834 | +Qcache_hits 4 | |
1835 | +----------------------------------------------------- | |
1836 | +select * /* internal comment */ from t1 | |
1837 | +----------------------------------------------------- | |
1838 | +show status like "Qcache_queries_in_cache"; | |
1839 | +Variable_name Value | |
1840 | +Qcache_queries_in_cache 9 | |
1841 | +show status like "Qcache_inserts"; | |
1842 | +Variable_name Value | |
1843 | +Qcache_inserts 9 | |
1844 | +show status like "Qcache_hits"; | |
1845 | +Variable_name Value | |
1846 | +Qcache_hits 4 | |
1847 | +select * /* internal comment */ from t1; | |
1848 | +a | |
1849 | +1 | |
1850 | +2 | |
1851 | +3 | |
1852 | +select * /* internal comment */ from t1; | |
1853 | +a | |
1854 | +1 | |
1855 | +2 | |
1856 | +3 | |
1857 | +show status like "Qcache_queries_in_cache"; | |
1858 | +Variable_name Value | |
1859 | +Qcache_queries_in_cache 10 | |
1860 | +show status like "Qcache_inserts"; | |
1861 | +Variable_name Value | |
1862 | +Qcache_inserts 10 | |
1863 | +show status like "Qcache_hits"; | |
1864 | +Variable_name Value | |
1865 | +Qcache_hits 5 | |
1866 | +----------------------------------------------------- | |
1867 | +select */* internal comment */ from t1 | |
1868 | +----------------------------------------------------- | |
1869 | +show status like "Qcache_queries_in_cache"; | |
1870 | +Variable_name Value | |
1871 | +Qcache_queries_in_cache 10 | |
1872 | +show status like "Qcache_inserts"; | |
1873 | +Variable_name Value | |
1874 | +Qcache_inserts 10 | |
1875 | +show status like "Qcache_hits"; | |
1876 | +Variable_name Value | |
1877 | +Qcache_hits 5 | |
1878 | +select */* internal comment */ from t1; | |
1879 | +a | |
1880 | +1 | |
1881 | +2 | |
1882 | +3 | |
1883 | +select */* internal comment */ from t1; | |
1884 | +a | |
1885 | +1 | |
1886 | +2 | |
1887 | +3 | |
1888 | +show status like "Qcache_queries_in_cache"; | |
1889 | +Variable_name Value | |
1890 | +Qcache_queries_in_cache 11 | |
1891 | +show status like "Qcache_inserts"; | |
1892 | +Variable_name Value | |
1893 | +Qcache_inserts 11 | |
1894 | +show status like "Qcache_hits"; | |
1895 | +Variable_name Value | |
1896 | +Qcache_hits 6 | |
1897 | +----------------------------------------------------- | |
1898 | +select */* internal comment */from t1 | |
1899 | +----------------------------------------------------- | |
1900 | +show status like "Qcache_queries_in_cache"; | |
1901 | +Variable_name Value | |
1902 | +Qcache_queries_in_cache 11 | |
1903 | +show status like "Qcache_inserts"; | |
1904 | +Variable_name Value | |
1905 | +Qcache_inserts 11 | |
1906 | +show status like "Qcache_hits"; | |
1907 | +Variable_name Value | |
1908 | +Qcache_hits 6 | |
1909 | +select */* internal comment */from t1; | |
1910 | +a | |
1911 | +1 | |
1912 | +2 | |
1913 | +3 | |
1914 | +select */* internal comment */from t1; | |
1915 | +a | |
1916 | +1 | |
1917 | +2 | |
1918 | +3 | |
1919 | +show status like "Qcache_queries_in_cache"; | |
1920 | +Variable_name Value | |
1921 | +Qcache_queries_in_cache 12 | |
1922 | +show status like "Qcache_inserts"; | |
1923 | +Variable_name Value | |
1924 | +Qcache_inserts 12 | |
1925 | +show status like "Qcache_hits"; | |
1926 | +Variable_name Value | |
1927 | +Qcache_hits 7 | |
1928 | +----------------------------------------------------- | |
1929 | +select * /* internal comment with "quote" */ from t1 | |
1930 | +----------------------------------------------------- | |
1931 | +show status like "Qcache_queries_in_cache"; | |
1932 | +Variable_name Value | |
1933 | +Qcache_queries_in_cache 12 | |
1934 | +show status like "Qcache_inserts"; | |
1935 | +Variable_name Value | |
1936 | +Qcache_inserts 12 | |
1937 | +show status like "Qcache_hits"; | |
1938 | +Variable_name Value | |
1939 | +Qcache_hits 7 | |
1940 | +select * /* internal comment with "quote" */ from t1; | |
1941 | +a | |
1942 | +1 | |
1943 | +2 | |
1944 | +3 | |
1945 | +select * /* internal comment with "quote" */ from t1; | |
1946 | +a | |
1947 | +1 | |
1948 | +2 | |
1949 | +3 | |
1950 | +show status like "Qcache_queries_in_cache"; | |
1951 | +Variable_name Value | |
1952 | +Qcache_queries_in_cache 13 | |
1953 | +show status like "Qcache_inserts"; | |
1954 | +Variable_name Value | |
1955 | +Qcache_inserts 13 | |
1956 | +show status like "Qcache_hits"; | |
1957 | +Variable_name Value | |
1958 | +Qcache_hits 8 | |
1959 | +----------------------------------------------------- | |
1960 | +select */* internal comment with "quote" */ from t1 | |
1961 | +----------------------------------------------------- | |
1962 | +show status like "Qcache_queries_in_cache"; | |
1963 | +Variable_name Value | |
1964 | +Qcache_queries_in_cache 13 | |
1965 | +show status like "Qcache_inserts"; | |
1966 | +Variable_name Value | |
1967 | +Qcache_inserts 13 | |
1968 | +show status like "Qcache_hits"; | |
1969 | +Variable_name Value | |
1970 | +Qcache_hits 8 | |
1971 | +select */* internal comment with "quote" */ from t1; | |
1972 | +a | |
1973 | +1 | |
1974 | +2 | |
1975 | +3 | |
1976 | +select */* internal comment with "quote" */ from t1; | |
1977 | +a | |
1978 | +1 | |
1979 | +2 | |
1980 | +3 | |
1981 | +show status like "Qcache_queries_in_cache"; | |
1982 | +Variable_name Value | |
1983 | +Qcache_queries_in_cache 14 | |
1984 | +show status like "Qcache_inserts"; | |
1985 | +Variable_name Value | |
1986 | +Qcache_inserts 14 | |
1987 | +show status like "Qcache_hits"; | |
1988 | +Variable_name Value | |
1989 | +Qcache_hits 9 | |
1990 | +----------------------------------------------------- | |
1991 | +select */* internal comment with "quote" */from t1 | |
1992 | +----------------------------------------------------- | |
1993 | +show status like "Qcache_queries_in_cache"; | |
1994 | +Variable_name Value | |
1995 | +Qcache_queries_in_cache 14 | |
1996 | +show status like "Qcache_inserts"; | |
1997 | +Variable_name Value | |
1998 | +Qcache_inserts 14 | |
1999 | +show status like "Qcache_hits"; | |
2000 | +Variable_name Value | |
2001 | +Qcache_hits 9 | |
2002 | +select */* internal comment with "quote" */from t1; | |
2003 | +a | |
2004 | +1 | |
2005 | +2 | |
2006 | +3 | |
2007 | +select */* internal comment with "quote" */from t1; | |
2008 | +a | |
2009 | +1 | |
2010 | +2 | |
2011 | +3 | |
2012 | +show status like "Qcache_queries_in_cache"; | |
2013 | +Variable_name Value | |
2014 | +Qcache_queries_in_cache 15 | |
2015 | +show status like "Qcache_inserts"; | |
2016 | +Variable_name Value | |
2017 | +Qcache_inserts 15 | |
2018 | +show status like "Qcache_hits"; | |
2019 | +Variable_name Value | |
2020 | +Qcache_hits 10 | |
2021 | +----------------------------------------------------- | |
2022 | +select * from t1 | |
2023 | + | |
2024 | +----------------------------------------------------- | |
2025 | +show status like "Qcache_queries_in_cache"; | |
2026 | +Variable_name Value | |
2027 | +Qcache_queries_in_cache 15 | |
2028 | +show status like "Qcache_inserts"; | |
2029 | +Variable_name Value | |
2030 | +Qcache_inserts 15 | |
2031 | +show status like "Qcache_hits"; | |
2032 | +Variable_name Value | |
2033 | +Qcache_hits 10 | |
2034 | +select * from t1 | |
2035 | +; | |
2036 | +a | |
2037 | +1 | |
2038 | +2 | |
2039 | +3 | |
2040 | +select * from t1 | |
2041 | +; | |
2042 | +a | |
2043 | +1 | |
2044 | +2 | |
2045 | +3 | |
2046 | +show status like "Qcache_queries_in_cache"; | |
2047 | +Variable_name Value | |
2048 | +Qcache_queries_in_cache 16 | |
2049 | +show status like "Qcache_inserts"; | |
2050 | +Variable_name Value | |
2051 | +Qcache_inserts 16 | |
2052 | +show status like "Qcache_hits"; | |
2053 | +Variable_name Value | |
2054 | +Qcache_hits 11 | |
2055 | +----------------------------------------------------- | |
2056 | +select * from t1 | |
2057 | +----------------------------------------------------- | |
2058 | +show status like "Qcache_queries_in_cache"; | |
2059 | +Variable_name Value | |
2060 | +Qcache_queries_in_cache 16 | |
2061 | +show status like "Qcache_inserts"; | |
2062 | +Variable_name Value | |
2063 | +Qcache_inserts 16 | |
2064 | +show status like "Qcache_hits"; | |
2065 | +Variable_name Value | |
2066 | +Qcache_hits 11 | |
2067 | +select * from t1 ; | |
2068 | +a | |
2069 | +1 | |
2070 | +2 | |
2071 | +3 | |
2072 | +select * from t1 ; | |
2073 | +a | |
2074 | +1 | |
2075 | +2 | |
2076 | +3 | |
2077 | +show status like "Qcache_queries_in_cache"; | |
2078 | +Variable_name Value | |
2079 | +Qcache_queries_in_cache 16 | |
2080 | +show status like "Qcache_inserts"; | |
2081 | +Variable_name Value | |
2082 | +Qcache_inserts 16 | |
2083 | +show status like "Qcache_hits"; | |
2084 | +Variable_name Value | |
2085 | +Qcache_hits 13 | |
2086 | +----------------------------------------------------- | |
2087 | +select * from t1 | |
2088 | +----------------------------------------------------- | |
2089 | +show status like "Qcache_queries_in_cache"; | |
2090 | +Variable_name Value | |
2091 | +Qcache_queries_in_cache 16 | |
2092 | +show status like "Qcache_inserts"; | |
2093 | +Variable_name Value | |
2094 | +Qcache_inserts 16 | |
2095 | +show status like "Qcache_hits"; | |
2096 | +Variable_name Value | |
2097 | +Qcache_hits 13 | |
2098 | +select * from t1 ; | |
2099 | +a | |
2100 | +1 | |
2101 | +2 | |
2102 | +3 | |
2103 | +select * from t1 ; | |
2104 | +a | |
2105 | +1 | |
2106 | +2 | |
2107 | +3 | |
2108 | +show status like "Qcache_queries_in_cache"; | |
2109 | +Variable_name Value | |
2110 | +Qcache_queries_in_cache 16 | |
2111 | +show status like "Qcache_inserts"; | |
2112 | +Variable_name Value | |
2113 | +Qcache_inserts 16 | |
2114 | +show status like "Qcache_hits"; | |
2115 | +Variable_name Value | |
2116 | +Qcache_hits 15 | |
2117 | +----------------------------------------------------- | |
2118 | +select * from t1 | |
2119 | +/* comment in the end */ | |
2120 | +----------------------------------------------------- | |
2121 | +show status like "Qcache_queries_in_cache"; | |
2122 | +Variable_name Value | |
2123 | +Qcache_queries_in_cache 16 | |
2124 | +show status like "Qcache_inserts"; | |
2125 | +Variable_name Value | |
2126 | +Qcache_inserts 16 | |
2127 | +show status like "Qcache_hits"; | |
2128 | +Variable_name Value | |
2129 | +Qcache_hits 15 | |
2130 | +select * from t1 | |
2131 | +/* comment in the end */; | |
2132 | +a | |
2133 | +1 | |
2134 | +2 | |
2135 | +3 | |
2136 | +select * from t1 | |
2137 | +/* comment in the end */; | |
2138 | +a | |
2139 | +1 | |
2140 | +2 | |
2141 | +3 | |
2142 | +show status like "Qcache_queries_in_cache"; | |
2143 | +Variable_name Value | |
2144 | +Qcache_queries_in_cache 17 | |
2145 | +show status like "Qcache_inserts"; | |
2146 | +Variable_name Value | |
2147 | +Qcache_inserts 17 | |
2148 | +show status like "Qcache_hits"; | |
2149 | +Variable_name Value | |
2150 | +Qcache_hits 16 | |
2151 | +----------------------------------------------------- | |
2152 | +select * from t1 | |
2153 | +/* *\/ */ | |
2154 | +----------------------------------------------------- | |
2155 | +show status like "Qcache_queries_in_cache"; | |
2156 | +Variable_name Value | |
2157 | +Qcache_queries_in_cache 17 | |
2158 | +show status like "Qcache_inserts"; | |
2159 | +Variable_name Value | |
2160 | +Qcache_inserts 17 | |
2161 | +show status like "Qcache_hits"; | |
2162 | +Variable_name Value | |
2163 | +Qcache_hits 16 | |
2164 | +select * from t1 | |
2165 | +/* *\/ */; | |
2166 | +a | |
2167 | +1 | |
2168 | +2 | |
2169 | +3 | |
2170 | +select * from t1 | |
2171 | +/* *\/ */; | |
2172 | +a | |
2173 | +1 | |
2174 | +2 | |
2175 | +3 | |
2176 | +show status like "Qcache_queries_in_cache"; | |
2177 | +Variable_name Value | |
2178 | +Qcache_queries_in_cache 18 | |
2179 | +show status like "Qcache_inserts"; | |
2180 | +Variable_name Value | |
2181 | +Qcache_inserts 18 | |
2182 | +show status like "Qcache_hits"; | |
2183 | +Variable_name Value | |
2184 | +Qcache_hits 17 | |
2185 | +----------------------------------------------------- | |
2186 | +select * from t1 | |
2187 | +/* comment in the end */ | |
2188 | + | |
2189 | +----------------------------------------------------- | |
2190 | +show status like "Qcache_queries_in_cache"; | |
2191 | +Variable_name Value | |
2192 | +Qcache_queries_in_cache 18 | |
2193 | +show status like "Qcache_inserts"; | |
2194 | +Variable_name Value | |
2195 | +Qcache_inserts 18 | |
2196 | +show status like "Qcache_hits"; | |
2197 | +Variable_name Value | |
2198 | +Qcache_hits 17 | |
2199 | +select * from t1 | |
2200 | +/* comment in the end */ | |
2201 | +; | |
2202 | +a | |
2203 | +1 | |
2204 | +2 | |
2205 | +3 | |
2206 | +select * from t1 | |
2207 | +/* comment in the end */ | |
2208 | +; | |
2209 | +a | |
2210 | +1 | |
2211 | +2 | |
2212 | +3 | |
2213 | +show status like "Qcache_queries_in_cache"; | |
2214 | +Variable_name Value | |
2215 | +Qcache_queries_in_cache 18 | |
2216 | +show status like "Qcache_inserts"; | |
2217 | +Variable_name Value | |
2218 | +Qcache_inserts 18 | |
2219 | +show status like "Qcache_hits"; | |
2220 | +Variable_name Value | |
2221 | +Qcache_hits 19 | |
2222 | +----------------------------------------------------- | |
2223 | +select * from t1 #comment in the end | |
2224 | +----------------------------------------------------- | |
2225 | +show status like "Qcache_queries_in_cache"; | |
2226 | +Variable_name Value | |
2227 | +Qcache_queries_in_cache 18 | |
2228 | +show status like "Qcache_inserts"; | |
2229 | +Variable_name Value | |
2230 | +Qcache_inserts 18 | |
2231 | +show status like "Qcache_hits"; | |
2232 | +Variable_name Value | |
2233 | +Qcache_hits 19 | |
2234 | +select * from t1 #comment in the end; | |
2235 | +a | |
2236 | +1 | |
2237 | +2 | |
2238 | +3 | |
2239 | +select * from t1 #comment in the end; | |
2240 | +a | |
2241 | +1 | |
2242 | +2 | |
2243 | +3 | |
2244 | +show status like "Qcache_queries_in_cache"; | |
2245 | +Variable_name Value | |
2246 | +Qcache_queries_in_cache 19 | |
2247 | +show status like "Qcache_inserts"; | |
2248 | +Variable_name Value | |
2249 | +Qcache_inserts 19 | |
2250 | +show status like "Qcache_hits"; | |
2251 | +Variable_name Value | |
2252 | +Qcache_hits 20 | |
2253 | +----------------------------------------------------- | |
2254 | +select * from t1 #comment in the end | |
2255 | + | |
2256 | +----------------------------------------------------- | |
2257 | +show status like "Qcache_queries_in_cache"; | |
2258 | +Variable_name Value | |
2259 | +Qcache_queries_in_cache 19 | |
2260 | +show status like "Qcache_inserts"; | |
2261 | +Variable_name Value | |
2262 | +Qcache_inserts 19 | |
2263 | +show status like "Qcache_hits"; | |
2264 | +Variable_name Value | |
2265 | +Qcache_hits 20 | |
2266 | +select * from t1 #comment in the end | |
2267 | +; | |
2268 | +a | |
2269 | +1 | |
2270 | +2 | |
2271 | +3 | |
2272 | +select * from t1 #comment in the end | |
2273 | +; | |
2274 | +a | |
2275 | +1 | |
2276 | +2 | |
2277 | +3 | |
2278 | +show status like "Qcache_queries_in_cache"; | |
2279 | +Variable_name Value | |
2280 | +Qcache_queries_in_cache 19 | |
2281 | +show status like "Qcache_inserts"; | |
2282 | +Variable_name Value | |
2283 | +Qcache_inserts 19 | |
2284 | +show status like "Qcache_hits"; | |
2285 | +Variable_name Value | |
2286 | +Qcache_hits 22 | |
2287 | +----------------------------------------------------- | |
2288 | +select * from t1 -- comment in the end | |
2289 | +----------------------------------------------------- | |
2290 | +show status like "Qcache_queries_in_cache"; | |
2291 | +Variable_name Value | |
2292 | +Qcache_queries_in_cache 19 | |
2293 | +show status like "Qcache_inserts"; | |
2294 | +Variable_name Value | |
2295 | +Qcache_inserts 19 | |
2296 | +show status like "Qcache_hits"; | |
2297 | +Variable_name Value | |
2298 | +Qcache_hits 22 | |
2299 | +select * from t1 -- comment in the end; | |
2300 | +a | |
2301 | +1 | |
2302 | +2 | |
2303 | +3 | |
2304 | +select * from t1 -- comment in the end; | |
2305 | +a | |
2306 | +1 | |
2307 | +2 | |
2308 | +3 | |
2309 | +show status like "Qcache_queries_in_cache"; | |
2310 | +Variable_name Value | |
2311 | +Qcache_queries_in_cache 20 | |
2312 | +show status like "Qcache_inserts"; | |
2313 | +Variable_name Value | |
2314 | +Qcache_inserts 20 | |
2315 | +show status like "Qcache_hits"; | |
2316 | +Variable_name Value | |
2317 | +Qcache_hits 23 | |
2318 | +----------------------------------------------------- | |
2319 | +select * from t1 -- comment in the end | |
2320 | + | |
2321 | +----------------------------------------------------- | |
2322 | +show status like "Qcache_queries_in_cache"; | |
2323 | +Variable_name Value | |
2324 | +Qcache_queries_in_cache 20 | |
2325 | +show status like "Qcache_inserts"; | |
2326 | +Variable_name Value | |
2327 | +Qcache_inserts 20 | |
2328 | +show status like "Qcache_hits"; | |
2329 | +Variable_name Value | |
2330 | +Qcache_hits 23 | |
2331 | +select * from t1 -- comment in the end | |
2332 | +; | |
2333 | +a | |
2334 | +1 | |
2335 | +2 | |
2336 | +3 | |
2337 | +select * from t1 -- comment in the end | |
2338 | +; | |
2339 | +a | |
2340 | +1 | |
2341 | +2 | |
2342 | +3 | |
2343 | +show status like "Qcache_queries_in_cache"; | |
2344 | +Variable_name Value | |
2345 | +Qcache_queries_in_cache 20 | |
2346 | +show status like "Qcache_inserts"; | |
2347 | +Variable_name Value | |
2348 | +Qcache_inserts 20 | |
2349 | +show status like "Qcache_hits"; | |
2350 | +Variable_name Value | |
2351 | +Qcache_hits 25 | |
2352 | +----------------------------------------------------- | |
2353 | +select ' \' ' from t1 | |
2354 | +----------------------------------------------------- | |
2355 | +show status like "Qcache_queries_in_cache"; | |
2356 | +Variable_name Value | |
2357 | +Qcache_queries_in_cache 20 | |
2358 | +show status like "Qcache_inserts"; | |
2359 | +Variable_name Value | |
2360 | +Qcache_inserts 20 | |
2361 | +show status like "Qcache_hits"; | |
2362 | +Variable_name Value | |
2363 | +Qcache_hits 25 | |
2364 | +select ' \' ' from t1; | |
2365 | +' | |
2366 | + ' | |
2367 | + ' | |
2368 | + ' | |
2369 | +select ' \' ' from t1; | |
2370 | +' | |
2371 | + ' | |
2372 | + ' | |
2373 | + ' | |
2374 | +show status like "Qcache_queries_in_cache"; | |
2375 | +Variable_name Value | |
2376 | +Qcache_queries_in_cache 21 | |
2377 | +show status like "Qcache_inserts"; | |
2378 | +Variable_name Value | |
2379 | +Qcache_inserts 21 | |
2380 | +show status like "Qcache_hits"; | |
2381 | +Variable_name Value | |
2382 | +Qcache_hits 26 | |
2383 | +DROP TABLE t1; | |
2384 | +SET GLOBAL query_cache_size=default; | |
2385 | +set global query_cache_strip_comments=OFF; | |
2386 | --- /dev/null | |
2387 | +++ b/mysql-test/r/percona_query_cache_with_comments_prepared_statements.result | |
2388 | @@ -0,0 +1,396 @@ | |
2389 | +set GLOBAL query_cache_size=1355776; | |
2390 | +flush query cache; | |
2391 | +flush query cache; | |
2392 | +reset query cache; | |
2393 | +flush status; | |
2394 | +drop table if exists t1; | |
2395 | +create table t1 (a int not null); | |
2396 | +insert into t1 values (1),(2),(3); | |
2397 | +set global query_cache_strip_comments=ON; | |
2398 | +show status like "Qcache_queries_in_cache"; | |
2399 | +Variable_name Value | |
2400 | +Qcache_queries_in_cache 0 | |
2401 | +show status like "Qcache_inserts"; | |
2402 | +Variable_name Value | |
2403 | +Qcache_inserts 0 | |
2404 | +show status like "Qcache_hits"; | |
2405 | +Variable_name Value | |
2406 | +Qcache_hits 0 | |
2407 | +prepare stmt from '/* with comment */ select * from t1'; | |
2408 | +execute stmt; | |
2409 | +a | |
2410 | +1 | |
2411 | +2 | |
2412 | +3 | |
2413 | +show status like "Qcache_queries_in_cache"; | |
2414 | +Variable_name Value | |
2415 | +Qcache_queries_in_cache 1 | |
2416 | +show status like "Qcache_inserts"; | |
2417 | +Variable_name Value | |
2418 | +Qcache_inserts 1 | |
2419 | +show status like "Qcache_hits"; | |
2420 | +Variable_name Value | |
2421 | +Qcache_hits 0 | |
2422 | +execute stmt; | |
2423 | +a | |
2424 | +1 | |
2425 | +2 | |
2426 | +3 | |
2427 | +execute stmt; | |
2428 | +a | |
2429 | +1 | |
2430 | +2 | |
2431 | +3 | |
2432 | +execute stmt; | |
2433 | +a | |
2434 | +1 | |
2435 | +2 | |
2436 | +3 | |
2437 | +execute stmt; | |
2438 | +a | |
2439 | +1 | |
2440 | +2 | |
2441 | +3 | |
2442 | +execute stmt; | |
2443 | +a | |
2444 | +1 | |
2445 | +2 | |
2446 | +3 | |
2447 | +show status like "Qcache_queries_in_cache"; | |
2448 | +Variable_name Value | |
2449 | +Qcache_queries_in_cache 1 | |
2450 | +show status like "Qcache_inserts"; | |
2451 | +Variable_name Value | |
2452 | +Qcache_inserts 1 | |
2453 | +show status like "Qcache_hits"; | |
2454 | +Variable_name Value | |
2455 | +Qcache_hits 5 | |
2456 | +prepare stmt from 'select * from t1'; | |
2457 | +execute stmt; | |
2458 | +a | |
2459 | +1 | |
2460 | +2 | |
2461 | +3 | |
2462 | +show status like "Qcache_queries_in_cache"; | |
2463 | +Variable_name Value | |
2464 | +Qcache_queries_in_cache 1 | |
2465 | +show status like "Qcache_inserts"; | |
2466 | +Variable_name Value | |
2467 | +Qcache_inserts 1 | |
2468 | +show status like "Qcache_hits"; | |
2469 | +Variable_name Value | |
2470 | +Qcache_hits 6 | |
2471 | +prepare stmt from 'select * /*internal comment*/from t1'; | |
2472 | +execute stmt; | |
2473 | +a | |
2474 | +1 | |
2475 | +2 | |
2476 | +3 | |
2477 | +show status like "Qcache_queries_in_cache"; | |
2478 | +Variable_name Value | |
2479 | +Qcache_queries_in_cache 1 | |
2480 | +show status like "Qcache_inserts"; | |
2481 | +Variable_name Value | |
2482 | +Qcache_inserts 1 | |
2483 | +show status like "Qcache_hits"; | |
2484 | +Variable_name Value | |
2485 | +Qcache_hits 7 | |
2486 | +prepare stmt from 'select * /*internal comment*/ from t1'; | |
2487 | +execute stmt; | |
2488 | +a | |
2489 | +1 | |
2490 | +2 | |
2491 | +3 | |
2492 | +show status like "Qcache_queries_in_cache"; | |
2493 | +Variable_name Value | |
2494 | +Qcache_queries_in_cache 1 | |
2495 | +show status like "Qcache_inserts"; | |
2496 | +Variable_name Value | |
2497 | +Qcache_inserts 1 | |
2498 | +show status like "Qcache_hits"; | |
2499 | +Variable_name Value | |
2500 | +Qcache_hits 8 | |
2501 | +prepare stmt from 'select * from t1 /* at the end */'; | |
2502 | +execute stmt; | |
2503 | +a | |
2504 | +1 | |
2505 | +2 | |
2506 | +3 | |
2507 | +show status like "Qcache_queries_in_cache"; | |
2508 | +Variable_name Value | |
2509 | +Qcache_queries_in_cache 1 | |
2510 | +show status like "Qcache_inserts"; | |
2511 | +Variable_name Value | |
2512 | +Qcache_inserts 1 | |
2513 | +show status like "Qcache_hits"; | |
2514 | +Variable_name Value | |
2515 | +Qcache_hits 9 | |
2516 | +prepare stmt from 'select * from t1 /* with "quote" */'; | |
2517 | +execute stmt; | |
2518 | +a | |
2519 | +1 | |
2520 | +2 | |
2521 | +3 | |
2522 | +show status like "Qcache_queries_in_cache"; | |
2523 | +Variable_name Value | |
2524 | +Qcache_queries_in_cache 1 | |
2525 | +show status like "Qcache_inserts"; | |
2526 | +Variable_name Value | |
2527 | +Qcache_inserts 1 | |
2528 | +show status like "Qcache_hits"; | |
2529 | +Variable_name Value | |
2530 | +Qcache_hits 10 | |
2531 | +prepare stmt from 'select * from t1 /* with \'quote\' */'; | |
2532 | +execute stmt; | |
2533 | +a | |
2534 | +1 | |
2535 | +2 | |
2536 | +3 | |
2537 | +show status like "Qcache_queries_in_cache"; | |
2538 | +Variable_name Value | |
2539 | +Qcache_queries_in_cache 1 | |
2540 | +show status like "Qcache_inserts"; | |
2541 | +Variable_name Value | |
2542 | +Qcache_inserts 1 | |
2543 | +show status like "Qcache_hits"; | |
2544 | +Variable_name Value | |
2545 | +Qcache_hits 11 | |
2546 | +prepare stmt from 'select * from t1 # 123 | |
2547 | +'; | |
2548 | +execute stmt; | |
2549 | +a | |
2550 | +1 | |
2551 | +2 | |
2552 | +3 | |
2553 | +show status like "Qcache_queries_in_cache"; | |
2554 | +Variable_name Value | |
2555 | +Qcache_queries_in_cache 1 | |
2556 | +show status like "Qcache_inserts"; | |
2557 | +Variable_name Value | |
2558 | +Qcache_inserts 1 | |
2559 | +show status like "Qcache_hits"; | |
2560 | +Variable_name Value | |
2561 | +Qcache_hits 12 | |
2562 | +prepare stmt from 'select * from t1 # 123 with "quote" | |
2563 | +'; | |
2564 | +execute stmt; | |
2565 | +a | |
2566 | +1 | |
2567 | +2 | |
2568 | +3 | |
2569 | +show status like "Qcache_queries_in_cache"; | |
2570 | +Variable_name Value | |
2571 | +Qcache_queries_in_cache 1 | |
2572 | +show status like "Qcache_inserts"; | |
2573 | +Variable_name Value | |
2574 | +Qcache_inserts 1 | |
2575 | +show status like "Qcache_hits"; | |
2576 | +Variable_name Value | |
2577 | +Qcache_hits 13 | |
2578 | +prepare stmt from 'select * from t1 # 123 with \'quote\' | |
2579 | +'; | |
2580 | +execute stmt; | |
2581 | +a | |
2582 | +1 | |
2583 | +2 | |
2584 | +3 | |
2585 | +show status like "Qcache_queries_in_cache"; | |
2586 | +Variable_name Value | |
2587 | +Qcache_queries_in_cache 1 | |
2588 | +show status like "Qcache_inserts"; | |
2589 | +Variable_name Value | |
2590 | +Qcache_inserts 1 | |
2591 | +show status like "Qcache_hits"; | |
2592 | +Variable_name Value | |
2593 | +Qcache_hits 14 | |
2594 | +prepare stmt from 'select * from t1 | |
2595 | +# 123 | |
2596 | +'; | |
2597 | +execute stmt; | |
2598 | +a | |
2599 | +1 | |
2600 | +2 | |
2601 | +3 | |
2602 | +show status like "Qcache_queries_in_cache"; | |
2603 | +Variable_name Value | |
2604 | +Qcache_queries_in_cache 1 | |
2605 | +show status like "Qcache_inserts"; | |
2606 | +Variable_name Value | |
2607 | +Qcache_inserts 1 | |
2608 | +show status like "Qcache_hits"; | |
2609 | +Variable_name Value | |
2610 | +Qcache_hits 15 | |
2611 | +prepare stmt from '#456 | |
2612 | +select * from t1 | |
2613 | +# 123 | |
2614 | +'; | |
2615 | +execute stmt; | |
2616 | +a | |
2617 | +1 | |
2618 | +2 | |
2619 | +3 | |
2620 | +show status like "Qcache_queries_in_cache"; | |
2621 | +Variable_name Value | |
2622 | +Qcache_queries_in_cache 1 | |
2623 | +show status like "Qcache_inserts"; | |
2624 | +Variable_name Value | |
2625 | +Qcache_inserts 1 | |
2626 | +show status like "Qcache_hits"; | |
2627 | +Variable_name Value | |
2628 | +Qcache_hits 16 | |
2629 | +prepare stmt from 'select * from t1 -- 123 | |
2630 | +'; | |
2631 | +execute stmt; | |
2632 | +a | |
2633 | +1 | |
2634 | +2 | |
2635 | +3 | |
2636 | +show status like "Qcache_queries_in_cache"; | |
2637 | +Variable_name Value | |
2638 | +Qcache_queries_in_cache 1 | |
2639 | +show status like "Qcache_inserts"; | |
2640 | +Variable_name Value | |
2641 | +Qcache_inserts 1 | |
2642 | +show status like "Qcache_hits"; | |
2643 | +Variable_name Value | |
2644 | +Qcache_hits 17 | |
2645 | +prepare stmt from 'select * from t1 | |
2646 | +-- 123 | |
2647 | +'; | |
2648 | +execute stmt; | |
2649 | +a | |
2650 | +1 | |
2651 | +2 | |
2652 | +3 | |
2653 | +show status like "Qcache_queries_in_cache"; | |
2654 | +Variable_name Value | |
2655 | +Qcache_queries_in_cache 1 | |
2656 | +show status like "Qcache_inserts"; | |
2657 | +Variable_name Value | |
2658 | +Qcache_inserts 1 | |
2659 | +show status like "Qcache_hits"; | |
2660 | +Variable_name Value | |
2661 | +Qcache_hits 18 | |
2662 | +prepare stmt from '-- comment in first | |
2663 | +select * from t1 | |
2664 | +# 123 | |
2665 | +'; | |
2666 | +execute stmt; | |
2667 | +a | |
2668 | +1 | |
2669 | +2 | |
2670 | +3 | |
2671 | +show status like "Qcache_queries_in_cache"; | |
2672 | +Variable_name Value | |
2673 | +Qcache_queries_in_cache 1 | |
2674 | +show status like "Qcache_inserts"; | |
2675 | +Variable_name Value | |
2676 | +Qcache_inserts 1 | |
2677 | +show status like "Qcache_hits"; | |
2678 | +Variable_name Value | |
2679 | +Qcache_hits 19 | |
2680 | +prepare stmt from '(#456( | |
2681 | +select * from t1 | |
2682 | +# 123( | |
2683 | +)'; | |
2684 | +execute stmt; | |
2685 | +a | |
2686 | +1 | |
2687 | +2 | |
2688 | +3 | |
2689 | +show status like "Qcache_queries_in_cache"; | |
2690 | +Variable_name Value | |
2691 | +Qcache_queries_in_cache 2 | |
2692 | +show status like "Qcache_inserts"; | |
2693 | +Variable_name Value | |
2694 | +Qcache_inserts 2 | |
2695 | +show status like "Qcache_hits"; | |
2696 | +Variable_name Value | |
2697 | +Qcache_hits 19 | |
2698 | +prepare stmt from '/*test*/(-- comment in first( | |
2699 | +select * from t1 | |
2700 | +-- 123 asdasd | |
2701 | +/* test */)'; | |
2702 | +execute stmt; | |
2703 | +a | |
2704 | +1 | |
2705 | +2 | |
2706 | +3 | |
2707 | +show status like "Qcache_queries_in_cache"; | |
2708 | +Variable_name Value | |
2709 | +Qcache_queries_in_cache 2 | |
2710 | +show status like "Qcache_inserts"; | |
2711 | +Variable_name Value | |
2712 | +Qcache_inserts 2 | |
2713 | +show status like "Qcache_hits"; | |
2714 | +Variable_name Value | |
2715 | +Qcache_hits 20 | |
2716 | +prepare stmt from 'select "test",a from t1'; | |
2717 | +execute stmt; | |
2718 | +test a | |
2719 | +test 1 | |
2720 | +test 2 | |
2721 | +test 3 | |
2722 | +execute stmt; | |
2723 | +test a | |
2724 | +test 1 | |
2725 | +test 2 | |
2726 | +test 3 | |
2727 | +show status like "Qcache_queries_in_cache"; | |
2728 | +Variable_name Value | |
2729 | +Qcache_queries_in_cache 3 | |
2730 | +show status like "Qcache_inserts"; | |
2731 | +Variable_name Value | |
2732 | +Qcache_inserts 3 | |
2733 | +show status like "Qcache_hits"; | |
2734 | +Variable_name Value | |
2735 | +Qcache_hits 21 | |
2736 | +prepare stmt from 'select "test /* internal \'comment\' */",a from t1'; | |
2737 | +execute stmt; | |
2738 | +test /* internal 'comment' */ a | |
2739 | +test /* internal 'comment' */ 1 | |
2740 | +test /* internal 'comment' */ 2 | |
2741 | +test /* internal 'comment' */ 3 | |
2742 | +show status like "Qcache_queries_in_cache"; | |
2743 | +Variable_name Value | |
2744 | +Qcache_queries_in_cache 4 | |
2745 | +show status like "Qcache_inserts"; | |
2746 | +Variable_name Value | |
2747 | +Qcache_inserts 4 | |
2748 | +show status like "Qcache_hits"; | |
2749 | +Variable_name Value | |
2750 | +Qcache_hits 21 | |
2751 | +prepare stmt from 'select "test #internal comment" ,a from t1'; | |
2752 | +execute stmt; | |
2753 | +test #internal comment a | |
2754 | +test #internal comment 1 | |
2755 | +test #internal comment 2 | |
2756 | +test #internal comment 3 | |
2757 | +show status like "Qcache_queries_in_cache"; | |
2758 | +Variable_name Value | |
2759 | +Qcache_queries_in_cache 5 | |
2760 | +show status like "Qcache_inserts"; | |
2761 | +Variable_name Value | |
2762 | +Qcache_inserts 5 | |
2763 | +show status like "Qcache_hits"; | |
2764 | +Variable_name Value | |
2765 | +Qcache_hits 21 | |
2766 | +prepare stmt from 'select "test #internal comment" #external comment | |
2767 | +,a from t1'; | |
2768 | +execute stmt; | |
2769 | +test #internal comment a | |
2770 | +test #internal comment 1 | |
2771 | +test #internal comment 2 | |
2772 | +test #internal comment 3 | |
2773 | +show status like "Qcache_queries_in_cache"; | |
2774 | +Variable_name Value | |
2775 | +Qcache_queries_in_cache 5 | |
2776 | +show status like "Qcache_inserts"; | |
2777 | +Variable_name Value | |
2778 | +Qcache_inserts 5 | |
2779 | +show status like "Qcache_hits"; | |
2780 | +Variable_name Value | |
2781 | +Qcache_hits 22 | |
2782 | +DROP TABLE t1; | |
2783 | +SET GLOBAL query_cache_size= default; | |
2784 | +set global query_cache_strip_comments=OFF; | |
2785 | --- /dev/null | |
48b678b4 AM |
2786 | +++ b/mysql-test/t/percona_query_cache_with_comments.test |
2787 | @@ -0,0 +1,5 @@ | |
2788 | +--disable_ps_protocol | |
2789 | +set global query_cache_strip_comments=ON; | |
2790 | +-- source include/percona_query_cache_with_comments_begin.inc | |
2791 | +-- source include/percona_query_cache_with_comments.inc | |
2792 | +-- source include/percona_query_cache_with_comments_end.inc | |
2793 | --- /dev/null | |
2794 | +++ b/mysql-test/t/percona_query_cache_with_comments_crash.test | |
2795 | @@ -0,0 +1,22 @@ | |
2796 | +-- source include/have_query_cache.inc | |
2797 | +set GLOBAL query_cache_size=1355776; | |
2798 | +--disable_warnings | |
2799 | +drop table if exists t1; | |
2800 | +--enable_warnings | |
2801 | +create table t1 (a int not null); | |
2802 | +insert into t1 values (1),(2),(3); | |
2803 | +flush query cache; # This crashed in some versions | |
2804 | +flush query cache; # This crashed in some versions | |
2805 | +reset query cache; | |
2806 | +flush status; | |
2807 | +( select * from t1 ); | |
2808 | +/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), @OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, @@SQL_QUOTE_SHOW_CREATE := 1 */; | |
2809 | +/* only comment */; | |
2810 | +let query=# only comment | |
2811 | +; | |
2812 | +eval $query; | |
2813 | +let query=-- only comment | |
2814 | +; | |
2815 | +eval $query; | |
2816 | +DROP TABLE t1; | |
2817 | +SET GLOBAL query_cache_size= default; | |
2818 | --- /dev/null | |
2819 | +++ b/mysql-test/t/percona_query_cache_with_comments_disable.test | |
2820 | @@ -0,0 +1,3 @@ | |
2821 | +-- source include/percona_query_cache_with_comments_begin.inc | |
2822 | +-- source include/percona_query_cache_with_comments.inc | |
2823 | +-- source include/percona_query_cache_with_comments_end.inc | |
2824 | --- /dev/null | |
2825 | +++ b/mysql-test/t/percona_query_cache_with_comments_prepared_statements.test | |
2826 | @@ -0,0 +1,208 @@ | |
2827 | +-- source include/have_query_cache.inc | |
2828 | + | |
2829 | +set GLOBAL query_cache_size=1355776; | |
2830 | + | |
2831 | +# Reset query cache variables. | |
2832 | +flush query cache; # This crashed in some versions | |
2833 | +flush query cache; # This crashed in some versions | |
2834 | +reset query cache; | |
2835 | +flush status; | |
2836 | +--disable_warnings | |
2837 | +drop table if exists t1; | |
2838 | +--enable_warnings | |
2839 | + | |
2840 | +# | |
2841 | +# First simple test | |
2842 | +# | |
2843 | + | |
2844 | +create table t1 (a int not null); | |
2845 | +insert into t1 values (1),(2),(3); | |
2846 | + | |
2847 | +set global query_cache_strip_comments=ON; | |
2848 | + | |
2849 | +show status like "Qcache_queries_in_cache"; | |
2850 | +show status like "Qcache_inserts"; | |
2851 | +show status like "Qcache_hits"; | |
2852 | + | |
2853 | +prepare stmt from '/* with comment */ select * from t1'; | |
2854 | +execute stmt; | |
2855 | + | |
2856 | +show status like "Qcache_queries_in_cache"; | |
2857 | +show status like "Qcache_inserts"; | |
2858 | +show status like "Qcache_hits"; | |
2859 | + | |
2860 | +execute stmt; | |
2861 | +execute stmt; | |
2862 | +execute stmt; | |
2863 | +execute stmt; | |
2864 | +execute stmt; | |
2865 | + | |
2866 | +show status like "Qcache_queries_in_cache"; | |
2867 | +show status like "Qcache_inserts"; | |
2868 | +show status like "Qcache_hits"; | |
2869 | + | |
2870 | +prepare stmt from 'select * from t1'; | |
2871 | +execute stmt; | |
2872 | + | |
2873 | +show status like "Qcache_queries_in_cache"; | |
2874 | +show status like "Qcache_inserts"; | |
2875 | +show status like "Qcache_hits"; | |
2876 | + | |
2877 | +prepare stmt from 'select * /*internal comment*/from t1'; | |
2878 | +execute stmt; | |
2879 | + | |
2880 | +show status like "Qcache_queries_in_cache"; | |
2881 | +show status like "Qcache_inserts"; | |
2882 | +show status like "Qcache_hits"; | |
2883 | + | |
2884 | +prepare stmt from 'select * /*internal comment*/ from t1'; | |
2885 | +execute stmt; | |
2886 | + | |
2887 | +show status like "Qcache_queries_in_cache"; | |
2888 | +show status like "Qcache_inserts"; | |
2889 | +show status like "Qcache_hits"; | |
2890 | + | |
2891 | +prepare stmt from 'select * from t1 /* at the end */'; | |
2892 | +execute stmt; | |
2893 | + | |
2894 | +show status like "Qcache_queries_in_cache"; | |
2895 | +show status like "Qcache_inserts"; | |
2896 | +show status like "Qcache_hits"; | |
2897 | + | |
2898 | +prepare stmt from 'select * from t1 /* with "quote" */'; | |
2899 | +execute stmt; | |
2900 | + | |
2901 | +show status like "Qcache_queries_in_cache"; | |
2902 | +show status like "Qcache_inserts"; | |
2903 | +show status like "Qcache_hits"; | |
2904 | + | |
2905 | +prepare stmt from 'select * from t1 /* with \'quote\' */'; | |
2906 | +execute stmt; | |
2907 | + | |
2908 | +show status like "Qcache_queries_in_cache"; | |
2909 | +show status like "Qcache_inserts"; | |
2910 | +show status like "Qcache_hits"; | |
2911 | + | |
2912 | +prepare stmt from 'select * from t1 # 123 | |
2913 | +'; | |
2914 | +execute stmt; | |
2915 | + | |
2916 | +show status like "Qcache_queries_in_cache"; | |
2917 | +show status like "Qcache_inserts"; | |
2918 | +show status like "Qcache_hits"; | |
2919 | + | |
2920 | +prepare stmt from 'select * from t1 # 123 with "quote" | |
2921 | +'; | |
2922 | +execute stmt; | |
2923 | + | |
2924 | +show status like "Qcache_queries_in_cache"; | |
2925 | +show status like "Qcache_inserts"; | |
2926 | +show status like "Qcache_hits"; | |
2927 | + | |
2928 | +prepare stmt from 'select * from t1 # 123 with \'quote\' | |
2929 | +'; | |
2930 | +execute stmt; | |
2931 | + | |
2932 | +show status like "Qcache_queries_in_cache"; | |
2933 | +show status like "Qcache_inserts"; | |
2934 | +show status like "Qcache_hits"; | |
2935 | + | |
2936 | +prepare stmt from 'select * from t1 | |
2937 | +# 123 | |
2938 | +'; | |
2939 | +execute stmt; | |
2940 | + | |
2941 | +show status like "Qcache_queries_in_cache"; | |
2942 | +show status like "Qcache_inserts"; | |
2943 | +show status like "Qcache_hits"; | |
2944 | + | |
2945 | +prepare stmt from '#456 | |
2946 | +select * from t1 | |
2947 | +# 123 | |
2948 | +'; | |
2949 | +execute stmt; | |
2950 | + | |
2951 | +show status like "Qcache_queries_in_cache"; | |
2952 | +show status like "Qcache_inserts"; | |
2953 | +show status like "Qcache_hits"; | |
2954 | + | |
2955 | +prepare stmt from 'select * from t1 -- 123 | |
2956 | +'; | |
2957 | +execute stmt; | |
2958 | + | |
2959 | +show status like "Qcache_queries_in_cache"; | |
2960 | +show status like "Qcache_inserts"; | |
2961 | +show status like "Qcache_hits"; | |
2962 | + | |
2963 | +prepare stmt from 'select * from t1 | |
2964 | +-- 123 | |
2965 | +'; | |
2966 | +execute stmt; | |
2967 | + | |
2968 | +show status like "Qcache_queries_in_cache"; | |
2969 | +show status like "Qcache_inserts"; | |
2970 | +show status like "Qcache_hits"; | |
2971 | + | |
2972 | +prepare stmt from '-- comment in first | |
2973 | +select * from t1 | |
2974 | +# 123 | |
2975 | +'; | |
2976 | +execute stmt; | |
2977 | + | |
2978 | +show status like "Qcache_queries_in_cache"; | |
2979 | +show status like "Qcache_inserts"; | |
2980 | +show status like "Qcache_hits"; | |
2981 | + | |
2982 | +prepare stmt from '(#456( | |
2983 | +select * from t1 | |
2984 | +# 123( | |
2985 | +)'; | |
2986 | +execute stmt; | |
2987 | + | |
2988 | +show status like "Qcache_queries_in_cache"; | |
2989 | +show status like "Qcache_inserts"; | |
2990 | +show status like "Qcache_hits"; | |
2991 | + | |
2992 | +prepare stmt from '/*test*/(-- comment in first( | |
2993 | +select * from t1 | |
2994 | +-- 123 asdasd | |
2995 | +/* test */)'; | |
2996 | +execute stmt; | |
2997 | + | |
2998 | +show status like "Qcache_queries_in_cache"; | |
2999 | +show status like "Qcache_inserts"; | |
3000 | +show status like "Qcache_hits"; | |
3001 | + | |
3002 | +prepare stmt from 'select "test",a from t1'; | |
3003 | +execute stmt; | |
3004 | +execute stmt; | |
3005 | + | |
3006 | +show status like "Qcache_queries_in_cache"; | |
3007 | +show status like "Qcache_inserts"; | |
3008 | +show status like "Qcache_hits"; | |
3009 | + | |
3010 | +prepare stmt from 'select "test /* internal \'comment\' */",a from t1'; | |
3011 | +execute stmt; | |
3012 | + | |
3013 | +show status like "Qcache_queries_in_cache"; | |
3014 | +show status like "Qcache_inserts"; | |
3015 | +show status like "Qcache_hits"; | |
3016 | + | |
3017 | +prepare stmt from 'select "test #internal comment" ,a from t1'; | |
3018 | +execute stmt; | |
3019 | + | |
3020 | +show status like "Qcache_queries_in_cache"; | |
3021 | +show status like "Qcache_inserts"; | |
3022 | +show status like "Qcache_hits"; | |
3023 | + | |
3024 | +prepare stmt from 'select "test #internal comment" #external comment | |
3025 | +,a from t1'; | |
3026 | +execute stmt; | |
3027 | + | |
3028 | +show status like "Qcache_queries_in_cache"; | |
3029 | +show status like "Qcache_inserts"; | |
3030 | +show status like "Qcache_hits"; | |
3031 | + | |
3032 | +DROP TABLE t1; | |
3033 | +SET GLOBAL query_cache_size= default; | |
3034 | +set global query_cache_strip_comments=OFF; | |
3035 | --- /dev/null | |
3036 | +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test | |
9dd04cbc | 3037 | @@ -0,0 +1,35 @@ |
48b678b4 AM |
3038 | +--source include/have_query_cache.inc |
3039 | +--source include/have_debug.inc | |
3040 | +--source include/have_debug_sync.inc | |
3041 | +SET GLOBAL query_cache_size=1355776; | |
3042 | +--source include/percona_query_cache_with_comments_clear.inc | |
9dd04cbc | 3043 | +--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action |
48b678b4 | 3044 | + |
9dd04cbc AM |
3045 | +--connect (mutex_locked_conn, localhost, root,,) |
3046 | +--connect (try_mutex_lock_conn, localhost, root,,) | |
48b678b4 | 3047 | + |
9dd04cbc AM |
3048 | +--connection mutex_locked_conn |
3049 | +SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex'; | |
3050 | +send SELECT "mutex_locked_query" as action; | |
3051 | + | |
3052 | +--connection default | |
3053 | +SET DEBUG_SYNC='now WAIT_FOR mutex_locked'; | |
48b678b4 | 3054 | + |
9dd04cbc AM |
3055 | +--connection try_mutex_lock_conn |
3056 | +SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex'; | |
3057 | +send_eval $try_lock_mutex_query; | |
48b678b4 AM |
3058 | + |
3059 | +--connection default | |
9dd04cbc AM |
3060 | +SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex'; |
3061 | +eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query'; | |
3062 | +SET DEBUG_SYNC='now SIGNAL unlock_mutex'; | |
48b678b4 | 3063 | + |
9dd04cbc AM |
3064 | +--connection mutex_locked_conn |
3065 | +reap; | |
3066 | +--connection try_mutex_lock_conn | |
3067 | +reap; | |
48b678b4 | 3068 | + |
9dd04cbc AM |
3069 | +--connection default |
3070 | +--disconnect mutex_locked_conn | |
3071 | +--disconnect try_mutex_lock_conn | |
48b678b4 | 3072 | +SET GLOBAL query_cache_size=0; |
734d6226 AM |
3073 | --- a/mysql-test/r/mysqld--help-notwin.result |
3074 | +++ b/mysql-test/r/mysqld--help-notwin.result | |
3075 | @@ -491,6 +491,10 @@ | |
3076 | The minimum size for blocks allocated by the query cache | |
3077 | --query-cache-size=# | |
3078 | The memory allocated to store results from old queries | |
3079 | + --query-cache-strip-comments | |
3080 | + Enable and disable optimisation "strip comment for query | |
3081 | + cache" - optimisation strip all comments from query while | |
3082 | + search query result in query cache | |
3083 | --query-cache-type=name | |
3084 | OFF = Don't cache or retrieve results. ON = Cache all | |
3085 | results except SELECT SQL_NO_CACHE ... queries. DEMAND = | |
3086 | @@ -928,6 +932,7 @@ | |
3087 | query-cache-limit 1048576 | |
3088 | query-cache-min-res-unit 4096 | |
3089 | query-cache-size 0 | |
3090 | +query-cache-strip-comments FALSE | |
3091 | query-cache-type ON | |
3092 | query-cache-wlock-invalidate FALSE | |
3093 | query-prealloc-size 8192 | |
9dd04cbc AM |
3094 | --- /dev/null |
3095 | +++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result | |
3096 | @@ -0,0 +1,20 @@ | |
3097 | +SET GLOBAL query_cache_size=1355776; | |
3098 | +flush query cache; | |
3099 | +flush query cache; | |
3100 | +reset query cache; | |
3101 | +flush status; | |
3102 | +SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex'; | |
3103 | +SELECT "mutex_locked_query" as action; | |
3104 | +SET DEBUG_SYNC='now WAIT_FOR mutex_locked'; | |
3105 | +SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex'; | |
3106 | +SELECT "try_lock_mutex_query" as action; | |
3107 | +SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex'; | |
3108 | +SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action'; | |
3109 | +state | |
3110 | +Waiting on query cache mutex | |
3111 | +SET DEBUG_SYNC='now SIGNAL unlock_mutex'; | |
3112 | +action | |
3113 | +mutex_locked_query | |
3114 | +action | |
3115 | +try_lock_mutex_query | |
3116 | +SET GLOBAL query_cache_size=0; |