1 # name : query_cache_with_comments.patch
2 # introduced : 11 or before
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
9 +++ b/patch_info/query_cache_enhance.patch
11 +File=query_cache_enhance.patch
12 +Name= query cache Percona's cumulative patch
14 +Author=Percona <info@percona.com>
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
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;
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;
47 +++ b/sql/query_strip_comments.h
49 +#ifndef _SQL_QUERY_STRIPC_COMMENTS_H_
50 +#define _SQL_QUERY_STRIPC_COMMENTS_H_
51 +#ifdef HAVE_QUERY_CACHE
53 +// implemented in sql_cache.cc
54 +class QueryStripComments
57 + QueryStripComments(const QueryStripComments&);
58 + QueryStripComments& operator=(const QueryStripComments&);
60 + QueryStripComments();
61 + ~QueryStripComments();
62 + void set(const char* a_query, uint a_query_length, uint a_additional_length);
64 + char* query() { return buffer; }
65 + uint query_length() { return length; }
70 + uint length /*query length, not buffer length*/;
73 +class QueryStripComments_Backup
76 + QueryStripComments_Backup(THD* a_thd,QueryStripComments* qsc);
77 + ~QueryStripComments_Backup();
84 +#endif // HAVE_QUERY_CACHE
85 +#endif // _SQL_QUERY_STRIPC_COMMENTS_H_
86 --- a/sql/sql_cache.cc
87 +++ b/sql/sql_cache.cc
89 #include "probes_mysql.h"
90 #include "transaction.h"
92 +#include "query_strip_comments.h"
94 +QueryStripComments::QueryStripComments()
100 +QueryStripComments::~QueryStripComments()
105 +inline bool query_strip_comments_is_white_space(char c)
107 + return ((' ' == c) || ('\t' == c) || ('\r' == c) || ('\n' ==c ));
109 +void QueryStripComments::set(const char* query, uint query_length, uint additional_length)
111 + uint new_buffer_length = query_length + additional_length;
112 + if(new_buffer_length > buffer_length)
115 + buffer = (char*)my_malloc(new_buffer_length,MYF(0));
117 + uint query_position = 0;
119 + // Skip whitespaces from begin
120 + while((query_position < query_length) && query_strip_comments_is_white_space(query[query_position]))
124 + long int last_space = -1;
125 + while(query_position < query_length)
127 + char current = query[query_position];
128 + bool insert_space = false; // insert space to buffer, (IMPORTANT) don't update query_position
134 + buffer[position++] = query[query_position++]; // copy current symbol
135 + while(query_position < query_length)
137 + if(current == query[query_position]) // found pair quote
141 + buffer[position++] = query[query_position++]; // copy current symbol
147 + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2]))
149 + query_position += 2; // skip "/*"
152 + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/"
154 + query_position += 2; // skip "*/"
155 + insert_space = true;
163 + while(query_position < query_length);
173 + if(query[query_position+1] == '-')
175 + ++query_position; // skip "-", and go to search of "\n"
186 + ++query_position; // skip current symbol (# or -)
187 + if('\n' == query[query_position]) // check for '\n'
189 + ++query_position; // skip '\n'
190 + insert_space = true;
194 + while(query_position < query_length);
205 + if(query_strip_comments_is_white_space(current))
207 + insert_space = true;
210 + break; // make gcc happy
214 + if((last_space + 1) != position)
216 + last_space = position;
217 + buffer[position++] = ' ';
222 + buffer[position++] = query[query_position++];
225 + while((0 < position) && query_strip_comments_is_white_space(buffer[position - 1]))
229 + buffer[position] = 0;
232 +void QueryStripComments::cleanup()
242 +QueryStripComments_Backup::QueryStripComments_Backup(THD* a_thd,QueryStripComments* qsc)
244 + if(opt_query_cache_strip_comments)
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());
259 +QueryStripComments_Backup::~QueryStripComments_Backup()
263 + thd->set_query(query,length);
267 #ifdef EMBEDDED_LIBRARY
268 #include "emb_qcache.h"
271 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
272 DBUG_ENTER("Query_cache::try_lock");
274 + const char* old_proc_info= thd->proc_info;
275 + thd_proc_info(thd,"Waiting on query cache mutex");
276 + DEBUG_SYNC(thd, "before_query_cache_mutex");
277 mysql_mutex_lock(&structure_guard_mutex);
278 + DEBUG_SYNC(thd, "after_query_cache_mutex");
279 + thd->proc_info = old_proc_info;
282 if (m_cache_lock_status == Query_cache::UNLOCKED)
283 @@ -1274,6 +1454,8 @@
287 + QueryStripComments *query_strip_comments = &(thd->query_strip_comments);
288 + QueryStripComments_Backup backup(thd,query_strip_comments);
290 /* Key is query + database + flag */
292 @@ -1451,6 +1633,9 @@
293 Query_cache_block_table *block_table, *block_table_end;
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");
302 @@ -1472,21 +1657,103 @@
307 - Skip '(' characters in queries like following:
308 - (select a from t1) union (select a from t1);
310 - while (sql[i]=='(')
312 + if(opt_query_cache_strip_comments)
314 + /* Skip all comments and non-letter symbols */
315 + uint& query_position = i;
317 + while(query_position < query_length)
319 + bool check = false;
320 + char current = query[query_position];
324 + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2]))
326 + query_position += 2; // skip "/*"
329 + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/" (without space)
331 + query_position += 2; // skip "*/" (without space)
339 + while(query_position < query_length);
340 + continue; // analyze current symbol
344 + if(query[query_position+1] == '-')
346 + ++query_position; // skip "-"
355 + ++query_position; // skip current symbol
356 + if('\n' == query[query_position]) // check for '\n'
358 + ++query_position; // skip '\n'
362 + while(query_position < query_length);
363 + continue; // analyze current symbol
373 + break; // make gcc happy
374 + } // switch(current)
377 + if(query_position + 2 < query_length)
384 + DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
389 + } // while(query_position < query_length)
391 + else // if(opt_query_cache_strip_comments)
394 + Skip '(' characters in queries like following:
395 + (select a from t1) union (select a from t1);
397 + while (sql[i]=='(')
401 - Test if the query is a SELECT
402 - (pre-space is removed in dispatch_command).
403 + } // if(opt_query_cache_strip_comments)
405 + Test if the query is a SELECT
406 + (pre-space is removed in dispatch_command).
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.
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.
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') &&
419 @@ -1521,6 +1788,12 @@
422 Query_cache_block *query_block;
423 + if(opt_query_cache_strip_comments)
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();
430 tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
432 @@ -1587,6 +1860,8 @@
433 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
434 query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,
437 + query_length = query_length_backup;
438 /* Quick abort on unlocked data */
439 if (query_block == 0 ||
440 query_block->query()->result() == 0 ||
441 --- a/sql/sql_class.h
442 +++ b/sql/sql_class.h
444 #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
447 +#ifdef HAVE_QUERY_CACHE
448 +#include "query_strip_comments.h"
449 +#endif // HAVE_QUERY_CACHE
451 class Reprepare_observer;
452 class Relay_log_info;
454 statement lifetime. FIXME: must be const
457 +#ifdef HAVE_QUERY_CACHE
458 + QueryStripComments query_strip_comments; // see sql_cache.cc
459 +#endif //HAVE_QUERY_CACHE
462 MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
463 --- a/sql/sys_vars.cc
464 +++ b/sql/sys_vars.cc
465 @@ -1809,6 +1809,11 @@
466 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
467 ON_UPDATE(fix_query_cache_size));
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),
474 static Sys_var_ulong Sys_query_cache_limit(
476 "Don't cache results that are bigger than this",
478 +++ b/mysql-test/include/percona_query_cache_with_comments.inc
480 +--source include/percona_query_cache_with_comments_clear.inc
481 +let $query=/* with comment first */select * from t1;
483 +--source include/percona_query_cache_with_comments_eval.inc
485 +let $query=# with comment first
487 +--source include/percona_query_cache_with_comments_eval.inc
489 +let $query=-- with comment first
491 +--source include/percona_query_cache_with_comments_eval.inc
493 +let $query=/* with comment first and "quote" */select * from t1;
494 +--source include/percona_query_cache_with_comments_eval.inc
496 +let $query=# with comment first and "quote"
498 +--source include/percona_query_cache_with_comments_eval.inc
500 +let $query=-- with comment first and "quote"
502 +--source include/percona_query_cache_with_comments_eval.inc
505 + /* with comment and whitespaces first */select * from t1;
506 +--source include/percona_query_cache_with_comments_eval.inc
509 + # with comment and whitespaces first
511 +--source include/percona_query_cache_with_comments_eval.inc
514 + -- with comment and whitespaces first
516 +--source include/percona_query_cache_with_comments_eval.inc
518 +let $internal=* internal comment *;
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
527 +let $internal=* internal comment with "quote" *;
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
536 +let $query=select * from t1
538 +--source include/percona_query_cache_with_comments_eval.inc
540 +let $query=select * from t1 ;
541 +--source include/percona_query_cache_with_comments_eval.inc
543 +let $query=select * from t1 ;
544 +--source include/percona_query_cache_with_comments_eval.inc
546 +let $query=select * from t1
547 +/* comment in the end */;
548 +--source include/percona_query_cache_with_comments_eval.inc
550 +let $query=select * from t1
552 +--source include/percona_query_cache_with_comments_eval.inc
554 +let $query=select * from t1
555 +/* comment in the end */
557 +--source include/percona_query_cache_with_comments_eval.inc
559 +let $query=select * from t1 #comment in the end;
560 +--source include/percona_query_cache_with_comments_eval.inc
562 +let $query=select * from t1 #comment in the end
564 +--source include/percona_query_cache_with_comments_eval.inc
566 +let $query=select * from t1 -- comment in the end;
567 +--source include/percona_query_cache_with_comments_eval.inc
569 +let $query=select * from t1 -- comment in the end
571 +--source include/percona_query_cache_with_comments_eval.inc
573 +let $query=select ' \' ' from t1;
574 +--source include/percona_query_cache_with_comments_eval.inc
576 +++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc
578 +-- source include/have_query_cache.inc
580 +set GLOBAL query_cache_size=1355776;
583 +drop table if exists t1;
586 +create table t1 (a int not null);
587 +insert into t1 values (1),(2),(3);
589 +--source include/percona_query_cache_with_comments_clear.inc
591 +++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc
593 +# Reset query cache variables.
594 +flush query cache; # This crashed in some versions
595 +flush query cache; # This crashed in some versions
599 +++ b/mysql-test/include/percona_query_cache_with_comments_end.inc
602 +SET GLOBAL query_cache_size=default;
603 +set global query_cache_strip_comments=OFF;
605 +++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc
607 +echo -----------------------------------------------------;
609 +echo -----------------------------------------------------;
610 +--source include/percona_query_cache_with_comments_show.inc
613 +--source include/percona_query_cache_with_comments_show.inc
615 +++ b/mysql-test/include/percona_query_cache_with_comments_show.inc
617 +let $show=show status like "Qcache_queries_in_cache";
619 +let $show=show status like "Qcache_inserts";
621 +let $show=show status like "Qcache_hits";
626 +++ b/mysql-test/r/percona_query_cache_with_comments.result
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);
641 +/* with comment first */select * from t1;
646 +-----------------------------------------------------
647 +/* with comment first */select * from t1
648 +-----------------------------------------------------
649 +show status like "Qcache_queries_in_cache";
651 +Qcache_queries_in_cache 1
652 +show status like "Qcache_inserts";
655 +show status like "Qcache_hits";
658 +/* with comment first */select * from t1;
663 +/* with comment first */select * from t1;
668 +show status like "Qcache_queries_in_cache";
670 +Qcache_queries_in_cache 1
671 +show status like "Qcache_inserts";
674 +show status like "Qcache_hits";
677 +-----------------------------------------------------
678 +# with comment first
680 +-----------------------------------------------------
681 +show status like "Qcache_queries_in_cache";
683 +Qcache_queries_in_cache 1
684 +show status like "Qcache_inserts";
687 +show status like "Qcache_hits";
690 +# with comment first
696 +# with comment first
702 +show status like "Qcache_queries_in_cache";
704 +Qcache_queries_in_cache 1
705 +show status like "Qcache_inserts";
708 +show status like "Qcache_hits";
711 +-----------------------------------------------------
712 +-- with comment first
714 +-----------------------------------------------------
715 +show status like "Qcache_queries_in_cache";
717 +Qcache_queries_in_cache 1
718 +show status like "Qcache_inserts";
721 +show status like "Qcache_hits";
724 +-- with comment first
730 +-- with comment first
736 +show status like "Qcache_queries_in_cache";
738 +Qcache_queries_in_cache 1
739 +show status like "Qcache_inserts";
742 +show status like "Qcache_hits";
745 +-----------------------------------------------------
746 +/* with comment first and "quote" */select * from t1
747 +-----------------------------------------------------
748 +show status like "Qcache_queries_in_cache";
750 +Qcache_queries_in_cache 1
751 +show status like "Qcache_inserts";
754 +show status like "Qcache_hits";
757 +/* with comment first and "quote" */select * from t1;
762 +/* with comment first and "quote" */select * from t1;
767 +show status like "Qcache_queries_in_cache";
769 +Qcache_queries_in_cache 1
770 +show status like "Qcache_inserts";
773 +show status like "Qcache_hits";
776 +-----------------------------------------------------
777 +# with comment first and "quote"
779 +-----------------------------------------------------
780 +show status like "Qcache_queries_in_cache";
782 +Qcache_queries_in_cache 1
783 +show status like "Qcache_inserts";
786 +show status like "Qcache_hits";
789 +# with comment first and "quote"
795 +# with comment first and "quote"
801 +show status like "Qcache_queries_in_cache";
803 +Qcache_queries_in_cache 1
804 +show status like "Qcache_inserts";
807 +show status like "Qcache_hits";
810 +-----------------------------------------------------
811 +-- with comment first and "quote"
813 +-----------------------------------------------------
814 +show status like "Qcache_queries_in_cache";
816 +Qcache_queries_in_cache 1
817 +show status like "Qcache_inserts";
820 +show status like "Qcache_hits";
823 +-- with comment first and "quote"
829 +-- with comment first and "quote"
835 +show status like "Qcache_queries_in_cache";
837 +Qcache_queries_in_cache 1
838 +show status like "Qcache_inserts";
841 +show status like "Qcache_hits";
844 +-----------------------------------------------------
845 +/* with comment and whitespaces first */select * from t1
846 +-----------------------------------------------------
847 +show status like "Qcache_queries_in_cache";
849 +Qcache_queries_in_cache 1
850 +show status like "Qcache_inserts";
853 +show status like "Qcache_hits";
856 +/* with comment and whitespaces first */select * from t1;
861 +/* with comment and whitespaces first */select * from t1;
866 +show status like "Qcache_queries_in_cache";
868 +Qcache_queries_in_cache 1
869 +show status like "Qcache_inserts";
872 +show status like "Qcache_hits";
875 +-----------------------------------------------------
876 +# with comment and whitespaces first
878 +-----------------------------------------------------
879 +show status like "Qcache_queries_in_cache";
881 +Qcache_queries_in_cache 1
882 +show status like "Qcache_inserts";
885 +show status like "Qcache_hits";
888 +# with comment and whitespaces first
894 +# with comment and whitespaces first
900 +show status like "Qcache_queries_in_cache";
902 +Qcache_queries_in_cache 1
903 +show status like "Qcache_inserts";
906 +show status like "Qcache_hits";
909 +-----------------------------------------------------
910 +-- with comment and whitespaces first
912 +-----------------------------------------------------
913 +show status like "Qcache_queries_in_cache";
915 +Qcache_queries_in_cache 1
916 +show status like "Qcache_inserts";
919 +show status like "Qcache_hits";
922 +-- with comment and whitespaces first
928 +-- with comment and whitespaces first
934 +show status like "Qcache_queries_in_cache";
936 +Qcache_queries_in_cache 1
937 +show status like "Qcache_inserts";
940 +show status like "Qcache_hits";
943 +-----------------------------------------------------
944 +select * /* internal comment */ from t1
945 +-----------------------------------------------------
946 +show status like "Qcache_queries_in_cache";
948 +Qcache_queries_in_cache 1
949 +show status like "Qcache_inserts";
952 +show status like "Qcache_hits";
955 +select * /* internal comment */ from t1;
960 +select * /* internal comment */ from t1;
965 +show status like "Qcache_queries_in_cache";
967 +Qcache_queries_in_cache 1
968 +show status like "Qcache_inserts";
971 +show status like "Qcache_hits";
974 +-----------------------------------------------------
975 +select */* internal comment */ from t1
976 +-----------------------------------------------------
977 +show status like "Qcache_queries_in_cache";
979 +Qcache_queries_in_cache 1
980 +show status like "Qcache_inserts";
983 +show status like "Qcache_hits";
986 +select */* internal comment */ from t1;
991 +select */* internal comment */ from t1;
996 +show status like "Qcache_queries_in_cache";
998 +Qcache_queries_in_cache 1
999 +show status like "Qcache_inserts";
1000 +Variable_name Value
1002 +show status like "Qcache_hits";
1003 +Variable_name Value
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
1014 +show status like "Qcache_hits";
1015 +Variable_name Value
1017 +select */* internal comment */from t1;
1022 +select */* internal comment */from t1;
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
1033 +show status like "Qcache_hits";
1034 +Variable_name Value
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
1045 +show status like "Qcache_hits";
1046 +Variable_name Value
1048 +select * /* internal comment with "quote" */ from t1;
1053 +select * /* internal comment with "quote" */ from t1;
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
1064 +show status like "Qcache_hits";
1065 +Variable_name Value
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
1076 +show status like "Qcache_hits";
1077 +Variable_name Value
1079 +select */* internal comment with "quote" */ from t1;
1084 +select */* internal comment with "quote" */ from t1;
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
1095 +show status like "Qcache_hits";
1096 +Variable_name Value
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
1107 +show status like "Qcache_hits";
1108 +Variable_name Value
1110 +select */* internal comment with "quote" */from t1;
1115 +select */* internal comment with "quote" */from t1;
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
1126 +show status like "Qcache_hits";
1127 +Variable_name Value
1129 +-----------------------------------------------------
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
1139 +show status like "Qcache_hits";
1140 +Variable_name Value
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
1160 +show status like "Qcache_hits";
1161 +Variable_name Value
1163 +-----------------------------------------------------
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
1172 +show status like "Qcache_hits";
1173 +Variable_name Value
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
1191 +show status like "Qcache_hits";
1192 +Variable_name Value
1194 +-----------------------------------------------------
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
1203 +show status like "Qcache_hits";
1204 +Variable_name Value
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
1222 +show status like "Qcache_hits";
1223 +Variable_name Value
1225 +-----------------------------------------------------
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
1235 +show status like "Qcache_hits";
1236 +Variable_name Value
1239 +/* comment in the end */;
1245 +/* comment in the end */;
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
1256 +show status like "Qcache_hits";
1257 +Variable_name Value
1259 +-----------------------------------------------------
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
1269 +show status like "Qcache_hits";
1270 +Variable_name Value
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
1290 +show status like "Qcache_hits";
1291 +Variable_name Value
1293 +-----------------------------------------------------
1295 +/* comment in the end */
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
1304 +show status like "Qcache_hits";
1305 +Variable_name Value
1308 +/* comment in the end */
1315 +/* comment in the end */
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
1327 +show status like "Qcache_hits";
1328 +Variable_name Value
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
1339 +show status like "Qcache_hits";
1340 +Variable_name Value
1342 +select * from t1 #comment in the end;
1347 +select * from t1 #comment in the end;
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
1358 +show status like "Qcache_hits";
1359 +Variable_name Value
1361 +-----------------------------------------------------
1362 +select * from t1 #comment in the end
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
1371 +show status like "Qcache_hits";
1372 +Variable_name Value
1374 +select * from t1 #comment in the end
1380 +select * from t1 #comment in the end
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
1392 +show status like "Qcache_hits";
1393 +Variable_name Value
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
1404 +show status like "Qcache_hits";
1405 +Variable_name Value
1407 +select * from t1 -- comment in the end;
1412 +select * from t1 -- comment in the end;
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
1423 +show status like "Qcache_hits";
1424 +Variable_name Value
1426 +-----------------------------------------------------
1427 +select * from t1 -- comment in the end
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
1436 +show status like "Qcache_hits";
1437 +Variable_name Value
1439 +select * from t1 -- comment in the end
1445 +select * from t1 -- comment in the end
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
1457 +show status like "Qcache_hits";
1458 +Variable_name Value
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
1469 +show status like "Qcache_hits";
1470 +Variable_name Value
1472 +select ' \' ' from t1;
1477 +select ' \' ' from t1;
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
1488 +show status like "Qcache_hits";
1489 +Variable_name Value
1492 +SET GLOBAL query_cache_size=default;
1493 +set global query_cache_strip_comments=OFF;
1495 +++ b/mysql-test/r/percona_query_cache_with_comments_crash.result
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);
1505 +( select * from t1 );
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 */;
1517 +SET GLOBAL query_cache_size= default;
1519 +++ b/mysql-test/r/percona_query_cache_with_comments_disable.result
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);
1533 +/* with comment first */select * from t1;
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
1547 +show status like "Qcache_hits";
1548 +Variable_name Value
1550 +/* with comment first */select * from t1;
1555 +/* with comment first */select * from t1;
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
1566 +show status like "Qcache_hits";
1567 +Variable_name Value
1569 +-----------------------------------------------------
1570 +# with comment first
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
1579 +show status like "Qcache_hits";
1580 +Variable_name Value
1582 +# with comment first
1588 +# with comment first
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
1600 +show status like "Qcache_hits";
1601 +Variable_name Value
1603 +-----------------------------------------------------
1604 +-- with comment first
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
1613 +show status like "Qcache_hits";
1614 +Variable_name Value
1616 +-- with comment first
1622 +-- with comment first
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
1634 +show status like "Qcache_hits";
1635 +Variable_name Value
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
1646 +show status like "Qcache_hits";
1647 +Variable_name Value
1649 +/* with comment first and "quote" */select * from t1;
1654 +/* with comment first and "quote" */select * from t1;
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
1665 +show status like "Qcache_hits";
1666 +Variable_name Value
1668 +-----------------------------------------------------
1669 +# with comment first and "quote"
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
1678 +show status like "Qcache_hits";
1679 +Variable_name Value
1681 +# with comment first and "quote"
1687 +# with comment first and "quote"
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
1699 +show status like "Qcache_hits";
1700 +Variable_name Value
1702 +-----------------------------------------------------
1703 +-- with comment first and "quote"
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
1712 +show status like "Qcache_hits";
1713 +Variable_name Value
1715 +-- with comment first and "quote"
1721 +-- with comment first and "quote"
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
1733 +show status like "Qcache_hits";
1734 +Variable_name Value
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
1745 +show status like "Qcache_hits";
1746 +Variable_name Value
1748 +/* with comment and whitespaces first */select * from t1;
1753 +/* with comment and whitespaces first */select * from t1;
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
1764 +show status like "Qcache_hits";
1765 +Variable_name Value
1767 +-----------------------------------------------------
1768 +# with comment and whitespaces first
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
1777 +show status like "Qcache_hits";
1778 +Variable_name Value
1780 +# with comment and whitespaces first
1786 +# with comment and whitespaces first
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
1798 +show status like "Qcache_hits";
1799 +Variable_name Value
1801 +-----------------------------------------------------
1802 +-- with comment and whitespaces first
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
1811 +show status like "Qcache_hits";
1812 +Variable_name Value
1814 +-- with comment and whitespaces first
1820 +-- with comment and whitespaces first
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
1832 +show status like "Qcache_hits";
1833 +Variable_name Value
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
1844 +show status like "Qcache_hits";
1845 +Variable_name Value
1847 +select * /* internal comment */ from t1;
1852 +select * /* internal comment */ from t1;
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
1863 +show status like "Qcache_hits";
1864 +Variable_name Value
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
1875 +show status like "Qcache_hits";
1876 +Variable_name Value
1878 +select */* internal comment */ from t1;
1883 +select */* internal comment */ from t1;
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
1894 +show status like "Qcache_hits";
1895 +Variable_name Value
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
1906 +show status like "Qcache_hits";
1907 +Variable_name Value
1909 +select */* internal comment */from t1;
1914 +select */* internal comment */from t1;
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
1925 +show status like "Qcache_hits";
1926 +Variable_name Value
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
1937 +show status like "Qcache_hits";
1938 +Variable_name Value
1940 +select * /* internal comment with "quote" */ from t1;
1945 +select * /* internal comment with "quote" */ from t1;
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
1956 +show status like "Qcache_hits";
1957 +Variable_name Value
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
1968 +show status like "Qcache_hits";
1969 +Variable_name Value
1971 +select */* internal comment with "quote" */ from t1;
1976 +select */* internal comment with "quote" */ from t1;
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
1987 +show status like "Qcache_hits";
1988 +Variable_name Value
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
1999 +show status like "Qcache_hits";
2000 +Variable_name Value
2002 +select */* internal comment with "quote" */from t1;
2007 +select */* internal comment with "quote" */from t1;
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
2018 +show status like "Qcache_hits";
2019 +Variable_name Value
2021 +-----------------------------------------------------
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
2031 +show status like "Qcache_hits";
2032 +Variable_name Value
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
2052 +show status like "Qcache_hits";
2053 +Variable_name Value
2055 +-----------------------------------------------------
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
2064 +show status like "Qcache_hits";
2065 +Variable_name Value
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
2083 +show status like "Qcache_hits";
2084 +Variable_name Value
2086 +-----------------------------------------------------
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
2095 +show status like "Qcache_hits";
2096 +Variable_name Value
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
2114 +show status like "Qcache_hits";
2115 +Variable_name Value
2117 +-----------------------------------------------------
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
2127 +show status like "Qcache_hits";
2128 +Variable_name Value
2131 +/* comment in the end */;
2137 +/* comment in the end */;
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
2148 +show status like "Qcache_hits";
2149 +Variable_name Value
2151 +-----------------------------------------------------
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
2161 +show status like "Qcache_hits";
2162 +Variable_name Value
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
2182 +show status like "Qcache_hits";
2183 +Variable_name Value
2185 +-----------------------------------------------------
2187 +/* comment in the end */
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
2196 +show status like "Qcache_hits";
2197 +Variable_name Value
2200 +/* comment in the end */
2207 +/* comment in the end */
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
2219 +show status like "Qcache_hits";
2220 +Variable_name Value
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
2231 +show status like "Qcache_hits";
2232 +Variable_name Value
2234 +select * from t1 #comment in the end;
2239 +select * from t1 #comment in the end;
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
2250 +show status like "Qcache_hits";
2251 +Variable_name Value
2253 +-----------------------------------------------------
2254 +select * from t1 #comment in the end
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
2263 +show status like "Qcache_hits";
2264 +Variable_name Value
2266 +select * from t1 #comment in the end
2272 +select * from t1 #comment in the end
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
2284 +show status like "Qcache_hits";
2285 +Variable_name Value
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
2296 +show status like "Qcache_hits";
2297 +Variable_name Value
2299 +select * from t1 -- comment in the end;
2304 +select * from t1 -- comment in the end;
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
2315 +show status like "Qcache_hits";
2316 +Variable_name Value
2318 +-----------------------------------------------------
2319 +select * from t1 -- comment in the end
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
2328 +show status like "Qcache_hits";
2329 +Variable_name Value
2331 +select * from t1 -- comment in the end
2337 +select * from t1 -- comment in the end
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
2349 +show status like "Qcache_hits";
2350 +Variable_name Value
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
2361 +show status like "Qcache_hits";
2362 +Variable_name Value
2364 +select ' \' ' from t1;
2369 +select ' \' ' from t1;
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
2380 +show status like "Qcache_hits";
2381 +Variable_name Value
2384 +SET GLOBAL query_cache_size=default;
2385 +set global query_cache_strip_comments=OFF;
2387 +++ b/mysql-test/r/percona_query_cache_with_comments_prepared_statements.result
2389 +set GLOBAL query_cache_size=1355776;
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
2404 +show status like "Qcache_hits";
2405 +Variable_name Value
2407 +prepare stmt from '/* with comment */ select * from t1';
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
2419 +show status like "Qcache_hits";
2420 +Variable_name Value
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
2453 +show status like "Qcache_hits";
2454 +Variable_name Value
2456 +prepare stmt from 'select * from t1';
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
2468 +show status like "Qcache_hits";
2469 +Variable_name Value
2471 +prepare stmt from 'select * /*internal comment*/from t1';
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
2483 +show status like "Qcache_hits";
2484 +Variable_name Value
2486 +prepare stmt from 'select * /*internal comment*/ from t1';
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
2498 +show status like "Qcache_hits";
2499 +Variable_name Value
2501 +prepare stmt from 'select * from t1 /* at the end */';
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
2513 +show status like "Qcache_hits";
2514 +Variable_name Value
2516 +prepare stmt from 'select * from t1 /* with "quote" */';
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
2528 +show status like "Qcache_hits";
2529 +Variable_name Value
2531 +prepare stmt from 'select * from t1 /* with \'quote\' */';
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
2543 +show status like "Qcache_hits";
2544 +Variable_name Value
2546 +prepare stmt from 'select * from t1 # 123
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
2559 +show status like "Qcache_hits";
2560 +Variable_name Value
2562 +prepare stmt from 'select * from t1 # 123 with "quote"
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
2575 +show status like "Qcache_hits";
2576 +Variable_name Value
2578 +prepare stmt from 'select * from t1 # 123 with \'quote\'
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
2591 +show status like "Qcache_hits";
2592 +Variable_name Value
2594 +prepare stmt from 'select * from t1
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
2608 +show status like "Qcache_hits";
2609 +Variable_name Value
2611 +prepare stmt from '#456
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
2626 +show status like "Qcache_hits";
2627 +Variable_name Value
2629 +prepare stmt from 'select * from t1 -- 123
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
2642 +show status like "Qcache_hits";
2643 +Variable_name Value
2645 +prepare stmt from 'select * from t1
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
2659 +show status like "Qcache_hits";
2660 +Variable_name Value
2662 +prepare stmt from '-- comment in first
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
2677 +show status like "Qcache_hits";
2678 +Variable_name Value
2680 +prepare stmt from '(#456(
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
2695 +show status like "Qcache_hits";
2696 +Variable_name Value
2698 +prepare stmt from '/*test*/(-- comment in first(
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
2713 +show status like "Qcache_hits";
2714 +Variable_name Value
2716 +prepare stmt from 'select "test",a from t1';
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
2733 +show status like "Qcache_hits";
2734 +Variable_name Value
2736 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
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
2748 +show status like "Qcache_hits";
2749 +Variable_name Value
2751 +prepare stmt from 'select "test #internal comment" ,a from t1';
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
2763 +show status like "Qcache_hits";
2764 +Variable_name Value
2766 +prepare stmt from 'select "test #internal comment" #external comment
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
2779 +show status like "Qcache_hits";
2780 +Variable_name Value
2783 +SET GLOBAL query_cache_size= default;
2784 +set global query_cache_strip_comments=OFF;
2786 +++ b/mysql-test/t/percona_query_cache_with_comments.test
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
2794 +++ b/mysql-test/t/percona_query_cache_with_comments_crash.test
2796 +-- source include/have_query_cache.inc
2797 +set GLOBAL query_cache_size=1355776;
2799 +drop table if exists t1;
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
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
2813 +let query=-- only comment
2817 +SET GLOBAL query_cache_size= default;
2819 +++ b/mysql-test/t/percona_query_cache_with_comments_disable.test
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
2825 +++ b/mysql-test/t/percona_query_cache_with_comments_prepared_statements.test
2827 +-- source include/have_query_cache.inc
2829 +set GLOBAL query_cache_size=1355776;
2831 +# Reset query cache variables.
2832 +flush query cache; # This crashed in some versions
2833 +flush query cache; # This crashed in some versions
2837 +drop table if exists t1;
2841 +# First simple test
2844 +create table t1 (a int not null);
2845 +insert into t1 values (1),(2),(3);
2847 +set global query_cache_strip_comments=ON;
2849 +show status like "Qcache_queries_in_cache";
2850 +show status like "Qcache_inserts";
2851 +show status like "Qcache_hits";
2853 +prepare stmt from '/* with comment */ select * from t1';
2856 +show status like "Qcache_queries_in_cache";
2857 +show status like "Qcache_inserts";
2858 +show status like "Qcache_hits";
2866 +show status like "Qcache_queries_in_cache";
2867 +show status like "Qcache_inserts";
2868 +show status like "Qcache_hits";
2870 +prepare stmt from 'select * from t1';
2873 +show status like "Qcache_queries_in_cache";
2874 +show status like "Qcache_inserts";
2875 +show status like "Qcache_hits";
2877 +prepare stmt from 'select * /*internal comment*/from t1';
2880 +show status like "Qcache_queries_in_cache";
2881 +show status like "Qcache_inserts";
2882 +show status like "Qcache_hits";
2884 +prepare stmt from 'select * /*internal comment*/ from t1';
2887 +show status like "Qcache_queries_in_cache";
2888 +show status like "Qcache_inserts";
2889 +show status like "Qcache_hits";
2891 +prepare stmt from 'select * from t1 /* at the end */';
2894 +show status like "Qcache_queries_in_cache";
2895 +show status like "Qcache_inserts";
2896 +show status like "Qcache_hits";
2898 +prepare stmt from 'select * from t1 /* with "quote" */';
2901 +show status like "Qcache_queries_in_cache";
2902 +show status like "Qcache_inserts";
2903 +show status like "Qcache_hits";
2905 +prepare stmt from 'select * from t1 /* with \'quote\' */';
2908 +show status like "Qcache_queries_in_cache";
2909 +show status like "Qcache_inserts";
2910 +show status like "Qcache_hits";
2912 +prepare stmt from 'select * from t1 # 123
2916 +show status like "Qcache_queries_in_cache";
2917 +show status like "Qcache_inserts";
2918 +show status like "Qcache_hits";
2920 +prepare stmt from 'select * from t1 # 123 with "quote"
2924 +show status like "Qcache_queries_in_cache";
2925 +show status like "Qcache_inserts";
2926 +show status like "Qcache_hits";
2928 +prepare stmt from 'select * from t1 # 123 with \'quote\'
2932 +show status like "Qcache_queries_in_cache";
2933 +show status like "Qcache_inserts";
2934 +show status like "Qcache_hits";
2936 +prepare stmt from 'select * from t1
2941 +show status like "Qcache_queries_in_cache";
2942 +show status like "Qcache_inserts";
2943 +show status like "Qcache_hits";
2945 +prepare stmt from '#456
2951 +show status like "Qcache_queries_in_cache";
2952 +show status like "Qcache_inserts";
2953 +show status like "Qcache_hits";
2955 +prepare stmt from 'select * from t1 -- 123
2959 +show status like "Qcache_queries_in_cache";
2960 +show status like "Qcache_inserts";
2961 +show status like "Qcache_hits";
2963 +prepare stmt from 'select * from t1
2968 +show status like "Qcache_queries_in_cache";
2969 +show status like "Qcache_inserts";
2970 +show status like "Qcache_hits";
2972 +prepare stmt from '-- comment in first
2978 +show status like "Qcache_queries_in_cache";
2979 +show status like "Qcache_inserts";
2980 +show status like "Qcache_hits";
2982 +prepare stmt from '(#456(
2988 +show status like "Qcache_queries_in_cache";
2989 +show status like "Qcache_inserts";
2990 +show status like "Qcache_hits";
2992 +prepare stmt from '/*test*/(-- comment in first(
2998 +show status like "Qcache_queries_in_cache";
2999 +show status like "Qcache_inserts";
3000 +show status like "Qcache_hits";
3002 +prepare stmt from 'select "test",a from t1';
3006 +show status like "Qcache_queries_in_cache";
3007 +show status like "Qcache_inserts";
3008 +show status like "Qcache_hits";
3010 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
3013 +show status like "Qcache_queries_in_cache";
3014 +show status like "Qcache_inserts";
3015 +show status like "Qcache_hits";
3017 +prepare stmt from 'select "test #internal comment" ,a from t1';
3020 +show status like "Qcache_queries_in_cache";
3021 +show status like "Qcache_inserts";
3022 +show status like "Qcache_hits";
3024 +prepare stmt from 'select "test #internal comment" #external comment
3028 +show status like "Qcache_queries_in_cache";
3029 +show status like "Qcache_inserts";
3030 +show status like "Qcache_hits";
3033 +SET GLOBAL query_cache_size= default;
3034 +set global query_cache_strip_comments=OFF;
3036 +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
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
3043 +--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
3045 +--connect (mutex_locked_conn, localhost, root,,)
3046 +--connect (try_mutex_lock_conn, localhost, root,,)
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;
3052 +--connection default
3053 +SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
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;
3059 +--connection default
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';
3064 +--connection mutex_locked_conn
3066 +--connection try_mutex_lock_conn
3069 +--connection default
3070 +--disconnect mutex_locked_conn
3071 +--disconnect try_mutex_lock_conn
3072 +SET GLOBAL query_cache_size=0;
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 =
3087 query-cache-limit 1048576
3088 query-cache-min-res-unit 4096
3090 +query-cache-strip-comments FALSE
3092 query-cache-wlock-invalidate FALSE
3093 query-prealloc-size 8192
3095 +++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
3097 +SET GLOBAL query_cache_size=1355776;
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';
3110 +Waiting on query cache mutex
3111 +SET DEBUG_SYNC='now SIGNAL unlock_mutex';
3115 +try_lock_mutex_query
3116 +SET GLOBAL query_cache_size=0;