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 mysql_mutex_lock(&structure_guard_mutex);
277 + DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");
278 + DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
281 + thd->proc_info = old_proc_info;
284 if (m_cache_lock_status == Query_cache::UNLOCKED)
285 @@ -1274,6 +1456,8 @@
289 + QueryStripComments *query_strip_comments = &(thd->query_strip_comments);
290 + QueryStripComments_Backup backup(thd,query_strip_comments);
292 /* Key is query + database + flag */
294 @@ -1451,6 +1635,9 @@
295 Query_cache_block_table *block_table, *block_table_end;
297 Query_cache_query_flags flags;
298 + QueryStripComments *query_strip_comments = &(thd->query_strip_comments);
299 + char *sql_backup = sql;
300 + uint query_length_backup = query_length;
301 DBUG_ENTER("Query_cache::send_result_to_client");
304 @@ -1472,21 +1659,103 @@
309 - Skip '(' characters in queries like following:
310 - (select a from t1) union (select a from t1);
312 - while (sql[i]=='(')
314 + if(opt_query_cache_strip_comments)
316 + /* Skip all comments and non-letter symbols */
317 + uint& query_position = i;
319 + while(query_position < query_length)
321 + bool check = false;
322 + char current = query[query_position];
326 + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2]))
328 + query_position += 2; // skip "/*"
331 + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/" (without space)
333 + query_position += 2; // skip "*/" (without space)
341 + while(query_position < query_length);
342 + continue; // analyze current symbol
346 + if(query[query_position+1] == '-')
348 + ++query_position; // skip "-"
357 + ++query_position; // skip current symbol
358 + if('\n' == query[query_position]) // check for '\n'
360 + ++query_position; // skip '\n'
364 + while(query_position < query_length);
365 + continue; // analyze current symbol
375 + break; // make gcc happy
376 + } // switch(current)
379 + if(query_position + 2 < query_length)
386 + DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
391 + } // while(query_position < query_length)
393 + else // if(opt_query_cache_strip_comments)
396 + Skip '(' characters in queries like following:
397 + (select a from t1) union (select a from t1);
399 + while (sql[i]=='(')
403 - Test if the query is a SELECT
404 - (pre-space is removed in dispatch_command).
405 + } // if(opt_query_cache_strip_comments)
407 + Test if the query is a SELECT
408 + (pre-space is removed in dispatch_command).
410 - First '/' looks like comment before command it is not
411 - frequently appeared in real life, consequently we can
412 - check all such queries, too.
414 + First '/' looks like comment before command it is not
415 + frequently appeared in real life, consequently we can
416 + check all such queries, too.
418 if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
419 my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
420 my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
421 @@ -1521,6 +1790,12 @@
424 Query_cache_block *query_block;
425 + if(opt_query_cache_strip_comments)
427 + query_strip_comments->set(sql, query_length, thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE);
428 + sql = query_strip_comments->query();
429 + query_length = query_strip_comments->query_length();
432 tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
434 @@ -1587,6 +1862,8 @@
435 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
436 query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,
439 + query_length = query_length_backup;
440 /* Quick abort on unlocked data */
441 if (query_block == 0 ||
442 query_block->query()->result() == 0 ||
443 --- a/sql/sql_class.h
444 +++ b/sql/sql_class.h
446 #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
449 +#ifdef HAVE_QUERY_CACHE
450 +#include "query_strip_comments.h"
451 +#endif // HAVE_QUERY_CACHE
453 class Reprepare_observer;
454 class Relay_log_info;
456 statement lifetime. FIXME: must be const
459 +#ifdef HAVE_QUERY_CACHE
460 + QueryStripComments query_strip_comments; // see sql_cache.cc
461 +#endif //HAVE_QUERY_CACHE
464 MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
465 --- a/sql/sys_vars.cc
466 +++ b/sql/sys_vars.cc
467 @@ -1786,6 +1786,11 @@
468 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
469 ON_UPDATE(fix_query_cache_size));
471 +static Sys_var_mybool Sys_query_cache_strip_comments(
472 + "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",
473 + GLOBAL_VAR(opt_query_cache_strip_comments), CMD_LINE(OPT_ARG),
476 static Sys_var_ulong Sys_query_cache_limit(
478 "Don't cache results that are bigger than this",
480 +++ b/mysql-test/include/percona_query_cache_with_comments.inc
482 +--source include/percona_query_cache_with_comments_clear.inc
483 +let $query=/* with comment first */select * from t1;
485 +--source include/percona_query_cache_with_comments_eval.inc
487 +let $query=# with comment first
489 +--source include/percona_query_cache_with_comments_eval.inc
491 +let $query=-- with comment first
493 +--source include/percona_query_cache_with_comments_eval.inc
495 +let $query=/* with comment first and "quote" */select * from t1;
496 +--source include/percona_query_cache_with_comments_eval.inc
498 +let $query=# with comment first and "quote"
500 +--source include/percona_query_cache_with_comments_eval.inc
502 +let $query=-- with comment first and "quote"
504 +--source include/percona_query_cache_with_comments_eval.inc
507 + /* with comment and whitespaces first */select * from t1;
508 +--source include/percona_query_cache_with_comments_eval.inc
511 + # with comment and whitespaces first
513 +--source include/percona_query_cache_with_comments_eval.inc
516 + -- with comment and whitespaces first
518 +--source include/percona_query_cache_with_comments_eval.inc
520 +let $internal=* internal comment *;
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 +let $query=select */$internal/from t1;
527 +--source include/percona_query_cache_with_comments_eval.inc
529 +let $internal=* internal comment with "quote" *;
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 +let $query=select */$internal/from t1;
536 +--source include/percona_query_cache_with_comments_eval.inc
538 +let $query=select * from t1
540 +--source include/percona_query_cache_with_comments_eval.inc
542 +let $query=select * from t1 ;
543 +--source include/percona_query_cache_with_comments_eval.inc
545 +let $query=select * from t1 ;
546 +--source include/percona_query_cache_with_comments_eval.inc
548 +let $query=select * from t1
549 +/* comment in the end */;
550 +--source include/percona_query_cache_with_comments_eval.inc
552 +let $query=select * from t1
554 +--source include/percona_query_cache_with_comments_eval.inc
556 +let $query=select * from t1
557 +/* comment in the end */
559 +--source include/percona_query_cache_with_comments_eval.inc
561 +let $query=select * from t1 #comment in the end;
562 +--source include/percona_query_cache_with_comments_eval.inc
564 +let $query=select * from t1 #comment in the end
566 +--source include/percona_query_cache_with_comments_eval.inc
568 +let $query=select * from t1 -- comment in the end;
569 +--source include/percona_query_cache_with_comments_eval.inc
571 +let $query=select * from t1 -- comment in the end
573 +--source include/percona_query_cache_with_comments_eval.inc
575 +let $query=select ' \' ' from t1;
576 +--source include/percona_query_cache_with_comments_eval.inc
578 +++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc
580 +-- source include/have_query_cache.inc
582 +set GLOBAL query_cache_size=1355776;
585 +drop table if exists t1;
588 +create table t1 (a int not null);
589 +insert into t1 values (1),(2),(3);
591 +--source include/percona_query_cache_with_comments_clear.inc
593 +++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc
595 +# Reset query cache variables.
596 +flush query cache; # This crashed in some versions
597 +flush query cache; # This crashed in some versions
601 +++ b/mysql-test/include/percona_query_cache_with_comments_end.inc
604 +SET GLOBAL query_cache_size=default;
605 +set global query_cache_strip_comments=OFF;
607 +++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc
609 +echo -----------------------------------------------------;
611 +echo -----------------------------------------------------;
612 +--source include/percona_query_cache_with_comments_show.inc
615 +--source include/percona_query_cache_with_comments_show.inc
617 +++ b/mysql-test/include/percona_query_cache_with_comments_show.inc
619 +let $show=show status like "Qcache_queries_in_cache";
621 +let $show=show status like "Qcache_inserts";
623 +let $show=show status like "Qcache_hits";
628 +++ b/mysql-test/r/percona_query_cache_with_comments.result
630 +set global query_cache_strip_comments=ON;
631 +set GLOBAL query_cache_size=1355776;
632 +drop table if exists t1;
633 +create table t1 (a int not null);
634 +insert into t1 values (1),(2),(3);
643 +/* with comment first */select * from t1;
648 +-----------------------------------------------------
649 +/* with comment first */select * from t1
650 +-----------------------------------------------------
651 +show status like "Qcache_queries_in_cache";
653 +Qcache_queries_in_cache 1
654 +show status like "Qcache_inserts";
657 +show status like "Qcache_hits";
660 +/* with comment first */select * from t1;
665 +/* with comment first */select * from t1;
670 +show status like "Qcache_queries_in_cache";
672 +Qcache_queries_in_cache 1
673 +show status like "Qcache_inserts";
676 +show status like "Qcache_hits";
679 +-----------------------------------------------------
680 +# with comment first
682 +-----------------------------------------------------
683 +show status like "Qcache_queries_in_cache";
685 +Qcache_queries_in_cache 1
686 +show status like "Qcache_inserts";
689 +show status like "Qcache_hits";
692 +# with comment first
698 +# with comment first
704 +show status like "Qcache_queries_in_cache";
706 +Qcache_queries_in_cache 1
707 +show status like "Qcache_inserts";
710 +show status like "Qcache_hits";
713 +-----------------------------------------------------
714 +-- with comment first
716 +-----------------------------------------------------
717 +show status like "Qcache_queries_in_cache";
719 +Qcache_queries_in_cache 1
720 +show status like "Qcache_inserts";
723 +show status like "Qcache_hits";
726 +-- with comment first
732 +-- with comment first
738 +show status like "Qcache_queries_in_cache";
740 +Qcache_queries_in_cache 1
741 +show status like "Qcache_inserts";
744 +show status like "Qcache_hits";
747 +-----------------------------------------------------
748 +/* with comment first and "quote" */select * from t1
749 +-----------------------------------------------------
750 +show status like "Qcache_queries_in_cache";
752 +Qcache_queries_in_cache 1
753 +show status like "Qcache_inserts";
756 +show status like "Qcache_hits";
759 +/* with comment first and "quote" */select * from t1;
764 +/* with comment first and "quote" */select * from t1;
769 +show status like "Qcache_queries_in_cache";
771 +Qcache_queries_in_cache 1
772 +show status like "Qcache_inserts";
775 +show status like "Qcache_hits";
778 +-----------------------------------------------------
779 +# with comment first and "quote"
781 +-----------------------------------------------------
782 +show status like "Qcache_queries_in_cache";
784 +Qcache_queries_in_cache 1
785 +show status like "Qcache_inserts";
788 +show status like "Qcache_hits";
791 +# with comment first and "quote"
797 +# with comment first and "quote"
803 +show status like "Qcache_queries_in_cache";
805 +Qcache_queries_in_cache 1
806 +show status like "Qcache_inserts";
809 +show status like "Qcache_hits";
812 +-----------------------------------------------------
813 +-- with comment first and "quote"
815 +-----------------------------------------------------
816 +show status like "Qcache_queries_in_cache";
818 +Qcache_queries_in_cache 1
819 +show status like "Qcache_inserts";
822 +show status like "Qcache_hits";
825 +-- with comment first and "quote"
831 +-- with comment first and "quote"
837 +show status like "Qcache_queries_in_cache";
839 +Qcache_queries_in_cache 1
840 +show status like "Qcache_inserts";
843 +show status like "Qcache_hits";
846 +-----------------------------------------------------
847 +/* with comment and whitespaces first */select * from t1
848 +-----------------------------------------------------
849 +show status like "Qcache_queries_in_cache";
851 +Qcache_queries_in_cache 1
852 +show status like "Qcache_inserts";
855 +show status like "Qcache_hits";
858 +/* with comment and whitespaces first */select * from t1;
863 +/* with comment and whitespaces first */select * from t1;
868 +show status like "Qcache_queries_in_cache";
870 +Qcache_queries_in_cache 1
871 +show status like "Qcache_inserts";
874 +show status like "Qcache_hits";
877 +-----------------------------------------------------
878 +# with comment and whitespaces first
880 +-----------------------------------------------------
881 +show status like "Qcache_queries_in_cache";
883 +Qcache_queries_in_cache 1
884 +show status like "Qcache_inserts";
887 +show status like "Qcache_hits";
890 +# with comment and whitespaces first
896 +# with comment and whitespaces first
902 +show status like "Qcache_queries_in_cache";
904 +Qcache_queries_in_cache 1
905 +show status like "Qcache_inserts";
908 +show status like "Qcache_hits";
911 +-----------------------------------------------------
912 +-- with comment and whitespaces first
914 +-----------------------------------------------------
915 +show status like "Qcache_queries_in_cache";
917 +Qcache_queries_in_cache 1
918 +show status like "Qcache_inserts";
921 +show status like "Qcache_hits";
924 +-- with comment and whitespaces first
930 +-- with comment and whitespaces first
936 +show status like "Qcache_queries_in_cache";
938 +Qcache_queries_in_cache 1
939 +show status like "Qcache_inserts";
942 +show status like "Qcache_hits";
945 +-----------------------------------------------------
946 +select * /* internal comment */ from t1
947 +-----------------------------------------------------
948 +show status like "Qcache_queries_in_cache";
950 +Qcache_queries_in_cache 1
951 +show status like "Qcache_inserts";
954 +show status like "Qcache_hits";
957 +select * /* internal comment */ from t1;
962 +select * /* internal comment */ from t1;
967 +show status like "Qcache_queries_in_cache";
969 +Qcache_queries_in_cache 1
970 +show status like "Qcache_inserts";
973 +show status like "Qcache_hits";
976 +-----------------------------------------------------
977 +select */* internal comment */ from t1
978 +-----------------------------------------------------
979 +show status like "Qcache_queries_in_cache";
981 +Qcache_queries_in_cache 1
982 +show status like "Qcache_inserts";
985 +show status like "Qcache_hits";
988 +select */* internal comment */ from t1;
993 +select */* internal comment */ from t1;
998 +show status like "Qcache_queries_in_cache";
1000 +Qcache_queries_in_cache 1
1001 +show status like "Qcache_inserts";
1002 +Variable_name Value
1004 +show status like "Qcache_hits";
1005 +Variable_name Value
1007 +-----------------------------------------------------
1008 +select */* internal comment */from t1
1009 +-----------------------------------------------------
1010 +show status like "Qcache_queries_in_cache";
1011 +Variable_name Value
1012 +Qcache_queries_in_cache 1
1013 +show status like "Qcache_inserts";
1014 +Variable_name Value
1016 +show status like "Qcache_hits";
1017 +Variable_name Value
1019 +select */* internal comment */from t1;
1024 +select */* internal comment */from t1;
1029 +show status like "Qcache_queries_in_cache";
1030 +Variable_name Value
1031 +Qcache_queries_in_cache 1
1032 +show status like "Qcache_inserts";
1033 +Variable_name Value
1035 +show status like "Qcache_hits";
1036 +Variable_name Value
1038 +-----------------------------------------------------
1039 +select * /* internal comment with "quote" */ from t1
1040 +-----------------------------------------------------
1041 +show status like "Qcache_queries_in_cache";
1042 +Variable_name Value
1043 +Qcache_queries_in_cache 1
1044 +show status like "Qcache_inserts";
1045 +Variable_name Value
1047 +show status like "Qcache_hits";
1048 +Variable_name Value
1050 +select * /* internal comment with "quote" */ from t1;
1055 +select * /* internal comment with "quote" */ from t1;
1060 +show status like "Qcache_queries_in_cache";
1061 +Variable_name Value
1062 +Qcache_queries_in_cache 1
1063 +show status like "Qcache_inserts";
1064 +Variable_name Value
1066 +show status like "Qcache_hits";
1067 +Variable_name Value
1069 +-----------------------------------------------------
1070 +select */* internal comment with "quote" */ from t1
1071 +-----------------------------------------------------
1072 +show status like "Qcache_queries_in_cache";
1073 +Variable_name Value
1074 +Qcache_queries_in_cache 1
1075 +show status like "Qcache_inserts";
1076 +Variable_name Value
1078 +show status like "Qcache_hits";
1079 +Variable_name Value
1081 +select */* internal comment with "quote" */ from t1;
1086 +select */* internal comment with "quote" */ from t1;
1091 +show status like "Qcache_queries_in_cache";
1092 +Variable_name Value
1093 +Qcache_queries_in_cache 1
1094 +show status like "Qcache_inserts";
1095 +Variable_name Value
1097 +show status like "Qcache_hits";
1098 +Variable_name Value
1100 +-----------------------------------------------------
1101 +select */* internal comment with "quote" */from t1
1102 +-----------------------------------------------------
1103 +show status like "Qcache_queries_in_cache";
1104 +Variable_name Value
1105 +Qcache_queries_in_cache 1
1106 +show status like "Qcache_inserts";
1107 +Variable_name Value
1109 +show status like "Qcache_hits";
1110 +Variable_name Value
1112 +select */* internal comment with "quote" */from t1;
1117 +select */* internal comment with "quote" */from t1;
1122 +show status like "Qcache_queries_in_cache";
1123 +Variable_name Value
1124 +Qcache_queries_in_cache 1
1125 +show status like "Qcache_inserts";
1126 +Variable_name Value
1128 +show status like "Qcache_hits";
1129 +Variable_name Value
1131 +-----------------------------------------------------
1134 +-----------------------------------------------------
1135 +show status like "Qcache_queries_in_cache";
1136 +Variable_name Value
1137 +Qcache_queries_in_cache 1
1138 +show status like "Qcache_inserts";
1139 +Variable_name Value
1141 +show status like "Qcache_hits";
1142 +Variable_name Value
1156 +show status like "Qcache_queries_in_cache";
1157 +Variable_name Value
1158 +Qcache_queries_in_cache 1
1159 +show status like "Qcache_inserts";
1160 +Variable_name Value
1162 +show status like "Qcache_hits";
1163 +Variable_name Value
1165 +-----------------------------------------------------
1167 +-----------------------------------------------------
1168 +show status like "Qcache_queries_in_cache";
1169 +Variable_name Value
1170 +Qcache_queries_in_cache 1
1171 +show status like "Qcache_inserts";
1172 +Variable_name Value
1174 +show status like "Qcache_hits";
1175 +Variable_name Value
1187 +show status like "Qcache_queries_in_cache";
1188 +Variable_name Value
1189 +Qcache_queries_in_cache 1
1190 +show status like "Qcache_inserts";
1191 +Variable_name Value
1193 +show status like "Qcache_hits";
1194 +Variable_name Value
1196 +-----------------------------------------------------
1198 +-----------------------------------------------------
1199 +show status like "Qcache_queries_in_cache";
1200 +Variable_name Value
1201 +Qcache_queries_in_cache 1
1202 +show status like "Qcache_inserts";
1203 +Variable_name Value
1205 +show status like "Qcache_hits";
1206 +Variable_name Value
1218 +show status like "Qcache_queries_in_cache";
1219 +Variable_name Value
1220 +Qcache_queries_in_cache 1
1221 +show status like "Qcache_inserts";
1222 +Variable_name Value
1224 +show status like "Qcache_hits";
1225 +Variable_name Value
1227 +-----------------------------------------------------
1229 +/* comment in the end */
1230 +-----------------------------------------------------
1231 +show status like "Qcache_queries_in_cache";
1232 +Variable_name Value
1233 +Qcache_queries_in_cache 1
1234 +show status like "Qcache_inserts";
1235 +Variable_name Value
1237 +show status like "Qcache_hits";
1238 +Variable_name Value
1241 +/* comment in the end */;
1247 +/* comment in the end */;
1252 +show status like "Qcache_queries_in_cache";
1253 +Variable_name Value
1254 +Qcache_queries_in_cache 1
1255 +show status like "Qcache_inserts";
1256 +Variable_name Value
1258 +show status like "Qcache_hits";
1259 +Variable_name Value
1261 +-----------------------------------------------------
1264 +-----------------------------------------------------
1265 +show status like "Qcache_queries_in_cache";
1266 +Variable_name Value
1267 +Qcache_queries_in_cache 1
1268 +show status like "Qcache_inserts";
1269 +Variable_name Value
1271 +show status like "Qcache_hits";
1272 +Variable_name Value
1286 +show status like "Qcache_queries_in_cache";
1287 +Variable_name Value
1288 +Qcache_queries_in_cache 1
1289 +show status like "Qcache_inserts";
1290 +Variable_name Value
1292 +show status like "Qcache_hits";
1293 +Variable_name Value
1295 +-----------------------------------------------------
1297 +/* comment in the end */
1299 +-----------------------------------------------------
1300 +show status like "Qcache_queries_in_cache";
1301 +Variable_name Value
1302 +Qcache_queries_in_cache 1
1303 +show status like "Qcache_inserts";
1304 +Variable_name Value
1306 +show status like "Qcache_hits";
1307 +Variable_name Value
1310 +/* comment in the end */
1317 +/* comment in the end */
1323 +show status like "Qcache_queries_in_cache";
1324 +Variable_name Value
1325 +Qcache_queries_in_cache 1
1326 +show status like "Qcache_inserts";
1327 +Variable_name Value
1329 +show status like "Qcache_hits";
1330 +Variable_name Value
1332 +-----------------------------------------------------
1333 +select * from t1 #comment in the end
1334 +-----------------------------------------------------
1335 +show status like "Qcache_queries_in_cache";
1336 +Variable_name Value
1337 +Qcache_queries_in_cache 1
1338 +show status like "Qcache_inserts";
1339 +Variable_name Value
1341 +show status like "Qcache_hits";
1342 +Variable_name Value
1344 +select * from t1 #comment in the end;
1349 +select * from t1 #comment in the end;
1354 +show status like "Qcache_queries_in_cache";
1355 +Variable_name Value
1356 +Qcache_queries_in_cache 1
1357 +show status like "Qcache_inserts";
1358 +Variable_name Value
1360 +show status like "Qcache_hits";
1361 +Variable_name Value
1363 +-----------------------------------------------------
1364 +select * from t1 #comment in the end
1366 +-----------------------------------------------------
1367 +show status like "Qcache_queries_in_cache";
1368 +Variable_name Value
1369 +Qcache_queries_in_cache 1
1370 +show status like "Qcache_inserts";
1371 +Variable_name Value
1373 +show status like "Qcache_hits";
1374 +Variable_name Value
1376 +select * from t1 #comment in the end
1382 +select * from t1 #comment in the end
1388 +show status like "Qcache_queries_in_cache";
1389 +Variable_name Value
1390 +Qcache_queries_in_cache 1
1391 +show status like "Qcache_inserts";
1392 +Variable_name Value
1394 +show status like "Qcache_hits";
1395 +Variable_name Value
1397 +-----------------------------------------------------
1398 +select * from t1 -- comment in the end
1399 +-----------------------------------------------------
1400 +show status like "Qcache_queries_in_cache";
1401 +Variable_name Value
1402 +Qcache_queries_in_cache 1
1403 +show status like "Qcache_inserts";
1404 +Variable_name Value
1406 +show status like "Qcache_hits";
1407 +Variable_name Value
1409 +select * from t1 -- comment in the end;
1414 +select * from t1 -- comment in the end;
1419 +show status like "Qcache_queries_in_cache";
1420 +Variable_name Value
1421 +Qcache_queries_in_cache 1
1422 +show status like "Qcache_inserts";
1423 +Variable_name Value
1425 +show status like "Qcache_hits";
1426 +Variable_name Value
1428 +-----------------------------------------------------
1429 +select * from t1 -- comment in the end
1431 +-----------------------------------------------------
1432 +show status like "Qcache_queries_in_cache";
1433 +Variable_name Value
1434 +Qcache_queries_in_cache 1
1435 +show status like "Qcache_inserts";
1436 +Variable_name Value
1438 +show status like "Qcache_hits";
1439 +Variable_name Value
1441 +select * from t1 -- comment in the end
1447 +select * from t1 -- comment in the end
1453 +show status like "Qcache_queries_in_cache";
1454 +Variable_name Value
1455 +Qcache_queries_in_cache 1
1456 +show status like "Qcache_inserts";
1457 +Variable_name Value
1459 +show status like "Qcache_hits";
1460 +Variable_name Value
1462 +-----------------------------------------------------
1463 +select ' \' ' from t1
1464 +-----------------------------------------------------
1465 +show status like "Qcache_queries_in_cache";
1466 +Variable_name Value
1467 +Qcache_queries_in_cache 1
1468 +show status like "Qcache_inserts";
1469 +Variable_name Value
1471 +show status like "Qcache_hits";
1472 +Variable_name Value
1474 +select ' \' ' from t1;
1479 +select ' \' ' from t1;
1484 +show status like "Qcache_queries_in_cache";
1485 +Variable_name Value
1486 +Qcache_queries_in_cache 2
1487 +show status like "Qcache_inserts";
1488 +Variable_name Value
1490 +show status like "Qcache_hits";
1491 +Variable_name Value
1494 +SET GLOBAL query_cache_size=default;
1495 +set global query_cache_strip_comments=OFF;
1497 +++ b/mysql-test/r/percona_query_cache_with_comments_crash.result
1499 +set GLOBAL query_cache_size=1355776;
1500 +drop table if exists t1;
1501 +create table t1 (a int not null);
1502 +insert into t1 values (1),(2),(3);
1507 +( select * from t1 );
1512 +/*!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 */;
1513 +/* only comment */;
1519 +SET GLOBAL query_cache_size= default;
1521 +++ b/mysql-test/r/percona_query_cache_with_comments_disable.result
1523 +set GLOBAL query_cache_size=1355776;
1524 +drop table if exists t1;
1525 +create table t1 (a int not null);
1526 +insert into t1 values (1),(2),(3);
1535 +/* with comment first */select * from t1;
1540 +-----------------------------------------------------
1541 +/* with comment first */select * from t1
1542 +-----------------------------------------------------
1543 +show status like "Qcache_queries_in_cache";
1544 +Variable_name Value
1545 +Qcache_queries_in_cache 1
1546 +show status like "Qcache_inserts";
1547 +Variable_name Value
1549 +show status like "Qcache_hits";
1550 +Variable_name Value
1552 +/* with comment first */select * from t1;
1557 +/* with comment first */select * from t1;
1562 +show status like "Qcache_queries_in_cache";
1563 +Variable_name Value
1564 +Qcache_queries_in_cache 1
1565 +show status like "Qcache_inserts";
1566 +Variable_name Value
1568 +show status like "Qcache_hits";
1569 +Variable_name Value
1571 +-----------------------------------------------------
1572 +# with comment first
1574 +-----------------------------------------------------
1575 +show status like "Qcache_queries_in_cache";
1576 +Variable_name Value
1577 +Qcache_queries_in_cache 1
1578 +show status like "Qcache_inserts";
1579 +Variable_name Value
1581 +show status like "Qcache_hits";
1582 +Variable_name Value
1584 +# with comment first
1590 +# with comment first
1596 +show status like "Qcache_queries_in_cache";
1597 +Variable_name Value
1598 +Qcache_queries_in_cache 2
1599 +show status like "Qcache_inserts";
1600 +Variable_name Value
1602 +show status like "Qcache_hits";
1603 +Variable_name Value
1605 +-----------------------------------------------------
1606 +-- with comment first
1608 +-----------------------------------------------------
1609 +show status like "Qcache_queries_in_cache";
1610 +Variable_name Value
1611 +Qcache_queries_in_cache 2
1612 +show status like "Qcache_inserts";
1613 +Variable_name Value
1615 +show status like "Qcache_hits";
1616 +Variable_name Value
1618 +-- with comment first
1624 +-- with comment first
1630 +show status like "Qcache_queries_in_cache";
1631 +Variable_name Value
1632 +Qcache_queries_in_cache 3
1633 +show status like "Qcache_inserts";
1634 +Variable_name Value
1636 +show status like "Qcache_hits";
1637 +Variable_name Value
1639 +-----------------------------------------------------
1640 +/* with comment first and "quote" */select * from t1
1641 +-----------------------------------------------------
1642 +show status like "Qcache_queries_in_cache";
1643 +Variable_name Value
1644 +Qcache_queries_in_cache 3
1645 +show status like "Qcache_inserts";
1646 +Variable_name Value
1648 +show status like "Qcache_hits";
1649 +Variable_name Value
1651 +/* with comment first and "quote" */select * from t1;
1656 +/* with comment first and "quote" */select * from t1;
1661 +show status like "Qcache_queries_in_cache";
1662 +Variable_name Value
1663 +Qcache_queries_in_cache 4
1664 +show status like "Qcache_inserts";
1665 +Variable_name Value
1667 +show status like "Qcache_hits";
1668 +Variable_name Value
1670 +-----------------------------------------------------
1671 +# with comment first and "quote"
1673 +-----------------------------------------------------
1674 +show status like "Qcache_queries_in_cache";
1675 +Variable_name Value
1676 +Qcache_queries_in_cache 4
1677 +show status like "Qcache_inserts";
1678 +Variable_name Value
1680 +show status like "Qcache_hits";
1681 +Variable_name Value
1683 +# with comment first and "quote"
1689 +# with comment first and "quote"
1695 +show status like "Qcache_queries_in_cache";
1696 +Variable_name Value
1697 +Qcache_queries_in_cache 5
1698 +show status like "Qcache_inserts";
1699 +Variable_name Value
1701 +show status like "Qcache_hits";
1702 +Variable_name Value
1704 +-----------------------------------------------------
1705 +-- with comment first and "quote"
1707 +-----------------------------------------------------
1708 +show status like "Qcache_queries_in_cache";
1709 +Variable_name Value
1710 +Qcache_queries_in_cache 5
1711 +show status like "Qcache_inserts";
1712 +Variable_name Value
1714 +show status like "Qcache_hits";
1715 +Variable_name Value
1717 +-- with comment first and "quote"
1723 +-- with comment first and "quote"
1729 +show status like "Qcache_queries_in_cache";
1730 +Variable_name Value
1731 +Qcache_queries_in_cache 6
1732 +show status like "Qcache_inserts";
1733 +Variable_name Value
1735 +show status like "Qcache_hits";
1736 +Variable_name Value
1738 +-----------------------------------------------------
1739 +/* with comment and whitespaces first */select * from t1
1740 +-----------------------------------------------------
1741 +show status like "Qcache_queries_in_cache";
1742 +Variable_name Value
1743 +Qcache_queries_in_cache 6
1744 +show status like "Qcache_inserts";
1745 +Variable_name Value
1747 +show status like "Qcache_hits";
1748 +Variable_name Value
1750 +/* with comment and whitespaces first */select * from t1;
1755 +/* with comment and whitespaces first */select * from t1;
1760 +show status like "Qcache_queries_in_cache";
1761 +Variable_name Value
1762 +Qcache_queries_in_cache 7
1763 +show status like "Qcache_inserts";
1764 +Variable_name Value
1766 +show status like "Qcache_hits";
1767 +Variable_name Value
1769 +-----------------------------------------------------
1770 +# with comment and whitespaces first
1772 +-----------------------------------------------------
1773 +show status like "Qcache_queries_in_cache";
1774 +Variable_name Value
1775 +Qcache_queries_in_cache 7
1776 +show status like "Qcache_inserts";
1777 +Variable_name Value
1779 +show status like "Qcache_hits";
1780 +Variable_name Value
1782 +# with comment and whitespaces first
1788 +# with comment and whitespaces first
1794 +show status like "Qcache_queries_in_cache";
1795 +Variable_name Value
1796 +Qcache_queries_in_cache 8
1797 +show status like "Qcache_inserts";
1798 +Variable_name Value
1800 +show status like "Qcache_hits";
1801 +Variable_name Value
1803 +-----------------------------------------------------
1804 +-- with comment and whitespaces first
1806 +-----------------------------------------------------
1807 +show status like "Qcache_queries_in_cache";
1808 +Variable_name Value
1809 +Qcache_queries_in_cache 8
1810 +show status like "Qcache_inserts";
1811 +Variable_name Value
1813 +show status like "Qcache_hits";
1814 +Variable_name Value
1816 +-- with comment and whitespaces first
1822 +-- with comment and whitespaces first
1828 +show status like "Qcache_queries_in_cache";
1829 +Variable_name Value
1830 +Qcache_queries_in_cache 9
1831 +show status like "Qcache_inserts";
1832 +Variable_name Value
1834 +show status like "Qcache_hits";
1835 +Variable_name Value
1837 +-----------------------------------------------------
1838 +select * /* internal comment */ from t1
1839 +-----------------------------------------------------
1840 +show status like "Qcache_queries_in_cache";
1841 +Variable_name Value
1842 +Qcache_queries_in_cache 9
1843 +show status like "Qcache_inserts";
1844 +Variable_name Value
1846 +show status like "Qcache_hits";
1847 +Variable_name Value
1849 +select * /* internal comment */ from t1;
1854 +select * /* internal comment */ from t1;
1859 +show status like "Qcache_queries_in_cache";
1860 +Variable_name Value
1861 +Qcache_queries_in_cache 10
1862 +show status like "Qcache_inserts";
1863 +Variable_name Value
1865 +show status like "Qcache_hits";
1866 +Variable_name Value
1868 +-----------------------------------------------------
1869 +select */* internal comment */ from t1
1870 +-----------------------------------------------------
1871 +show status like "Qcache_queries_in_cache";
1872 +Variable_name Value
1873 +Qcache_queries_in_cache 10
1874 +show status like "Qcache_inserts";
1875 +Variable_name Value
1877 +show status like "Qcache_hits";
1878 +Variable_name Value
1880 +select */* internal comment */ from t1;
1885 +select */* internal comment */ from t1;
1890 +show status like "Qcache_queries_in_cache";
1891 +Variable_name Value
1892 +Qcache_queries_in_cache 11
1893 +show status like "Qcache_inserts";
1894 +Variable_name Value
1896 +show status like "Qcache_hits";
1897 +Variable_name Value
1899 +-----------------------------------------------------
1900 +select */* internal comment */from t1
1901 +-----------------------------------------------------
1902 +show status like "Qcache_queries_in_cache";
1903 +Variable_name Value
1904 +Qcache_queries_in_cache 11
1905 +show status like "Qcache_inserts";
1906 +Variable_name Value
1908 +show status like "Qcache_hits";
1909 +Variable_name Value
1911 +select */* internal comment */from t1;
1916 +select */* internal comment */from t1;
1921 +show status like "Qcache_queries_in_cache";
1922 +Variable_name Value
1923 +Qcache_queries_in_cache 12
1924 +show status like "Qcache_inserts";
1925 +Variable_name Value
1927 +show status like "Qcache_hits";
1928 +Variable_name Value
1930 +-----------------------------------------------------
1931 +select * /* internal comment with "quote" */ from t1
1932 +-----------------------------------------------------
1933 +show status like "Qcache_queries_in_cache";
1934 +Variable_name Value
1935 +Qcache_queries_in_cache 12
1936 +show status like "Qcache_inserts";
1937 +Variable_name Value
1939 +show status like "Qcache_hits";
1940 +Variable_name Value
1942 +select * /* internal comment with "quote" */ from t1;
1947 +select * /* internal comment with "quote" */ from t1;
1952 +show status like "Qcache_queries_in_cache";
1953 +Variable_name Value
1954 +Qcache_queries_in_cache 13
1955 +show status like "Qcache_inserts";
1956 +Variable_name Value
1958 +show status like "Qcache_hits";
1959 +Variable_name Value
1961 +-----------------------------------------------------
1962 +select */* internal comment with "quote" */ from t1
1963 +-----------------------------------------------------
1964 +show status like "Qcache_queries_in_cache";
1965 +Variable_name Value
1966 +Qcache_queries_in_cache 13
1967 +show status like "Qcache_inserts";
1968 +Variable_name Value
1970 +show status like "Qcache_hits";
1971 +Variable_name Value
1973 +select */* internal comment with "quote" */ from t1;
1978 +select */* internal comment with "quote" */ from t1;
1983 +show status like "Qcache_queries_in_cache";
1984 +Variable_name Value
1985 +Qcache_queries_in_cache 14
1986 +show status like "Qcache_inserts";
1987 +Variable_name Value
1989 +show status like "Qcache_hits";
1990 +Variable_name Value
1992 +-----------------------------------------------------
1993 +select */* internal comment with "quote" */from t1
1994 +-----------------------------------------------------
1995 +show status like "Qcache_queries_in_cache";
1996 +Variable_name Value
1997 +Qcache_queries_in_cache 14
1998 +show status like "Qcache_inserts";
1999 +Variable_name Value
2001 +show status like "Qcache_hits";
2002 +Variable_name Value
2004 +select */* internal comment with "quote" */from t1;
2009 +select */* internal comment with "quote" */from t1;
2014 +show status like "Qcache_queries_in_cache";
2015 +Variable_name Value
2016 +Qcache_queries_in_cache 15
2017 +show status like "Qcache_inserts";
2018 +Variable_name Value
2020 +show status like "Qcache_hits";
2021 +Variable_name Value
2023 +-----------------------------------------------------
2026 +-----------------------------------------------------
2027 +show status like "Qcache_queries_in_cache";
2028 +Variable_name Value
2029 +Qcache_queries_in_cache 15
2030 +show status like "Qcache_inserts";
2031 +Variable_name Value
2033 +show status like "Qcache_hits";
2034 +Variable_name Value
2048 +show status like "Qcache_queries_in_cache";
2049 +Variable_name Value
2050 +Qcache_queries_in_cache 16
2051 +show status like "Qcache_inserts";
2052 +Variable_name Value
2054 +show status like "Qcache_hits";
2055 +Variable_name Value
2057 +-----------------------------------------------------
2059 +-----------------------------------------------------
2060 +show status like "Qcache_queries_in_cache";
2061 +Variable_name Value
2062 +Qcache_queries_in_cache 16
2063 +show status like "Qcache_inserts";
2064 +Variable_name Value
2066 +show status like "Qcache_hits";
2067 +Variable_name Value
2079 +show status like "Qcache_queries_in_cache";
2080 +Variable_name Value
2081 +Qcache_queries_in_cache 16
2082 +show status like "Qcache_inserts";
2083 +Variable_name Value
2085 +show status like "Qcache_hits";
2086 +Variable_name Value
2088 +-----------------------------------------------------
2090 +-----------------------------------------------------
2091 +show status like "Qcache_queries_in_cache";
2092 +Variable_name Value
2093 +Qcache_queries_in_cache 16
2094 +show status like "Qcache_inserts";
2095 +Variable_name Value
2097 +show status like "Qcache_hits";
2098 +Variable_name Value
2110 +show status like "Qcache_queries_in_cache";
2111 +Variable_name Value
2112 +Qcache_queries_in_cache 16
2113 +show status like "Qcache_inserts";
2114 +Variable_name Value
2116 +show status like "Qcache_hits";
2117 +Variable_name Value
2119 +-----------------------------------------------------
2121 +/* comment in the end */
2122 +-----------------------------------------------------
2123 +show status like "Qcache_queries_in_cache";
2124 +Variable_name Value
2125 +Qcache_queries_in_cache 16
2126 +show status like "Qcache_inserts";
2127 +Variable_name Value
2129 +show status like "Qcache_hits";
2130 +Variable_name Value
2133 +/* comment in the end */;
2139 +/* comment in the end */;
2144 +show status like "Qcache_queries_in_cache";
2145 +Variable_name Value
2146 +Qcache_queries_in_cache 17
2147 +show status like "Qcache_inserts";
2148 +Variable_name Value
2150 +show status like "Qcache_hits";
2151 +Variable_name Value
2153 +-----------------------------------------------------
2156 +-----------------------------------------------------
2157 +show status like "Qcache_queries_in_cache";
2158 +Variable_name Value
2159 +Qcache_queries_in_cache 17
2160 +show status like "Qcache_inserts";
2161 +Variable_name Value
2163 +show status like "Qcache_hits";
2164 +Variable_name Value
2178 +show status like "Qcache_queries_in_cache";
2179 +Variable_name Value
2180 +Qcache_queries_in_cache 18
2181 +show status like "Qcache_inserts";
2182 +Variable_name Value
2184 +show status like "Qcache_hits";
2185 +Variable_name Value
2187 +-----------------------------------------------------
2189 +/* comment in the end */
2191 +-----------------------------------------------------
2192 +show status like "Qcache_queries_in_cache";
2193 +Variable_name Value
2194 +Qcache_queries_in_cache 18
2195 +show status like "Qcache_inserts";
2196 +Variable_name Value
2198 +show status like "Qcache_hits";
2199 +Variable_name Value
2202 +/* comment in the end */
2209 +/* comment in the end */
2215 +show status like "Qcache_queries_in_cache";
2216 +Variable_name Value
2217 +Qcache_queries_in_cache 18
2218 +show status like "Qcache_inserts";
2219 +Variable_name Value
2221 +show status like "Qcache_hits";
2222 +Variable_name Value
2224 +-----------------------------------------------------
2225 +select * from t1 #comment in the end
2226 +-----------------------------------------------------
2227 +show status like "Qcache_queries_in_cache";
2228 +Variable_name Value
2229 +Qcache_queries_in_cache 18
2230 +show status like "Qcache_inserts";
2231 +Variable_name Value
2233 +show status like "Qcache_hits";
2234 +Variable_name Value
2236 +select * from t1 #comment in the end;
2241 +select * from t1 #comment in the end;
2246 +show status like "Qcache_queries_in_cache";
2247 +Variable_name Value
2248 +Qcache_queries_in_cache 19
2249 +show status like "Qcache_inserts";
2250 +Variable_name Value
2252 +show status like "Qcache_hits";
2253 +Variable_name Value
2255 +-----------------------------------------------------
2256 +select * from t1 #comment in the end
2258 +-----------------------------------------------------
2259 +show status like "Qcache_queries_in_cache";
2260 +Variable_name Value
2261 +Qcache_queries_in_cache 19
2262 +show status like "Qcache_inserts";
2263 +Variable_name Value
2265 +show status like "Qcache_hits";
2266 +Variable_name Value
2268 +select * from t1 #comment in the end
2274 +select * from t1 #comment in the end
2280 +show status like "Qcache_queries_in_cache";
2281 +Variable_name Value
2282 +Qcache_queries_in_cache 19
2283 +show status like "Qcache_inserts";
2284 +Variable_name Value
2286 +show status like "Qcache_hits";
2287 +Variable_name Value
2289 +-----------------------------------------------------
2290 +select * from t1 -- comment in the end
2291 +-----------------------------------------------------
2292 +show status like "Qcache_queries_in_cache";
2293 +Variable_name Value
2294 +Qcache_queries_in_cache 19
2295 +show status like "Qcache_inserts";
2296 +Variable_name Value
2298 +show status like "Qcache_hits";
2299 +Variable_name Value
2301 +select * from t1 -- comment in the end;
2306 +select * from t1 -- comment in the end;
2311 +show status like "Qcache_queries_in_cache";
2312 +Variable_name Value
2313 +Qcache_queries_in_cache 20
2314 +show status like "Qcache_inserts";
2315 +Variable_name Value
2317 +show status like "Qcache_hits";
2318 +Variable_name Value
2320 +-----------------------------------------------------
2321 +select * from t1 -- comment in the end
2323 +-----------------------------------------------------
2324 +show status like "Qcache_queries_in_cache";
2325 +Variable_name Value
2326 +Qcache_queries_in_cache 20
2327 +show status like "Qcache_inserts";
2328 +Variable_name Value
2330 +show status like "Qcache_hits";
2331 +Variable_name Value
2333 +select * from t1 -- comment in the end
2339 +select * from t1 -- comment in the end
2345 +show status like "Qcache_queries_in_cache";
2346 +Variable_name Value
2347 +Qcache_queries_in_cache 20
2348 +show status like "Qcache_inserts";
2349 +Variable_name Value
2351 +show status like "Qcache_hits";
2352 +Variable_name Value
2354 +-----------------------------------------------------
2355 +select ' \' ' from t1
2356 +-----------------------------------------------------
2357 +show status like "Qcache_queries_in_cache";
2358 +Variable_name Value
2359 +Qcache_queries_in_cache 20
2360 +show status like "Qcache_inserts";
2361 +Variable_name Value
2363 +show status like "Qcache_hits";
2364 +Variable_name Value
2366 +select ' \' ' from t1;
2371 +select ' \' ' from t1;
2376 +show status like "Qcache_queries_in_cache";
2377 +Variable_name Value
2378 +Qcache_queries_in_cache 21
2379 +show status like "Qcache_inserts";
2380 +Variable_name Value
2382 +show status like "Qcache_hits";
2383 +Variable_name Value
2386 +SET GLOBAL query_cache_size=default;
2387 +set global query_cache_strip_comments=OFF;
2389 +++ b/mysql-test/r/percona_query_cache_with_comments_prepared_statements.result
2391 +set GLOBAL query_cache_size=1355776;
2396 +drop table if exists t1;
2397 +create table t1 (a int not null);
2398 +insert into t1 values (1),(2),(3);
2399 +set global query_cache_strip_comments=ON;
2400 +show status like "Qcache_queries_in_cache";
2401 +Variable_name Value
2402 +Qcache_queries_in_cache 0
2403 +show status like "Qcache_inserts";
2404 +Variable_name Value
2406 +show status like "Qcache_hits";
2407 +Variable_name Value
2409 +prepare stmt from '/* with comment */ select * from t1';
2415 +show status like "Qcache_queries_in_cache";
2416 +Variable_name Value
2417 +Qcache_queries_in_cache 1
2418 +show status like "Qcache_inserts";
2419 +Variable_name Value
2421 +show status like "Qcache_hits";
2422 +Variable_name Value
2449 +show status like "Qcache_queries_in_cache";
2450 +Variable_name Value
2451 +Qcache_queries_in_cache 1
2452 +show status like "Qcache_inserts";
2453 +Variable_name Value
2455 +show status like "Qcache_hits";
2456 +Variable_name Value
2458 +prepare stmt from 'select * from t1';
2464 +show status like "Qcache_queries_in_cache";
2465 +Variable_name Value
2466 +Qcache_queries_in_cache 1
2467 +show status like "Qcache_inserts";
2468 +Variable_name Value
2470 +show status like "Qcache_hits";
2471 +Variable_name Value
2473 +prepare stmt from 'select * /*internal comment*/from t1';
2479 +show status like "Qcache_queries_in_cache";
2480 +Variable_name Value
2481 +Qcache_queries_in_cache 1
2482 +show status like "Qcache_inserts";
2483 +Variable_name Value
2485 +show status like "Qcache_hits";
2486 +Variable_name Value
2488 +prepare stmt from 'select * /*internal comment*/ from t1';
2494 +show status like "Qcache_queries_in_cache";
2495 +Variable_name Value
2496 +Qcache_queries_in_cache 1
2497 +show status like "Qcache_inserts";
2498 +Variable_name Value
2500 +show status like "Qcache_hits";
2501 +Variable_name Value
2503 +prepare stmt from 'select * from t1 /* at the end */';
2509 +show status like "Qcache_queries_in_cache";
2510 +Variable_name Value
2511 +Qcache_queries_in_cache 1
2512 +show status like "Qcache_inserts";
2513 +Variable_name Value
2515 +show status like "Qcache_hits";
2516 +Variable_name Value
2518 +prepare stmt from 'select * from t1 /* with "quote" */';
2524 +show status like "Qcache_queries_in_cache";
2525 +Variable_name Value
2526 +Qcache_queries_in_cache 1
2527 +show status like "Qcache_inserts";
2528 +Variable_name Value
2530 +show status like "Qcache_hits";
2531 +Variable_name Value
2533 +prepare stmt from 'select * from t1 /* with \'quote\' */';
2539 +show status like "Qcache_queries_in_cache";
2540 +Variable_name Value
2541 +Qcache_queries_in_cache 1
2542 +show status like "Qcache_inserts";
2543 +Variable_name Value
2545 +show status like "Qcache_hits";
2546 +Variable_name Value
2548 +prepare stmt from 'select * from t1 # 123
2555 +show status like "Qcache_queries_in_cache";
2556 +Variable_name Value
2557 +Qcache_queries_in_cache 1
2558 +show status like "Qcache_inserts";
2559 +Variable_name Value
2561 +show status like "Qcache_hits";
2562 +Variable_name Value
2564 +prepare stmt from 'select * from t1 # 123 with "quote"
2571 +show status like "Qcache_queries_in_cache";
2572 +Variable_name Value
2573 +Qcache_queries_in_cache 1
2574 +show status like "Qcache_inserts";
2575 +Variable_name Value
2577 +show status like "Qcache_hits";
2578 +Variable_name Value
2580 +prepare stmt from 'select * from t1 # 123 with \'quote\'
2587 +show status like "Qcache_queries_in_cache";
2588 +Variable_name Value
2589 +Qcache_queries_in_cache 1
2590 +show status like "Qcache_inserts";
2591 +Variable_name Value
2593 +show status like "Qcache_hits";
2594 +Variable_name Value
2596 +prepare stmt from 'select * from t1
2604 +show status like "Qcache_queries_in_cache";
2605 +Variable_name Value
2606 +Qcache_queries_in_cache 1
2607 +show status like "Qcache_inserts";
2608 +Variable_name Value
2610 +show status like "Qcache_hits";
2611 +Variable_name Value
2613 +prepare stmt from '#456
2622 +show status like "Qcache_queries_in_cache";
2623 +Variable_name Value
2624 +Qcache_queries_in_cache 1
2625 +show status like "Qcache_inserts";
2626 +Variable_name Value
2628 +show status like "Qcache_hits";
2629 +Variable_name Value
2631 +prepare stmt from 'select * from t1 -- 123
2638 +show status like "Qcache_queries_in_cache";
2639 +Variable_name Value
2640 +Qcache_queries_in_cache 1
2641 +show status like "Qcache_inserts";
2642 +Variable_name Value
2644 +show status like "Qcache_hits";
2645 +Variable_name Value
2647 +prepare stmt from 'select * from t1
2655 +show status like "Qcache_queries_in_cache";
2656 +Variable_name Value
2657 +Qcache_queries_in_cache 1
2658 +show status like "Qcache_inserts";
2659 +Variable_name Value
2661 +show status like "Qcache_hits";
2662 +Variable_name Value
2664 +prepare stmt from '-- comment in first
2673 +show status like "Qcache_queries_in_cache";
2674 +Variable_name Value
2675 +Qcache_queries_in_cache 1
2676 +show status like "Qcache_inserts";
2677 +Variable_name Value
2679 +show status like "Qcache_hits";
2680 +Variable_name Value
2682 +prepare stmt from '(#456(
2691 +show status like "Qcache_queries_in_cache";
2692 +Variable_name Value
2693 +Qcache_queries_in_cache 2
2694 +show status like "Qcache_inserts";
2695 +Variable_name Value
2697 +show status like "Qcache_hits";
2698 +Variable_name Value
2700 +prepare stmt from '/*test*/(-- comment in first(
2709 +show status like "Qcache_queries_in_cache";
2710 +Variable_name Value
2711 +Qcache_queries_in_cache 2
2712 +show status like "Qcache_inserts";
2713 +Variable_name Value
2715 +show status like "Qcache_hits";
2716 +Variable_name Value
2718 +prepare stmt from 'select "test",a from t1';
2729 +show status like "Qcache_queries_in_cache";
2730 +Variable_name Value
2731 +Qcache_queries_in_cache 3
2732 +show status like "Qcache_inserts";
2733 +Variable_name Value
2735 +show status like "Qcache_hits";
2736 +Variable_name Value
2738 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
2740 +test /* internal 'comment' */ a
2741 +test /* internal 'comment' */ 1
2742 +test /* internal 'comment' */ 2
2743 +test /* internal 'comment' */ 3
2744 +show status like "Qcache_queries_in_cache";
2745 +Variable_name Value
2746 +Qcache_queries_in_cache 4
2747 +show status like "Qcache_inserts";
2748 +Variable_name Value
2750 +show status like "Qcache_hits";
2751 +Variable_name Value
2753 +prepare stmt from 'select "test #internal comment" ,a from t1';
2755 +test #internal comment a
2756 +test #internal comment 1
2757 +test #internal comment 2
2758 +test #internal comment 3
2759 +show status like "Qcache_queries_in_cache";
2760 +Variable_name Value
2761 +Qcache_queries_in_cache 5
2762 +show status like "Qcache_inserts";
2763 +Variable_name Value
2765 +show status like "Qcache_hits";
2766 +Variable_name Value
2768 +prepare stmt from 'select "test #internal comment" #external comment
2771 +test #internal comment a
2772 +test #internal comment 1
2773 +test #internal comment 2
2774 +test #internal comment 3
2775 +show status like "Qcache_queries_in_cache";
2776 +Variable_name Value
2777 +Qcache_queries_in_cache 5
2778 +show status like "Qcache_inserts";
2779 +Variable_name Value
2781 +show status like "Qcache_hits";
2782 +Variable_name Value
2785 +SET GLOBAL query_cache_size= default;
2786 +set global query_cache_strip_comments=OFF;
2788 +++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
2790 +SET GLOBAL query_cache_size=1355776;
2795 +DROP TABLE IF EXISTS t;
2796 +CREATE TABLE t(id INT, number INT);
2797 +INSERT INTO t VALUES (0,1);
2798 +INSERT INTO t VALUES (1,2);
2799 +INSERT INTO t VALUES (2,3);
2800 +SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
2801 +SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
2802 +SELECT number from t where id > 0;
2804 +Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
2805 +### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
2806 +### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
2807 +SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
2809 +### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
2810 +### SELECT number from t where id > 0 Waiting on query cache mutex
2812 +SET GLOBAL query_cache_size=0;
2814 +++ b/mysql-test/t/percona_query_cache_with_comments.test
2816 +--disable_ps_protocol
2817 +set global query_cache_strip_comments=ON;
2818 +-- source include/percona_query_cache_with_comments_begin.inc
2819 +-- source include/percona_query_cache_with_comments.inc
2820 +-- source include/percona_query_cache_with_comments_end.inc
2822 +++ b/mysql-test/t/percona_query_cache_with_comments_crash.test
2824 +-- source include/have_query_cache.inc
2825 +set GLOBAL query_cache_size=1355776;
2827 +drop table if exists t1;
2829 +create table t1 (a int not null);
2830 +insert into t1 values (1),(2),(3);
2831 +flush query cache; # This crashed in some versions
2832 +flush query cache; # This crashed in some versions
2835 +( select * from t1 );
2836 +/*!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 */;
2837 +/* only comment */;
2838 +let query=# only comment
2841 +let query=-- only comment
2845 +SET GLOBAL query_cache_size= default;
2847 +++ b/mysql-test/t/percona_query_cache_with_comments_disable.test
2849 +-- source include/percona_query_cache_with_comments_begin.inc
2850 +-- source include/percona_query_cache_with_comments.inc
2851 +-- source include/percona_query_cache_with_comments_end.inc
2853 +++ b/mysql-test/t/percona_query_cache_with_comments_prepared_statements.test
2855 +-- source include/have_query_cache.inc
2857 +set GLOBAL query_cache_size=1355776;
2859 +# Reset query cache variables.
2860 +flush query cache; # This crashed in some versions
2861 +flush query cache; # This crashed in some versions
2865 +drop table if exists t1;
2869 +# First simple test
2872 +create table t1 (a int not null);
2873 +insert into t1 values (1),(2),(3);
2875 +set global query_cache_strip_comments=ON;
2877 +show status like "Qcache_queries_in_cache";
2878 +show status like "Qcache_inserts";
2879 +show status like "Qcache_hits";
2881 +prepare stmt from '/* with comment */ select * from t1';
2884 +show status like "Qcache_queries_in_cache";
2885 +show status like "Qcache_inserts";
2886 +show status like "Qcache_hits";
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';
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 * /*internal comment*/from t1';
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 * /*internal comment*/ from t1';
2915 +show status like "Qcache_queries_in_cache";
2916 +show status like "Qcache_inserts";
2917 +show status like "Qcache_hits";
2919 +prepare stmt from 'select * from t1 /* at the end */';
2922 +show status like "Qcache_queries_in_cache";
2923 +show status like "Qcache_inserts";
2924 +show status like "Qcache_hits";
2926 +prepare stmt from 'select * from t1 /* with "quote" */';
2929 +show status like "Qcache_queries_in_cache";
2930 +show status like "Qcache_inserts";
2931 +show status like "Qcache_hits";
2933 +prepare stmt from 'select * from t1 /* with \'quote\' */';
2936 +show status like "Qcache_queries_in_cache";
2937 +show status like "Qcache_inserts";
2938 +show status like "Qcache_hits";
2940 +prepare stmt from 'select * from t1 # 123
2944 +show status like "Qcache_queries_in_cache";
2945 +show status like "Qcache_inserts";
2946 +show status like "Qcache_hits";
2948 +prepare stmt from 'select * from t1 # 123 with "quote"
2952 +show status like "Qcache_queries_in_cache";
2953 +show status like "Qcache_inserts";
2954 +show status like "Qcache_hits";
2956 +prepare stmt from 'select * from t1 # 123 with \'quote\'
2960 +show status like "Qcache_queries_in_cache";
2961 +show status like "Qcache_inserts";
2962 +show status like "Qcache_hits";
2964 +prepare stmt from 'select * from t1
2969 +show status like "Qcache_queries_in_cache";
2970 +show status like "Qcache_inserts";
2971 +show status like "Qcache_hits";
2973 +prepare stmt from '#456
2979 +show status like "Qcache_queries_in_cache";
2980 +show status like "Qcache_inserts";
2981 +show status like "Qcache_hits";
2983 +prepare stmt from 'select * from t1 -- 123
2987 +show status like "Qcache_queries_in_cache";
2988 +show status like "Qcache_inserts";
2989 +show status like "Qcache_hits";
2991 +prepare stmt from 'select * from t1
2996 +show status like "Qcache_queries_in_cache";
2997 +show status like "Qcache_inserts";
2998 +show status like "Qcache_hits";
3000 +prepare stmt from '-- comment in first
3006 +show status like "Qcache_queries_in_cache";
3007 +show status like "Qcache_inserts";
3008 +show status like "Qcache_hits";
3010 +prepare stmt from '(#456(
3016 +show status like "Qcache_queries_in_cache";
3017 +show status like "Qcache_inserts";
3018 +show status like "Qcache_hits";
3020 +prepare stmt from '/*test*/(-- comment in first(
3026 +show status like "Qcache_queries_in_cache";
3027 +show status like "Qcache_inserts";
3028 +show status like "Qcache_hits";
3030 +prepare stmt from 'select "test",a from t1';
3034 +show status like "Qcache_queries_in_cache";
3035 +show status like "Qcache_inserts";
3036 +show status like "Qcache_hits";
3038 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
3041 +show status like "Qcache_queries_in_cache";
3042 +show status like "Qcache_inserts";
3043 +show status like "Qcache_hits";
3045 +prepare stmt from 'select "test #internal comment" ,a from t1';
3048 +show status like "Qcache_queries_in_cache";
3049 +show status like "Qcache_inserts";
3050 +show status like "Qcache_hits";
3052 +prepare stmt from 'select "test #internal comment" #external comment
3056 +show status like "Qcache_queries_in_cache";
3057 +show status like "Qcache_inserts";
3058 +show status like "Qcache_hits";
3061 +SET GLOBAL query_cache_size= default;
3062 +set global query_cache_strip_comments=OFF;
3064 +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
3066 +--source include/have_query_cache.inc
3067 +--source include/have_debug.inc
3068 +--source include/have_debug_sync.inc
3069 +SET GLOBAL query_cache_size=1355776;
3070 +--source include/percona_query_cache_with_comments_clear.inc
3072 +-- disable_warnings
3073 +DROP TABLE IF EXISTS t;
3075 +CREATE TABLE t(id INT, number INT);
3076 +INSERT INTO t VALUES (0,1);
3077 +INSERT INTO t VALUES (1,2);
3078 +INSERT INTO t VALUES (2,3);
3080 +--connect (conn,localhost,root,,)
3083 +SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
3084 +SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
3085 +SEND SELECT number from t where id > 0;
3087 +--connection default
3088 +--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
3091 +--replace_column 1 ###
3092 +SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
3096 +SET GLOBAL query_cache_size=0;