1 # name : query_cache_enhance.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;
46 --- a/sql/sql_cache.cc
47 +++ b/sql/sql_cache.cc
49 #include "probes_mysql.h"
50 #include "transaction.h"
53 +namespace query_comments_parser
59 + /* 'Empty' symbol - epsilon in classic parsers */
63 + * exclamation comment: slash-star-exclamation comment-body star-slash
64 + * single-line and multi-line comments
67 + /* Whitespaces: ' ' \t \r \n */
70 + 1) C-style comment (slash-star comment-body star-slash)
71 + 2) signle-line comment:
72 + * sharp comment (sharp comment-body new-line)
73 + * minus-minus comment (minus-minus comment-body new-line)
76 + /* Not a special symbols (this symbols can't be before SELECT ). */
78 + /* Error: not-closed quotes, not-closed C-style comment, end-of-query */
84 + Analyze kind of prefix of input string.
86 + @param where pointer to pointer to begin of string. After analyzing input
87 + string function skip analyzed prefix and return pointer to the next part
88 + of string in the @param where.
90 + @return kind of analyzed prefix.
92 +static Kind analyze(const char **where, const char *const end)
94 + DBUG_ASSERT(where != NULL);
95 + DBUG_ASSERT(*where != NULL);
96 + const char*&to= *where;
103 + /* current symbol */
115 + /* check for pair of quote */
116 + if (*to == current)
118 + /* skip second quote */
120 + /* check for same symbol after second quote */
121 + if (to < end && *to == current)
123 + /* same symbol, skip it */
125 + /* check for end-of-line */
128 + /* not found - not closed quote */
133 + /* continue search of pair */
142 + /* check for escaped symbols */
145 + /* backslash, skip it */
148 + /* check for end-of-line */
151 + /* not found - not closed quote */
154 + /* skip current symbol */
160 + /* Check for second minus */
169 + Prefix is minus-minus, next case-branch is processing
170 + single line comments.
175 + This is single-line comment, it started by "#" or "--".
179 + /* search new-line */
180 + to= strchr(to, '\n');
183 + /* not found, end of the comment is the end of the query */
188 + /* skip end-of-line */
195 + /* check for star */
200 + /* check for exclamation */
201 + bool exclamation= (*to == '!');
202 + /* search star-slash */
203 + to= strstr(to, "*/");
206 + /* not found - not closed comment */
212 + DBUG_ASSERT(to + 1 < end);
213 + DBUG_ASSERT(0 == strncmp(to, "*/", 2));
214 + /* skip star-slash */
217 + return (exclamation ? Special : Comment);
236 + /* skip backslash */
241 + query complete by backslash
248 + /* skip after backslash symbol */
256 + /* skip parenthese */
270 +static bool remove_comments_from_query(const char *const query,
271 + const size_t query_length,
272 + char *const result,
273 + size_t *result_length)
275 + /* pointer to begin of parsed block */
276 + const char *from= query;
277 + const char *to= query;
278 + /* pointer to end of the query */
279 + const char *const end= query + query_length;
280 + /* pointer to last space */
281 + const char *space= NULL;
282 + /* current position in result buffer */
283 + char *current= result;
287 + switch (analyze(&to, end))
293 + check for whitespace in the end
295 + if (current == space)
297 + /* drop whitespace in the end of query */
300 + /* result is null-terminated string */
302 + /* set result length */
303 + *result_length= current - result;
308 + /* should just insert space instead of comment */
310 + if (space == current || from == query)
312 + /* previous symbol was space */
316 + /* insert space to result buffer */
318 + /* switch after inserted space */
321 + /* remember last-after-space position */
328 + /* calculate parsed block size */
329 + size_t block_size= to - from;
330 + /* copy parsed block to result */
331 + memcpy(current, from, block_size);
332 + /* switch result after copied block */
333 + current+= block_size;
334 + /* switch after parsed block */
342 + /* bad source query */
350 +static size_t skip_not_another(const char *const query, size_t query_length)
352 + const char *from= query;
353 + const char *to= query;
354 + const char *const end= query + query_length;
357 + switch (analyze(&to, end))
363 + return (from - query);
372 +static size_t skip_default(const char *const query, size_t /* query_length */)
374 + size_t query_position= 0;
376 + Skip '(' characters in queries like following:
377 + (select a from t1) union (select a from t1);
379 + while (query[query_position]=='(')
381 + return query_position;
385 +} /* namespace query_comments_parser */
387 +class Query_Switcher
390 + Query_Switcher(const Query_Switcher&);
391 + Query_Switcher& operator=(const Query_Switcher&);
395 + Query_Switcher(THD *thd) :
396 + target_query(&(thd_query_string(thd)->str)),
397 + target_length(&(thd_query_string(thd)->length)),
398 + backup_query(thd->query()),
399 + backup_length(thd->query_length())
403 + Query_Switcher(char **query,
405 + target_query(query),
406 + target_length(length),
407 + backup_query(*query),
408 + backup_length(*length)
412 + void replace(Query_Without_Comments *query_without_comments)
414 + *target_query= query_without_comments->query();
415 + *target_length= query_without_comments->length();
419 + *target_query= backup_query;
420 + *target_length= backup_length;
423 + char* *target_query;
424 + size_t *target_length;
426 + char *const backup_query;
427 + size_t const backup_length;
430 +class Comments_Processor
433 + Comments_Processor(const Comments_Processor&);
434 + Comments_Processor& operator=(const Comments_Processor&);
438 + Comments_Processor(THD *thd) :
439 + query_switcher (thd),
440 + db_length (thd->db_length),
441 + query_without_comments(&(thd->query_without_comments)),
442 + enabled (opt_query_cache_strip_comments),
448 + Comments_Processor(Query_Without_Comments *current_query_without_comments,
451 + const size_t current_db_length) :
452 + query_switcher (query, length),
453 + db_length (current_db_length),
454 + query_without_comments(current_query_without_comments),
455 + enabled (opt_query_cache_strip_comments),
461 + ~Comments_Processor()
463 + restore_comments();
467 + size_t prefix_length()
469 + using query_comments_parser::skip_not_another;
470 + using query_comments_parser::skip_default;
473 + return skip_not_another(query_switcher.backup_query,
474 + query_switcher.backup_length);
478 + return skip_default(query_switcher.backup_query,
479 + query_switcher.backup_length);
484 + bool remove_comments()
486 + if (!enabled || restore)
490 + /* Allocate memory for query rewrite */
491 + if (!query_without_comments->allocate(query_switcher.backup_length,
496 + /* Remove comment from query */
497 + size_t result_length;
498 + using query_comments_parser::remove_comments_from_query;
499 + if (!(restore= remove_comments_from_query(query_switcher.backup_query,
500 + query_switcher.backup_length,
501 + query_without_comments->query(),
506 + query_without_comments->set_length(result_length);
507 + size_t db_length_from_query=
508 + *((size_t*)(query_switcher.backup_query +
509 + query_switcher.backup_length + 1));
510 + *((size_t*)(query_without_comments->query() +
511 + result_length + 1))= db_length_from_query;
512 + /* Replace original query by striped */
513 + query_switcher.replace(query_without_comments);
518 + void restore_comments()
520 + if (enabled && restore)
522 + /* Replace striped query by original */
523 + query_switcher.restore();
525 + /* Clean query_without_comments */
526 + query_without_comments->set_length(0);
528 + /* Mark as restored */
533 + Query_Switcher query_switcher;
535 + const size_t db_length;
537 + Query_Without_Comments *query_without_comments;
542 #ifdef EMBEDDED_LIBRARY
543 #include "emb_qcache.h"
546 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
547 DBUG_ENTER("Query_cache::try_lock");
549 + const char *old_proc_info= thd->proc_info;
550 + thd_proc_info(thd,"Waiting on query cache mutex");
551 + DEBUG_SYNC(thd, "before_query_cache_mutex");
552 mysql_mutex_lock(&structure_guard_mutex);
553 + DEBUG_SYNC(thd, "after_query_cache_mutex");
554 + thd->proc_info = old_proc_info;
557 if (m_cache_lock_status == Query_cache::UNLOCKED)
558 @@ -1274,6 +1769,8 @@
562 + Comments_Processor comments_processor(thd);
563 + comments_processor.remove_comments();
565 /* Key is query + database + flag */
567 @@ -1440,7 +1937,7 @@
571 -Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
572 +Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length_uint)
574 ulonglong engine_data;
575 Query_cache_query *query;
576 @@ -1452,6 +1949,11 @@
578 Query_cache_query_flags flags;
579 DBUG_ENTER("Query_cache::send_result_to_client");
580 + size_t query_length= query_length_uint;
581 + Comments_Processor comments_processor(&(thd->query_without_comments),
587 Testing 'query_cache_size' without a lock here is safe: the thing
588 @@ -1471,13 +1973,7 @@
594 - Skip '(' characters in queries like following:
595 - (select a from t1) union (select a from t1);
597 - while (sql[i]=='(')
599 + size_t i= comments_processor.prefix_length();
602 Test if the query is a SELECT
603 @@ -1487,10 +1983,11 @@
604 frequently appeared in real life, consequently we can
605 check all such queries, too.
607 - if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
608 - my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
609 - my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
611 + if (!((i + 2 < query_length) &&
612 + ((my_toupper(system_charset_info, sql[i]) == 'S' &&
613 + my_toupper(system_charset_info, sql[i + 1]) == 'E' &&
614 + my_toupper(system_charset_info, sql[i + 2]) == 'L') ||
617 DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
619 @@ -1543,6 +2040,7 @@
622 Query_cache_block *query_block;
623 + comments_processor.remove_comments();
625 tot_length= query_length + 1 + sizeof(size_t) +
626 thd->db_length + QUERY_CACHE_FLAGS_SIZE;
627 @@ -1611,6 +2109,7 @@
628 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
629 query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,
631 + comments_processor.restore_comments();
632 /* Quick abort on unlocked data */
633 if (query_block == 0 ||
634 query_block->query()->result() == 0 ||
635 --- a/sql/sql_class.h
636 +++ b/sql/sql_class.h
637 @@ -1485,6 +1485,74 @@
639 extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
642 +#ifdef HAVE_QUERY_CACHE
646 + @class Query_Without_Comments
647 + This class provides way for safety (re)allocation
648 + a memory for a query without comments.
650 +class Query_Without_Comments
654 + Denied copy and assigment for object of this class.
656 + Query_Without_Comments(const Query_Without_Comments&);
657 + Query_Without_Comments& operator=(const Query_Without_Comments&);
662 + Constructor is filling fields by zero (no allocation).
664 + Query_Without_Comments();
668 + Destructor clean allocated memory
670 + ~Query_Without_Comments();
675 + (Re)allocate memory for query. Query length after that is 0.
677 + bool allocate(size_t query_length, size_t db_length);
681 + Set result query length, when query
682 + without comments is copied to buffer.
684 + void set_length(size_t query_length);
695 + Result query length
707 +#endif /* HAVE_QUERY_CACHE */
711 For each client connection we create a separate thread with THD serving as
712 @@ -1542,6 +1610,7 @@
713 struct st_mysql_stmt *current_stmt;
715 #ifdef HAVE_QUERY_CACHE
716 + Query_Without_Comments query_without_comments;
717 Query_cache_tls query_cache_tls;
719 NET net; // client connection descriptor
720 --- a/sql/sys_vars.cc
721 +++ b/sql/sys_vars.cc
722 @@ -1815,6 +1815,11 @@
723 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
724 ON_UPDATE(fix_query_cache_size));
726 +static Sys_var_mybool Sys_query_cache_strip_comments(
727 + "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",
728 + GLOBAL_VAR(opt_query_cache_strip_comments), CMD_LINE(OPT_ARG),
731 static Sys_var_ulong Sys_query_cache_limit(
733 "Don't cache results that are bigger than this",
735 +++ b/mysql-test/include/percona_query_cache_with_comments.inc
737 +--source include/percona_query_cache_with_comments_clear.inc
738 +let $query=/* with comment first */select * from t1;
740 +--source include/percona_query_cache_with_comments_eval.inc
742 +let $query=# with comment first
744 +--source include/percona_query_cache_with_comments_eval.inc
746 +let $query=-- with comment first
748 +--source include/percona_query_cache_with_comments_eval.inc
750 +let $query=/* with comment first and "quote" */select * from t1;
751 +--source include/percona_query_cache_with_comments_eval.inc
753 +let $query=# with comment first and "quote"
755 +--source include/percona_query_cache_with_comments_eval.inc
757 +let $query=-- with comment first and "quote"
759 +--source include/percona_query_cache_with_comments_eval.inc
762 + /* with comment and whitespaces first */select * from t1;
763 +--source include/percona_query_cache_with_comments_eval.inc
766 + # with comment and whitespaces first
768 +--source include/percona_query_cache_with_comments_eval.inc
771 + -- with comment and whitespaces first
773 +--source include/percona_query_cache_with_comments_eval.inc
775 +let $internal=* internal comment *;
777 +let $query=select * /$internal/ from t1;
778 +--source include/percona_query_cache_with_comments_eval.inc
779 +let $query=select */$internal/ from t1;
780 +--source include/percona_query_cache_with_comments_eval.inc
781 +let $query=select */$internal/from t1;
782 +--source include/percona_query_cache_with_comments_eval.inc
784 +let $internal=* internal comment with "quote" *;
786 +let $query=select * /$internal/ from t1;
787 +--source include/percona_query_cache_with_comments_eval.inc
788 +let $query=select */$internal/ from t1;
789 +--source include/percona_query_cache_with_comments_eval.inc
790 +let $query=select */$internal/from t1;
791 +--source include/percona_query_cache_with_comments_eval.inc
793 +let $query=select * from t1
795 +--source include/percona_query_cache_with_comments_eval.inc
797 +let $query=select * from t1 ;
798 +--source include/percona_query_cache_with_comments_eval.inc
800 +let $query=select * from t1 ;
801 +--source include/percona_query_cache_with_comments_eval.inc
803 +let $query=select * from t1
804 +/* comment in the end */;
805 +--source include/percona_query_cache_with_comments_eval.inc
807 +let $query=select * from t1
809 +--source include/percona_query_cache_with_comments_eval.inc
811 +let $query=select * from t1
812 +/* comment in the end */
814 +--source include/percona_query_cache_with_comments_eval.inc
816 +let $query=select * from t1 #comment in the end;
817 +--source include/percona_query_cache_with_comments_eval.inc
819 +let $query=select * from t1 #comment in the end
821 +--source include/percona_query_cache_with_comments_eval.inc
823 +let $query=select * from t1 -- comment in the end;
824 +--source include/percona_query_cache_with_comments_eval.inc
826 +let $query=select * from t1 -- comment in the end
828 +--source include/percona_query_cache_with_comments_eval.inc
830 +let $query=select */* a comment \*/from t1;
831 +--source include/percona_query_cache_with_comments_eval.inc
833 +let $query=select *# a comment \\
835 +--source include/percona_query_cache_with_comments_eval.inc
837 +let $query=select *-- a comment \\
839 +--source include/percona_query_cache_with_comments_eval.inc
841 +let $query=select "\\\\"" /* not a comment */" from t1;
842 +--source include/percona_query_cache_with_comments_eval.inc
844 +let $query=select "\\\\"" /*! not a comment */" from t1;
845 +--source include/percona_query_cache_with_comments_eval.inc
847 +# following two queries related to bug #856404.
848 +# There are different queries, but opt_query_cache_strip_comments thinks that they are equal.
849 +let $query=select ' \' ' from t1;
850 +--source include/percona_query_cache_with_comments_eval.inc
852 +let $query=select ' \' /* comment inside quotes with internal backslash quote */' from t1;
853 +--source include/percona_query_cache_with_comments_eval.inc
855 +++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc
857 +-- source include/have_query_cache.inc
859 +set GLOBAL query_cache_size=1355776;
862 +drop table if exists t1;
865 +create table t1 (a int not null);
866 +insert into t1 values (1),(2),(3);
868 +--source include/percona_query_cache_with_comments_clear.inc
870 +++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc
872 +# Reset query cache variables.
873 +flush query cache; # This crashed in some versions
874 +flush query cache; # This crashed in some versions
878 +++ b/mysql-test/include/percona_query_cache_with_comments_end.inc
881 +SET GLOBAL query_cache_size=default;
882 +set global query_cache_strip_comments=OFF;
884 +++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc
886 +echo -----------------------------------------------------;
888 +echo -----------------------------------------------------;
889 +--source include/percona_query_cache_with_comments_show.inc
892 +--source include/percona_query_cache_with_comments_show.inc
894 +++ b/mysql-test/include/percona_query_cache_with_comments_show.inc
896 +let $show=show status like "Qcache_queries_in_cache";
898 +let $show=show status like "Qcache_inserts";
900 +let $show=show status like "Qcache_hits";
905 +++ b/mysql-test/r/percona_query_cache_with_comments.result
907 +set global query_cache_strip_comments=ON;
908 +set GLOBAL query_cache_size=1355776;
909 +drop table if exists t1;
910 +create table t1 (a int not null);
911 +insert into t1 values (1),(2),(3);
920 +/* with comment first */select * from t1;
925 +-----------------------------------------------------
926 +/* with comment first */select * from t1
927 +-----------------------------------------------------
928 +show status like "Qcache_queries_in_cache";
930 +Qcache_queries_in_cache 1
931 +show status like "Qcache_inserts";
934 +show status like "Qcache_hits";
937 +/* with comment first */select * from t1;
942 +/* with comment first */select * from t1;
947 +show status like "Qcache_queries_in_cache";
949 +Qcache_queries_in_cache 1
950 +show status like "Qcache_inserts";
953 +show status like "Qcache_hits";
956 +-----------------------------------------------------
957 +# with comment first
959 +-----------------------------------------------------
960 +show status like "Qcache_queries_in_cache";
962 +Qcache_queries_in_cache 1
963 +show status like "Qcache_inserts";
966 +show status like "Qcache_hits";
969 +# with comment first
975 +# with comment first
981 +show status like "Qcache_queries_in_cache";
983 +Qcache_queries_in_cache 1
984 +show status like "Qcache_inserts";
987 +show status like "Qcache_hits";
990 +-----------------------------------------------------
991 +-- with comment first
993 +-----------------------------------------------------
994 +show status like "Qcache_queries_in_cache";
996 +Qcache_queries_in_cache 1
997 +show status like "Qcache_inserts";
1000 +show status like "Qcache_hits";
1001 +Variable_name Value
1003 +-- with comment first
1009 +-- with comment first
1015 +show status like "Qcache_queries_in_cache";
1016 +Variable_name Value
1017 +Qcache_queries_in_cache 1
1018 +show status like "Qcache_inserts";
1019 +Variable_name Value
1021 +show status like "Qcache_hits";
1022 +Variable_name Value
1024 +-----------------------------------------------------
1025 +/* with comment first and "quote" */select * from t1
1026 +-----------------------------------------------------
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 +/* with comment first and "quote" */select * from t1;
1041 +/* with comment first and "quote" */select * from t1;
1046 +show status like "Qcache_queries_in_cache";
1047 +Variable_name Value
1048 +Qcache_queries_in_cache 1
1049 +show status like "Qcache_inserts";
1050 +Variable_name Value
1052 +show status like "Qcache_hits";
1053 +Variable_name Value
1055 +-----------------------------------------------------
1056 +# with comment first and "quote"
1058 +-----------------------------------------------------
1059 +show status like "Qcache_queries_in_cache";
1060 +Variable_name Value
1061 +Qcache_queries_in_cache 1
1062 +show status like "Qcache_inserts";
1063 +Variable_name Value
1065 +show status like "Qcache_hits";
1066 +Variable_name Value
1068 +# with comment first and "quote"
1074 +# with comment first and "quote"
1080 +show status like "Qcache_queries_in_cache";
1081 +Variable_name Value
1082 +Qcache_queries_in_cache 1
1083 +show status like "Qcache_inserts";
1084 +Variable_name Value
1086 +show status like "Qcache_hits";
1087 +Variable_name Value
1089 +-----------------------------------------------------
1090 +-- with comment first and "quote"
1092 +-----------------------------------------------------
1093 +show status like "Qcache_queries_in_cache";
1094 +Variable_name Value
1095 +Qcache_queries_in_cache 1
1096 +show status like "Qcache_inserts";
1097 +Variable_name Value
1099 +show status like "Qcache_hits";
1100 +Variable_name Value
1102 +-- with comment first and "quote"
1108 +-- with comment first and "quote"
1114 +show status like "Qcache_queries_in_cache";
1115 +Variable_name Value
1116 +Qcache_queries_in_cache 1
1117 +show status like "Qcache_inserts";
1118 +Variable_name Value
1120 +show status like "Qcache_hits";
1121 +Variable_name Value
1123 +-----------------------------------------------------
1124 +/* with comment and whitespaces first */select * from t1
1125 +-----------------------------------------------------
1126 +show status like "Qcache_queries_in_cache";
1127 +Variable_name Value
1128 +Qcache_queries_in_cache 1
1129 +show status like "Qcache_inserts";
1130 +Variable_name Value
1132 +show status like "Qcache_hits";
1133 +Variable_name Value
1135 +/* with comment and whitespaces first */select * from t1;
1140 +/* with comment and whitespaces first */select * from t1;
1145 +show status like "Qcache_queries_in_cache";
1146 +Variable_name Value
1147 +Qcache_queries_in_cache 1
1148 +show status like "Qcache_inserts";
1149 +Variable_name Value
1151 +show status like "Qcache_hits";
1152 +Variable_name Value
1154 +-----------------------------------------------------
1155 +# with comment and whitespaces first
1157 +-----------------------------------------------------
1158 +show status like "Qcache_queries_in_cache";
1159 +Variable_name Value
1160 +Qcache_queries_in_cache 1
1161 +show status like "Qcache_inserts";
1162 +Variable_name Value
1164 +show status like "Qcache_hits";
1165 +Variable_name Value
1167 +# with comment and whitespaces first
1173 +# with comment and whitespaces first
1179 +show status like "Qcache_queries_in_cache";
1180 +Variable_name Value
1181 +Qcache_queries_in_cache 1
1182 +show status like "Qcache_inserts";
1183 +Variable_name Value
1185 +show status like "Qcache_hits";
1186 +Variable_name Value
1188 +-----------------------------------------------------
1189 +-- with comment and whitespaces first
1191 +-----------------------------------------------------
1192 +show status like "Qcache_queries_in_cache";
1193 +Variable_name Value
1194 +Qcache_queries_in_cache 1
1195 +show status like "Qcache_inserts";
1196 +Variable_name Value
1198 +show status like "Qcache_hits";
1199 +Variable_name Value
1201 +-- with comment and whitespaces first
1207 +-- with comment and whitespaces first
1213 +show status like "Qcache_queries_in_cache";
1214 +Variable_name Value
1215 +Qcache_queries_in_cache 1
1216 +show status like "Qcache_inserts";
1217 +Variable_name Value
1219 +show status like "Qcache_hits";
1220 +Variable_name Value
1222 +-----------------------------------------------------
1223 +select * /* internal comment */ from t1
1224 +-----------------------------------------------------
1225 +show status like "Qcache_queries_in_cache";
1226 +Variable_name Value
1227 +Qcache_queries_in_cache 1
1228 +show status like "Qcache_inserts";
1229 +Variable_name Value
1231 +show status like "Qcache_hits";
1232 +Variable_name Value
1234 +select * /* internal comment */ from t1;
1239 +select * /* internal comment */ from t1;
1244 +show status like "Qcache_queries_in_cache";
1245 +Variable_name Value
1246 +Qcache_queries_in_cache 1
1247 +show status like "Qcache_inserts";
1248 +Variable_name Value
1250 +show status like "Qcache_hits";
1251 +Variable_name Value
1253 +-----------------------------------------------------
1254 +select */* internal comment */ from t1
1255 +-----------------------------------------------------
1256 +show status like "Qcache_queries_in_cache";
1257 +Variable_name Value
1258 +Qcache_queries_in_cache 1
1259 +show status like "Qcache_inserts";
1260 +Variable_name Value
1262 +show status like "Qcache_hits";
1263 +Variable_name Value
1265 +select */* internal comment */ from t1;
1270 +select */* internal comment */ from t1;
1275 +show status like "Qcache_queries_in_cache";
1276 +Variable_name Value
1277 +Qcache_queries_in_cache 1
1278 +show status like "Qcache_inserts";
1279 +Variable_name Value
1281 +show status like "Qcache_hits";
1282 +Variable_name Value
1284 +-----------------------------------------------------
1285 +select */* internal comment */from t1
1286 +-----------------------------------------------------
1287 +show status like "Qcache_queries_in_cache";
1288 +Variable_name Value
1289 +Qcache_queries_in_cache 1
1290 +show status like "Qcache_inserts";
1291 +Variable_name Value
1293 +show status like "Qcache_hits";
1294 +Variable_name Value
1296 +select */* internal comment */from t1;
1301 +select */* internal comment */from t1;
1306 +show status like "Qcache_queries_in_cache";
1307 +Variable_name Value
1308 +Qcache_queries_in_cache 1
1309 +show status like "Qcache_inserts";
1310 +Variable_name Value
1312 +show status like "Qcache_hits";
1313 +Variable_name Value
1315 +-----------------------------------------------------
1316 +select * /* internal comment with "quote" */ from t1
1317 +-----------------------------------------------------
1318 +show status like "Qcache_queries_in_cache";
1319 +Variable_name Value
1320 +Qcache_queries_in_cache 1
1321 +show status like "Qcache_inserts";
1322 +Variable_name Value
1324 +show status like "Qcache_hits";
1325 +Variable_name Value
1327 +select * /* internal comment with "quote" */ from t1;
1332 +select * /* internal comment with "quote" */ from t1;
1337 +show status like "Qcache_queries_in_cache";
1338 +Variable_name Value
1339 +Qcache_queries_in_cache 1
1340 +show status like "Qcache_inserts";
1341 +Variable_name Value
1343 +show status like "Qcache_hits";
1344 +Variable_name Value
1346 +-----------------------------------------------------
1347 +select */* internal comment with "quote" */ from t1
1348 +-----------------------------------------------------
1349 +show status like "Qcache_queries_in_cache";
1350 +Variable_name Value
1351 +Qcache_queries_in_cache 1
1352 +show status like "Qcache_inserts";
1353 +Variable_name Value
1355 +show status like "Qcache_hits";
1356 +Variable_name Value
1358 +select */* internal comment with "quote" */ from t1;
1363 +select */* internal comment with "quote" */ from t1;
1368 +show status like "Qcache_queries_in_cache";
1369 +Variable_name Value
1370 +Qcache_queries_in_cache 1
1371 +show status like "Qcache_inserts";
1372 +Variable_name Value
1374 +show status like "Qcache_hits";
1375 +Variable_name Value
1377 +-----------------------------------------------------
1378 +select */* internal comment with "quote" */from t1
1379 +-----------------------------------------------------
1380 +show status like "Qcache_queries_in_cache";
1381 +Variable_name Value
1382 +Qcache_queries_in_cache 1
1383 +show status like "Qcache_inserts";
1384 +Variable_name Value
1386 +show status like "Qcache_hits";
1387 +Variable_name Value
1389 +select */* internal comment with "quote" */from t1;
1394 +select */* internal comment with "quote" */from t1;
1399 +show status like "Qcache_queries_in_cache";
1400 +Variable_name Value
1401 +Qcache_queries_in_cache 1
1402 +show status like "Qcache_inserts";
1403 +Variable_name Value
1405 +show status like "Qcache_hits";
1406 +Variable_name Value
1408 +-----------------------------------------------------
1411 +-----------------------------------------------------
1412 +show status like "Qcache_queries_in_cache";
1413 +Variable_name Value
1414 +Qcache_queries_in_cache 1
1415 +show status like "Qcache_inserts";
1416 +Variable_name Value
1418 +show status like "Qcache_hits";
1419 +Variable_name Value
1433 +show status like "Qcache_queries_in_cache";
1434 +Variable_name Value
1435 +Qcache_queries_in_cache 1
1436 +show status like "Qcache_inserts";
1437 +Variable_name Value
1439 +show status like "Qcache_hits";
1440 +Variable_name Value
1442 +-----------------------------------------------------
1444 +-----------------------------------------------------
1445 +show status like "Qcache_queries_in_cache";
1446 +Variable_name Value
1447 +Qcache_queries_in_cache 1
1448 +show status like "Qcache_inserts";
1449 +Variable_name Value
1451 +show status like "Qcache_hits";
1452 +Variable_name Value
1464 +show status like "Qcache_queries_in_cache";
1465 +Variable_name Value
1466 +Qcache_queries_in_cache 1
1467 +show status like "Qcache_inserts";
1468 +Variable_name Value
1470 +show status like "Qcache_hits";
1471 +Variable_name Value
1473 +-----------------------------------------------------
1475 +-----------------------------------------------------
1476 +show status like "Qcache_queries_in_cache";
1477 +Variable_name Value
1478 +Qcache_queries_in_cache 1
1479 +show status like "Qcache_inserts";
1480 +Variable_name Value
1482 +show status like "Qcache_hits";
1483 +Variable_name Value
1495 +show status like "Qcache_queries_in_cache";
1496 +Variable_name Value
1497 +Qcache_queries_in_cache 1
1498 +show status like "Qcache_inserts";
1499 +Variable_name Value
1501 +show status like "Qcache_hits";
1502 +Variable_name Value
1504 +-----------------------------------------------------
1506 +/* comment in the end */
1507 +-----------------------------------------------------
1508 +show status like "Qcache_queries_in_cache";
1509 +Variable_name Value
1510 +Qcache_queries_in_cache 1
1511 +show status like "Qcache_inserts";
1512 +Variable_name Value
1514 +show status like "Qcache_hits";
1515 +Variable_name Value
1518 +/* comment in the end */;
1524 +/* comment in the end */;
1529 +show status like "Qcache_queries_in_cache";
1530 +Variable_name Value
1531 +Qcache_queries_in_cache 1
1532 +show status like "Qcache_inserts";
1533 +Variable_name Value
1535 +show status like "Qcache_hits";
1536 +Variable_name Value
1538 +-----------------------------------------------------
1541 +-----------------------------------------------------
1542 +show status like "Qcache_queries_in_cache";
1543 +Variable_name Value
1544 +Qcache_queries_in_cache 1
1545 +show status like "Qcache_inserts";
1546 +Variable_name Value
1548 +show status like "Qcache_hits";
1549 +Variable_name Value
1563 +show status like "Qcache_queries_in_cache";
1564 +Variable_name Value
1565 +Qcache_queries_in_cache 1
1566 +show status like "Qcache_inserts";
1567 +Variable_name Value
1569 +show status like "Qcache_hits";
1570 +Variable_name Value
1572 +-----------------------------------------------------
1574 +/* comment in the end */
1576 +-----------------------------------------------------
1577 +show status like "Qcache_queries_in_cache";
1578 +Variable_name Value
1579 +Qcache_queries_in_cache 1
1580 +show status like "Qcache_inserts";
1581 +Variable_name Value
1583 +show status like "Qcache_hits";
1584 +Variable_name Value
1587 +/* comment in the end */
1594 +/* comment in the end */
1600 +show status like "Qcache_queries_in_cache";
1601 +Variable_name Value
1602 +Qcache_queries_in_cache 1
1603 +show status like "Qcache_inserts";
1604 +Variable_name Value
1606 +show status like "Qcache_hits";
1607 +Variable_name Value
1609 +-----------------------------------------------------
1610 +select * from t1 #comment in the end
1611 +-----------------------------------------------------
1612 +show status like "Qcache_queries_in_cache";
1613 +Variable_name Value
1614 +Qcache_queries_in_cache 1
1615 +show status like "Qcache_inserts";
1616 +Variable_name Value
1618 +show status like "Qcache_hits";
1619 +Variable_name Value
1621 +select * from t1 #comment in the end;
1626 +select * from t1 #comment in the end;
1631 +show status like "Qcache_queries_in_cache";
1632 +Variable_name Value
1633 +Qcache_queries_in_cache 1
1634 +show status like "Qcache_inserts";
1635 +Variable_name Value
1637 +show status like "Qcache_hits";
1638 +Variable_name Value
1640 +-----------------------------------------------------
1641 +select * from t1 #comment in the end
1643 +-----------------------------------------------------
1644 +show status like "Qcache_queries_in_cache";
1645 +Variable_name Value
1646 +Qcache_queries_in_cache 1
1647 +show status like "Qcache_inserts";
1648 +Variable_name Value
1650 +show status like "Qcache_hits";
1651 +Variable_name Value
1653 +select * from t1 #comment in the end
1659 +select * from t1 #comment in the end
1665 +show status like "Qcache_queries_in_cache";
1666 +Variable_name Value
1667 +Qcache_queries_in_cache 1
1668 +show status like "Qcache_inserts";
1669 +Variable_name Value
1671 +show status like "Qcache_hits";
1672 +Variable_name Value
1674 +-----------------------------------------------------
1675 +select * from t1 -- comment in the end
1676 +-----------------------------------------------------
1677 +show status like "Qcache_queries_in_cache";
1678 +Variable_name Value
1679 +Qcache_queries_in_cache 1
1680 +show status like "Qcache_inserts";
1681 +Variable_name Value
1683 +show status like "Qcache_hits";
1684 +Variable_name Value
1686 +select * from t1 -- comment in the end;
1691 +select * from t1 -- comment in the end;
1696 +show status like "Qcache_queries_in_cache";
1697 +Variable_name Value
1698 +Qcache_queries_in_cache 1
1699 +show status like "Qcache_inserts";
1700 +Variable_name Value
1702 +show status like "Qcache_hits";
1703 +Variable_name Value
1705 +-----------------------------------------------------
1706 +select * from t1 -- comment in the end
1708 +-----------------------------------------------------
1709 +show status like "Qcache_queries_in_cache";
1710 +Variable_name Value
1711 +Qcache_queries_in_cache 1
1712 +show status like "Qcache_inserts";
1713 +Variable_name Value
1715 +show status like "Qcache_hits";
1716 +Variable_name Value
1718 +select * from t1 -- comment in the end
1724 +select * from t1 -- comment in the end
1730 +show status like "Qcache_queries_in_cache";
1731 +Variable_name Value
1732 +Qcache_queries_in_cache 1
1733 +show status like "Qcache_inserts";
1734 +Variable_name Value
1736 +show status like "Qcache_hits";
1737 +Variable_name Value
1739 +-----------------------------------------------------
1740 +select */* a comment \*/from t1
1741 +-----------------------------------------------------
1742 +show status like "Qcache_queries_in_cache";
1743 +Variable_name Value
1744 +Qcache_queries_in_cache 1
1745 +show status like "Qcache_inserts";
1746 +Variable_name Value
1748 +show status like "Qcache_hits";
1749 +Variable_name Value
1751 +select */* a comment \*/from t1;
1756 +select */* a comment \*/from t1;
1761 +show status like "Qcache_queries_in_cache";
1762 +Variable_name Value
1763 +Qcache_queries_in_cache 1
1764 +show status like "Qcache_inserts";
1765 +Variable_name Value
1767 +show status like "Qcache_hits";
1768 +Variable_name Value
1770 +-----------------------------------------------------
1771 +select *# a comment \
1773 +-----------------------------------------------------
1774 +show status like "Qcache_queries_in_cache";
1775 +Variable_name Value
1776 +Qcache_queries_in_cache 1
1777 +show status like "Qcache_inserts";
1778 +Variable_name Value
1780 +show status like "Qcache_hits";
1781 +Variable_name Value
1783 +select *# a comment \
1789 +select *# a comment \
1795 +show status like "Qcache_queries_in_cache";
1796 +Variable_name Value
1797 +Qcache_queries_in_cache 1
1798 +show status like "Qcache_inserts";
1799 +Variable_name Value
1801 +show status like "Qcache_hits";
1802 +Variable_name Value
1804 +-----------------------------------------------------
1805 +select *-- a comment \
1807 +-----------------------------------------------------
1808 +show status like "Qcache_queries_in_cache";
1809 +Variable_name Value
1810 +Qcache_queries_in_cache 1
1811 +show status like "Qcache_inserts";
1812 +Variable_name Value
1814 +show status like "Qcache_hits";
1815 +Variable_name Value
1817 +select *-- a comment \
1823 +select *-- a comment \
1829 +show status like "Qcache_queries_in_cache";
1830 +Variable_name Value
1831 +Qcache_queries_in_cache 1
1832 +show status like "Qcache_inserts";
1833 +Variable_name Value
1835 +show status like "Qcache_hits";
1836 +Variable_name Value
1838 +-----------------------------------------------------
1839 +select "\\"" /* not a comment */" from t1
1840 +-----------------------------------------------------
1841 +show status like "Qcache_queries_in_cache";
1842 +Variable_name Value
1843 +Qcache_queries_in_cache 1
1844 +show status like "Qcache_inserts";
1845 +Variable_name Value
1847 +show status like "Qcache_hits";
1848 +Variable_name Value
1850 +select "\\"" /* not a comment */" from t1;
1851 +\" /* not a comment */
1852 +\" /* not a comment */
1853 +\" /* not a comment */
1854 +\" /* not a comment */
1855 +select "\\"" /* not a comment */" from t1;
1856 +\" /* not a comment */
1857 +\" /* not a comment */
1858 +\" /* not a comment */
1859 +\" /* not a comment */
1860 +show status like "Qcache_queries_in_cache";
1861 +Variable_name Value
1862 +Qcache_queries_in_cache 2
1863 +show status like "Qcache_inserts";
1864 +Variable_name Value
1866 +show status like "Qcache_hits";
1867 +Variable_name Value
1869 +-----------------------------------------------------
1870 +select "\\"" /*! not a comment */" from t1
1871 +-----------------------------------------------------
1872 +show status like "Qcache_queries_in_cache";
1873 +Variable_name Value
1874 +Qcache_queries_in_cache 2
1875 +show status like "Qcache_inserts";
1876 +Variable_name Value
1878 +show status like "Qcache_hits";
1879 +Variable_name Value
1881 +select "\\"" /*! not a comment */" from t1;
1882 +\" /*! not a comment */
1883 +\" /*! not a comment */
1884 +\" /*! not a comment */
1885 +\" /*! not a comment */
1886 +select "\\"" /*! not a comment */" from t1;
1887 +\" /*! not a comment */
1888 +\" /*! not a comment */
1889 +\" /*! not a comment */
1890 +\" /*! not a comment */
1891 +show status like "Qcache_queries_in_cache";
1892 +Variable_name Value
1893 +Qcache_queries_in_cache 3
1894 +show status like "Qcache_inserts";
1895 +Variable_name Value
1897 +show status like "Qcache_hits";
1898 +Variable_name Value
1900 +-----------------------------------------------------
1901 +select ' \' ' from t1
1902 +-----------------------------------------------------
1903 +show status like "Qcache_queries_in_cache";
1904 +Variable_name Value
1905 +Qcache_queries_in_cache 3
1906 +show status like "Qcache_inserts";
1907 +Variable_name Value
1909 +show status like "Qcache_hits";
1910 +Variable_name Value
1912 +select ' \' ' from t1;
1917 +select ' \' ' from t1;
1922 +show status like "Qcache_queries_in_cache";
1923 +Variable_name Value
1924 +Qcache_queries_in_cache 4
1925 +show status like "Qcache_inserts";
1926 +Variable_name Value
1928 +show status like "Qcache_hits";
1929 +Variable_name Value
1931 +-----------------------------------------------------
1932 +select ' \' /* comment inside quotes with internal backslash quote */' from t1
1933 +-----------------------------------------------------
1934 +show status like "Qcache_queries_in_cache";
1935 +Variable_name Value
1936 +Qcache_queries_in_cache 4
1937 +show status like "Qcache_inserts";
1938 +Variable_name Value
1940 +show status like "Qcache_hits";
1941 +Variable_name Value
1943 +select ' \' /* comment inside quotes with internal backslash quote */' from t1;
1944 +' /* comment inside quotes with internal backslash quote */
1945 + ' /* comment inside quotes with internal backslash quote */
1946 + ' /* comment inside quotes with internal backslash quote */
1947 + ' /* comment inside quotes with internal backslash quote */
1948 +select ' \' /* comment inside quotes with internal backslash quote */' from t1;
1949 +' /* comment inside quotes with internal backslash quote */
1950 + ' /* comment inside quotes with internal backslash quote */
1951 + ' /* comment inside quotes with internal backslash quote */
1952 + ' /* comment inside quotes with internal backslash quote */
1953 +show status like "Qcache_queries_in_cache";
1954 +Variable_name Value
1955 +Qcache_queries_in_cache 5
1956 +show status like "Qcache_inserts";
1957 +Variable_name Value
1959 +show status like "Qcache_hits";
1960 +Variable_name Value
1963 +SET GLOBAL query_cache_size=default;
1964 +set global query_cache_strip_comments=OFF;
1966 +++ b/mysql-test/r/percona_query_cache_with_comments_crash.result
1968 +set GLOBAL query_cache_size=1355776;
1969 +drop table if exists t1;
1970 +create table t1 (a int not null);
1971 +insert into t1 values (1),(2),(3);
1976 +( select * from t1 );
1981 +/*!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 */;
1982 +/* only comment */;
1988 +SET GLOBAL query_cache_size= default;
1990 +++ b/mysql-test/r/percona_query_cache_with_comments_disable.result
1992 +set GLOBAL query_cache_size=1355776;
1993 +drop table if exists t1;
1994 +create table t1 (a int not null);
1995 +insert into t1 values (1),(2),(3);
2004 +/* with comment first */select * from t1;
2009 +-----------------------------------------------------
2010 +/* with comment first */select * from t1
2011 +-----------------------------------------------------
2012 +show status like "Qcache_queries_in_cache";
2013 +Variable_name Value
2014 +Qcache_queries_in_cache 1
2015 +show status like "Qcache_inserts";
2016 +Variable_name Value
2018 +show status like "Qcache_hits";
2019 +Variable_name Value
2021 +/* with comment first */select * from t1;
2026 +/* with comment first */select * from t1;
2031 +show status like "Qcache_queries_in_cache";
2032 +Variable_name Value
2033 +Qcache_queries_in_cache 1
2034 +show status like "Qcache_inserts";
2035 +Variable_name Value
2037 +show status like "Qcache_hits";
2038 +Variable_name Value
2040 +-----------------------------------------------------
2041 +# with comment first
2043 +-----------------------------------------------------
2044 +show status like "Qcache_queries_in_cache";
2045 +Variable_name Value
2046 +Qcache_queries_in_cache 1
2047 +show status like "Qcache_inserts";
2048 +Variable_name Value
2050 +show status like "Qcache_hits";
2051 +Variable_name Value
2053 +# with comment first
2059 +# with comment first
2065 +show status like "Qcache_queries_in_cache";
2066 +Variable_name Value
2067 +Qcache_queries_in_cache 2
2068 +show status like "Qcache_inserts";
2069 +Variable_name Value
2071 +show status like "Qcache_hits";
2072 +Variable_name Value
2074 +-----------------------------------------------------
2075 +-- with comment first
2077 +-----------------------------------------------------
2078 +show status like "Qcache_queries_in_cache";
2079 +Variable_name Value
2080 +Qcache_queries_in_cache 2
2081 +show status like "Qcache_inserts";
2082 +Variable_name Value
2084 +show status like "Qcache_hits";
2085 +Variable_name Value
2087 +-- with comment first
2093 +-- with comment first
2099 +show status like "Qcache_queries_in_cache";
2100 +Variable_name Value
2101 +Qcache_queries_in_cache 3
2102 +show status like "Qcache_inserts";
2103 +Variable_name Value
2105 +show status like "Qcache_hits";
2106 +Variable_name Value
2108 +-----------------------------------------------------
2109 +/* with comment first and "quote" */select * from t1
2110 +-----------------------------------------------------
2111 +show status like "Qcache_queries_in_cache";
2112 +Variable_name Value
2113 +Qcache_queries_in_cache 3
2114 +show status like "Qcache_inserts";
2115 +Variable_name Value
2117 +show status like "Qcache_hits";
2118 +Variable_name Value
2120 +/* with comment first and "quote" */select * from t1;
2125 +/* with comment first and "quote" */select * from t1;
2130 +show status like "Qcache_queries_in_cache";
2131 +Variable_name Value
2132 +Qcache_queries_in_cache 4
2133 +show status like "Qcache_inserts";
2134 +Variable_name Value
2136 +show status like "Qcache_hits";
2137 +Variable_name Value
2139 +-----------------------------------------------------
2140 +# with comment first and "quote"
2142 +-----------------------------------------------------
2143 +show status like "Qcache_queries_in_cache";
2144 +Variable_name Value
2145 +Qcache_queries_in_cache 4
2146 +show status like "Qcache_inserts";
2147 +Variable_name Value
2149 +show status like "Qcache_hits";
2150 +Variable_name Value
2152 +# with comment first and "quote"
2158 +# with comment first and "quote"
2164 +show status like "Qcache_queries_in_cache";
2165 +Variable_name Value
2166 +Qcache_queries_in_cache 5
2167 +show status like "Qcache_inserts";
2168 +Variable_name Value
2170 +show status like "Qcache_hits";
2171 +Variable_name Value
2173 +-----------------------------------------------------
2174 +-- with comment first and "quote"
2176 +-----------------------------------------------------
2177 +show status like "Qcache_queries_in_cache";
2178 +Variable_name Value
2179 +Qcache_queries_in_cache 5
2180 +show status like "Qcache_inserts";
2181 +Variable_name Value
2183 +show status like "Qcache_hits";
2184 +Variable_name Value
2186 +-- with comment first and "quote"
2192 +-- with comment first and "quote"
2198 +show status like "Qcache_queries_in_cache";
2199 +Variable_name Value
2200 +Qcache_queries_in_cache 6
2201 +show status like "Qcache_inserts";
2202 +Variable_name Value
2204 +show status like "Qcache_hits";
2205 +Variable_name Value
2207 +-----------------------------------------------------
2208 +/* with comment and whitespaces first */select * from t1
2209 +-----------------------------------------------------
2210 +show status like "Qcache_queries_in_cache";
2211 +Variable_name Value
2212 +Qcache_queries_in_cache 6
2213 +show status like "Qcache_inserts";
2214 +Variable_name Value
2216 +show status like "Qcache_hits";
2217 +Variable_name Value
2219 +/* with comment and whitespaces first */select * from t1;
2224 +/* with comment and whitespaces first */select * from t1;
2229 +show status like "Qcache_queries_in_cache";
2230 +Variable_name Value
2231 +Qcache_queries_in_cache 7
2232 +show status like "Qcache_inserts";
2233 +Variable_name Value
2235 +show status like "Qcache_hits";
2236 +Variable_name Value
2238 +-----------------------------------------------------
2239 +# with comment and whitespaces first
2241 +-----------------------------------------------------
2242 +show status like "Qcache_queries_in_cache";
2243 +Variable_name Value
2244 +Qcache_queries_in_cache 7
2245 +show status like "Qcache_inserts";
2246 +Variable_name Value
2248 +show status like "Qcache_hits";
2249 +Variable_name Value
2251 +# with comment and whitespaces first
2257 +# with comment and whitespaces first
2263 +show status like "Qcache_queries_in_cache";
2264 +Variable_name Value
2265 +Qcache_queries_in_cache 8
2266 +show status like "Qcache_inserts";
2267 +Variable_name Value
2269 +show status like "Qcache_hits";
2270 +Variable_name Value
2272 +-----------------------------------------------------
2273 +-- with comment and whitespaces first
2275 +-----------------------------------------------------
2276 +show status like "Qcache_queries_in_cache";
2277 +Variable_name Value
2278 +Qcache_queries_in_cache 8
2279 +show status like "Qcache_inserts";
2280 +Variable_name Value
2282 +show status like "Qcache_hits";
2283 +Variable_name Value
2285 +-- with comment and whitespaces first
2291 +-- with comment and whitespaces first
2297 +show status like "Qcache_queries_in_cache";
2298 +Variable_name Value
2299 +Qcache_queries_in_cache 9
2300 +show status like "Qcache_inserts";
2301 +Variable_name Value
2303 +show status like "Qcache_hits";
2304 +Variable_name Value
2306 +-----------------------------------------------------
2307 +select * /* internal comment */ from t1
2308 +-----------------------------------------------------
2309 +show status like "Qcache_queries_in_cache";
2310 +Variable_name Value
2311 +Qcache_queries_in_cache 9
2312 +show status like "Qcache_inserts";
2313 +Variable_name Value
2315 +show status like "Qcache_hits";
2316 +Variable_name Value
2318 +select * /* internal comment */ from t1;
2323 +select * /* internal comment */ from t1;
2328 +show status like "Qcache_queries_in_cache";
2329 +Variable_name Value
2330 +Qcache_queries_in_cache 10
2331 +show status like "Qcache_inserts";
2332 +Variable_name Value
2334 +show status like "Qcache_hits";
2335 +Variable_name Value
2337 +-----------------------------------------------------
2338 +select */* internal comment */ from t1
2339 +-----------------------------------------------------
2340 +show status like "Qcache_queries_in_cache";
2341 +Variable_name Value
2342 +Qcache_queries_in_cache 10
2343 +show status like "Qcache_inserts";
2344 +Variable_name Value
2346 +show status like "Qcache_hits";
2347 +Variable_name Value
2349 +select */* internal comment */ from t1;
2354 +select */* internal comment */ from t1;
2359 +show status like "Qcache_queries_in_cache";
2360 +Variable_name Value
2361 +Qcache_queries_in_cache 11
2362 +show status like "Qcache_inserts";
2363 +Variable_name Value
2365 +show status like "Qcache_hits";
2366 +Variable_name Value
2368 +-----------------------------------------------------
2369 +select */* internal comment */from t1
2370 +-----------------------------------------------------
2371 +show status like "Qcache_queries_in_cache";
2372 +Variable_name Value
2373 +Qcache_queries_in_cache 11
2374 +show status like "Qcache_inserts";
2375 +Variable_name Value
2377 +show status like "Qcache_hits";
2378 +Variable_name Value
2380 +select */* internal comment */from t1;
2385 +select */* internal comment */from t1;
2390 +show status like "Qcache_queries_in_cache";
2391 +Variable_name Value
2392 +Qcache_queries_in_cache 12
2393 +show status like "Qcache_inserts";
2394 +Variable_name Value
2396 +show status like "Qcache_hits";
2397 +Variable_name Value
2399 +-----------------------------------------------------
2400 +select * /* internal comment with "quote" */ from t1
2401 +-----------------------------------------------------
2402 +show status like "Qcache_queries_in_cache";
2403 +Variable_name Value
2404 +Qcache_queries_in_cache 12
2405 +show status like "Qcache_inserts";
2406 +Variable_name Value
2408 +show status like "Qcache_hits";
2409 +Variable_name Value
2411 +select * /* internal comment with "quote" */ from t1;
2416 +select * /* internal comment with "quote" */ from t1;
2421 +show status like "Qcache_queries_in_cache";
2422 +Variable_name Value
2423 +Qcache_queries_in_cache 13
2424 +show status like "Qcache_inserts";
2425 +Variable_name Value
2427 +show status like "Qcache_hits";
2428 +Variable_name Value
2430 +-----------------------------------------------------
2431 +select */* internal comment with "quote" */ from t1
2432 +-----------------------------------------------------
2433 +show status like "Qcache_queries_in_cache";
2434 +Variable_name Value
2435 +Qcache_queries_in_cache 13
2436 +show status like "Qcache_inserts";
2437 +Variable_name Value
2439 +show status like "Qcache_hits";
2440 +Variable_name Value
2442 +select */* internal comment with "quote" */ from t1;
2447 +select */* internal comment with "quote" */ from t1;
2452 +show status like "Qcache_queries_in_cache";
2453 +Variable_name Value
2454 +Qcache_queries_in_cache 14
2455 +show status like "Qcache_inserts";
2456 +Variable_name Value
2458 +show status like "Qcache_hits";
2459 +Variable_name Value
2461 +-----------------------------------------------------
2462 +select */* internal comment with "quote" */from t1
2463 +-----------------------------------------------------
2464 +show status like "Qcache_queries_in_cache";
2465 +Variable_name Value
2466 +Qcache_queries_in_cache 14
2467 +show status like "Qcache_inserts";
2468 +Variable_name Value
2470 +show status like "Qcache_hits";
2471 +Variable_name Value
2473 +select */* internal comment with "quote" */from t1;
2478 +select */* internal comment with "quote" */from t1;
2483 +show status like "Qcache_queries_in_cache";
2484 +Variable_name Value
2485 +Qcache_queries_in_cache 15
2486 +show status like "Qcache_inserts";
2487 +Variable_name Value
2489 +show status like "Qcache_hits";
2490 +Variable_name Value
2492 +-----------------------------------------------------
2495 +-----------------------------------------------------
2496 +show status like "Qcache_queries_in_cache";
2497 +Variable_name Value
2498 +Qcache_queries_in_cache 15
2499 +show status like "Qcache_inserts";
2500 +Variable_name Value
2502 +show status like "Qcache_hits";
2503 +Variable_name Value
2517 +show status like "Qcache_queries_in_cache";
2518 +Variable_name Value
2519 +Qcache_queries_in_cache 16
2520 +show status like "Qcache_inserts";
2521 +Variable_name Value
2523 +show status like "Qcache_hits";
2524 +Variable_name Value
2526 +-----------------------------------------------------
2528 +-----------------------------------------------------
2529 +show status like "Qcache_queries_in_cache";
2530 +Variable_name Value
2531 +Qcache_queries_in_cache 16
2532 +show status like "Qcache_inserts";
2533 +Variable_name Value
2535 +show status like "Qcache_hits";
2536 +Variable_name Value
2548 +show status like "Qcache_queries_in_cache";
2549 +Variable_name Value
2550 +Qcache_queries_in_cache 16
2551 +show status like "Qcache_inserts";
2552 +Variable_name Value
2554 +show status like "Qcache_hits";
2555 +Variable_name Value
2557 +-----------------------------------------------------
2559 +-----------------------------------------------------
2560 +show status like "Qcache_queries_in_cache";
2561 +Variable_name Value
2562 +Qcache_queries_in_cache 16
2563 +show status like "Qcache_inserts";
2564 +Variable_name Value
2566 +show status like "Qcache_hits";
2567 +Variable_name Value
2579 +show status like "Qcache_queries_in_cache";
2580 +Variable_name Value
2581 +Qcache_queries_in_cache 16
2582 +show status like "Qcache_inserts";
2583 +Variable_name Value
2585 +show status like "Qcache_hits";
2586 +Variable_name Value
2588 +-----------------------------------------------------
2590 +/* comment in the end */
2591 +-----------------------------------------------------
2592 +show status like "Qcache_queries_in_cache";
2593 +Variable_name Value
2594 +Qcache_queries_in_cache 16
2595 +show status like "Qcache_inserts";
2596 +Variable_name Value
2598 +show status like "Qcache_hits";
2599 +Variable_name Value
2602 +/* comment in the end */;
2608 +/* comment in the end */;
2613 +show status like "Qcache_queries_in_cache";
2614 +Variable_name Value
2615 +Qcache_queries_in_cache 17
2616 +show status like "Qcache_inserts";
2617 +Variable_name Value
2619 +show status like "Qcache_hits";
2620 +Variable_name Value
2622 +-----------------------------------------------------
2625 +-----------------------------------------------------
2626 +show status like "Qcache_queries_in_cache";
2627 +Variable_name Value
2628 +Qcache_queries_in_cache 17
2629 +show status like "Qcache_inserts";
2630 +Variable_name Value
2632 +show status like "Qcache_hits";
2633 +Variable_name Value
2647 +show status like "Qcache_queries_in_cache";
2648 +Variable_name Value
2649 +Qcache_queries_in_cache 18
2650 +show status like "Qcache_inserts";
2651 +Variable_name Value
2653 +show status like "Qcache_hits";
2654 +Variable_name Value
2656 +-----------------------------------------------------
2658 +/* comment in the end */
2660 +-----------------------------------------------------
2661 +show status like "Qcache_queries_in_cache";
2662 +Variable_name Value
2663 +Qcache_queries_in_cache 18
2664 +show status like "Qcache_inserts";
2665 +Variable_name Value
2667 +show status like "Qcache_hits";
2668 +Variable_name Value
2671 +/* comment in the end */
2678 +/* comment in the end */
2684 +show status like "Qcache_queries_in_cache";
2685 +Variable_name Value
2686 +Qcache_queries_in_cache 18
2687 +show status like "Qcache_inserts";
2688 +Variable_name Value
2690 +show status like "Qcache_hits";
2691 +Variable_name Value
2693 +-----------------------------------------------------
2694 +select * from t1 #comment in the end
2695 +-----------------------------------------------------
2696 +show status like "Qcache_queries_in_cache";
2697 +Variable_name Value
2698 +Qcache_queries_in_cache 18
2699 +show status like "Qcache_inserts";
2700 +Variable_name Value
2702 +show status like "Qcache_hits";
2703 +Variable_name Value
2705 +select * from t1 #comment in the end;
2710 +select * from t1 #comment in the end;
2715 +show status like "Qcache_queries_in_cache";
2716 +Variable_name Value
2717 +Qcache_queries_in_cache 19
2718 +show status like "Qcache_inserts";
2719 +Variable_name Value
2721 +show status like "Qcache_hits";
2722 +Variable_name Value
2724 +-----------------------------------------------------
2725 +select * from t1 #comment in the end
2727 +-----------------------------------------------------
2728 +show status like "Qcache_queries_in_cache";
2729 +Variable_name Value
2730 +Qcache_queries_in_cache 19
2731 +show status like "Qcache_inserts";
2732 +Variable_name Value
2734 +show status like "Qcache_hits";
2735 +Variable_name Value
2737 +select * from t1 #comment in the end
2743 +select * from t1 #comment in the end
2749 +show status like "Qcache_queries_in_cache";
2750 +Variable_name Value
2751 +Qcache_queries_in_cache 19
2752 +show status like "Qcache_inserts";
2753 +Variable_name Value
2755 +show status like "Qcache_hits";
2756 +Variable_name Value
2758 +-----------------------------------------------------
2759 +select * from t1 -- comment in the end
2760 +-----------------------------------------------------
2761 +show status like "Qcache_queries_in_cache";
2762 +Variable_name Value
2763 +Qcache_queries_in_cache 19
2764 +show status like "Qcache_inserts";
2765 +Variable_name Value
2767 +show status like "Qcache_hits";
2768 +Variable_name Value
2770 +select * from t1 -- comment in the end;
2775 +select * from t1 -- comment in the end;
2780 +show status like "Qcache_queries_in_cache";
2781 +Variable_name Value
2782 +Qcache_queries_in_cache 20
2783 +show status like "Qcache_inserts";
2784 +Variable_name Value
2786 +show status like "Qcache_hits";
2787 +Variable_name Value
2789 +-----------------------------------------------------
2790 +select * from t1 -- comment in the end
2792 +-----------------------------------------------------
2793 +show status like "Qcache_queries_in_cache";
2794 +Variable_name Value
2795 +Qcache_queries_in_cache 20
2796 +show status like "Qcache_inserts";
2797 +Variable_name Value
2799 +show status like "Qcache_hits";
2800 +Variable_name Value
2802 +select * from t1 -- comment in the end
2808 +select * from t1 -- comment in the end
2814 +show status like "Qcache_queries_in_cache";
2815 +Variable_name Value
2816 +Qcache_queries_in_cache 20
2817 +show status like "Qcache_inserts";
2818 +Variable_name Value
2820 +show status like "Qcache_hits";
2821 +Variable_name Value
2823 +-----------------------------------------------------
2824 +select */* a comment \*/from t1
2825 +-----------------------------------------------------
2826 +show status like "Qcache_queries_in_cache";
2827 +Variable_name Value
2828 +Qcache_queries_in_cache 20
2829 +show status like "Qcache_inserts";
2830 +Variable_name Value
2832 +show status like "Qcache_hits";
2833 +Variable_name Value
2835 +select */* a comment \*/from t1;
2840 +select */* a comment \*/from t1;
2845 +show status like "Qcache_queries_in_cache";
2846 +Variable_name Value
2847 +Qcache_queries_in_cache 21
2848 +show status like "Qcache_inserts";
2849 +Variable_name Value
2851 +show status like "Qcache_hits";
2852 +Variable_name Value
2854 +-----------------------------------------------------
2855 +select *# a comment \
2857 +-----------------------------------------------------
2858 +show status like "Qcache_queries_in_cache";
2859 +Variable_name Value
2860 +Qcache_queries_in_cache 21
2861 +show status like "Qcache_inserts";
2862 +Variable_name Value
2864 +show status like "Qcache_hits";
2865 +Variable_name Value
2867 +select *# a comment \
2873 +select *# a comment \
2879 +show status like "Qcache_queries_in_cache";
2880 +Variable_name Value
2881 +Qcache_queries_in_cache 22
2882 +show status like "Qcache_inserts";
2883 +Variable_name Value
2885 +show status like "Qcache_hits";
2886 +Variable_name Value
2888 +-----------------------------------------------------
2889 +select *-- a comment \
2891 +-----------------------------------------------------
2892 +show status like "Qcache_queries_in_cache";
2893 +Variable_name Value
2894 +Qcache_queries_in_cache 22
2895 +show status like "Qcache_inserts";
2896 +Variable_name Value
2898 +show status like "Qcache_hits";
2899 +Variable_name Value
2901 +select *-- a comment \
2907 +select *-- a comment \
2913 +show status like "Qcache_queries_in_cache";
2914 +Variable_name Value
2915 +Qcache_queries_in_cache 23
2916 +show status like "Qcache_inserts";
2917 +Variable_name Value
2919 +show status like "Qcache_hits";
2920 +Variable_name Value
2922 +-----------------------------------------------------
2923 +select "\\"" /* not a comment */" from t1
2924 +-----------------------------------------------------
2925 +show status like "Qcache_queries_in_cache";
2926 +Variable_name Value
2927 +Qcache_queries_in_cache 23
2928 +show status like "Qcache_inserts";
2929 +Variable_name Value
2931 +show status like "Qcache_hits";
2932 +Variable_name Value
2934 +select "\\"" /* not a comment */" from t1;
2935 +\" /* not a comment */
2936 +\" /* not a comment */
2937 +\" /* not a comment */
2938 +\" /* not a comment */
2939 +select "\\"" /* not a comment */" from t1;
2940 +\" /* not a comment */
2941 +\" /* not a comment */
2942 +\" /* not a comment */
2943 +\" /* not a comment */
2944 +show status like "Qcache_queries_in_cache";
2945 +Variable_name Value
2946 +Qcache_queries_in_cache 24
2947 +show status like "Qcache_inserts";
2948 +Variable_name Value
2950 +show status like "Qcache_hits";
2951 +Variable_name Value
2953 +-----------------------------------------------------
2954 +select "\\"" /*! not a comment */" from t1
2955 +-----------------------------------------------------
2956 +show status like "Qcache_queries_in_cache";
2957 +Variable_name Value
2958 +Qcache_queries_in_cache 24
2959 +show status like "Qcache_inserts";
2960 +Variable_name Value
2962 +show status like "Qcache_hits";
2963 +Variable_name Value
2965 +select "\\"" /*! not a comment */" from t1;
2966 +\" /*! not a comment */
2967 +\" /*! not a comment */
2968 +\" /*! not a comment */
2969 +\" /*! not a comment */
2970 +select "\\"" /*! not a comment */" from t1;
2971 +\" /*! not a comment */
2972 +\" /*! not a comment */
2973 +\" /*! not a comment */
2974 +\" /*! not a comment */
2975 +show status like "Qcache_queries_in_cache";
2976 +Variable_name Value
2977 +Qcache_queries_in_cache 25
2978 +show status like "Qcache_inserts";
2979 +Variable_name Value
2981 +show status like "Qcache_hits";
2982 +Variable_name Value
2984 +-----------------------------------------------------
2985 +select ' \' ' from t1
2986 +-----------------------------------------------------
2987 +show status like "Qcache_queries_in_cache";
2988 +Variable_name Value
2989 +Qcache_queries_in_cache 25
2990 +show status like "Qcache_inserts";
2991 +Variable_name Value
2993 +show status like "Qcache_hits";
2994 +Variable_name Value
2996 +select ' \' ' from t1;
3001 +select ' \' ' from t1;
3006 +show status like "Qcache_queries_in_cache";
3007 +Variable_name Value
3008 +Qcache_queries_in_cache 26
3009 +show status like "Qcache_inserts";
3010 +Variable_name Value
3012 +show status like "Qcache_hits";
3013 +Variable_name Value
3015 +-----------------------------------------------------
3016 +select ' \' /* comment inside quotes with internal backslash quote */' from t1
3017 +-----------------------------------------------------
3018 +show status like "Qcache_queries_in_cache";
3019 +Variable_name Value
3020 +Qcache_queries_in_cache 26
3021 +show status like "Qcache_inserts";
3022 +Variable_name Value
3024 +show status like "Qcache_hits";
3025 +Variable_name Value
3027 +select ' \' /* comment inside quotes with internal backslash quote */' from t1;
3028 +' /* comment inside quotes with internal backslash quote */
3029 + ' /* comment inside quotes with internal backslash quote */
3030 + ' /* comment inside quotes with internal backslash quote */
3031 + ' /* comment inside quotes with internal backslash quote */
3032 +select ' \' /* comment inside quotes with internal backslash quote */' from t1;
3033 +' /* comment inside quotes with internal backslash quote */
3034 + ' /* comment inside quotes with internal backslash quote */
3035 + ' /* comment inside quotes with internal backslash quote */
3036 + ' /* comment inside quotes with internal backslash quote */
3037 +show status like "Qcache_queries_in_cache";
3038 +Variable_name Value
3039 +Qcache_queries_in_cache 27
3040 +show status like "Qcache_inserts";
3041 +Variable_name Value
3043 +show status like "Qcache_hits";
3044 +Variable_name Value
3047 +SET GLOBAL query_cache_size=default;
3048 +set global query_cache_strip_comments=OFF;
3050 +++ b/mysql-test/r/percona_query_cache_with_comments_prepared_statements.result
3052 +set GLOBAL query_cache_size=1355776;
3057 +drop table if exists t1;
3058 +create table t1 (a int not null);
3059 +insert into t1 values (1),(2),(3);
3060 +set global query_cache_strip_comments=ON;
3061 +show status like "Qcache_queries_in_cache";
3062 +Variable_name Value
3063 +Qcache_queries_in_cache 0
3064 +show status like "Qcache_inserts";
3065 +Variable_name Value
3067 +show status like "Qcache_hits";
3068 +Variable_name Value
3070 +prepare stmt from '/* with comment */ select * from t1';
3076 +show status like "Qcache_queries_in_cache";
3077 +Variable_name Value
3078 +Qcache_queries_in_cache 1
3079 +show status like "Qcache_inserts";
3080 +Variable_name Value
3082 +show status like "Qcache_hits";
3083 +Variable_name Value
3110 +show status like "Qcache_queries_in_cache";
3111 +Variable_name Value
3112 +Qcache_queries_in_cache 1
3113 +show status like "Qcache_inserts";
3114 +Variable_name Value
3116 +show status like "Qcache_hits";
3117 +Variable_name Value
3119 +prepare stmt from 'select * from t1';
3125 +show status like "Qcache_queries_in_cache";
3126 +Variable_name Value
3127 +Qcache_queries_in_cache 1
3128 +show status like "Qcache_inserts";
3129 +Variable_name Value
3131 +show status like "Qcache_hits";
3132 +Variable_name Value
3134 +prepare stmt from 'select * /*internal comment*/from t1';
3140 +show status like "Qcache_queries_in_cache";
3141 +Variable_name Value
3142 +Qcache_queries_in_cache 1
3143 +show status like "Qcache_inserts";
3144 +Variable_name Value
3146 +show status like "Qcache_hits";
3147 +Variable_name Value
3149 +prepare stmt from 'select * /*internal comment*/ from t1';
3155 +show status like "Qcache_queries_in_cache";
3156 +Variable_name Value
3157 +Qcache_queries_in_cache 1
3158 +show status like "Qcache_inserts";
3159 +Variable_name Value
3161 +show status like "Qcache_hits";
3162 +Variable_name Value
3164 +prepare stmt from 'select * from t1 /* at the end */';
3170 +show status like "Qcache_queries_in_cache";
3171 +Variable_name Value
3172 +Qcache_queries_in_cache 1
3173 +show status like "Qcache_inserts";
3174 +Variable_name Value
3176 +show status like "Qcache_hits";
3177 +Variable_name Value
3179 +prepare stmt from 'select * from t1 /* with "quote" */';
3185 +show status like "Qcache_queries_in_cache";
3186 +Variable_name Value
3187 +Qcache_queries_in_cache 1
3188 +show status like "Qcache_inserts";
3189 +Variable_name Value
3191 +show status like "Qcache_hits";
3192 +Variable_name Value
3194 +prepare stmt from 'select * from t1 /* with \'quote\' */';
3200 +show status like "Qcache_queries_in_cache";
3201 +Variable_name Value
3202 +Qcache_queries_in_cache 1
3203 +show status like "Qcache_inserts";
3204 +Variable_name Value
3206 +show status like "Qcache_hits";
3207 +Variable_name Value
3209 +prepare stmt from 'select * from t1 # 123
3216 +show status like "Qcache_queries_in_cache";
3217 +Variable_name Value
3218 +Qcache_queries_in_cache 1
3219 +show status like "Qcache_inserts";
3220 +Variable_name Value
3222 +show status like "Qcache_hits";
3223 +Variable_name Value
3225 +prepare stmt from 'select * from t1 # 123 with "quote"
3232 +show status like "Qcache_queries_in_cache";
3233 +Variable_name Value
3234 +Qcache_queries_in_cache 1
3235 +show status like "Qcache_inserts";
3236 +Variable_name Value
3238 +show status like "Qcache_hits";
3239 +Variable_name Value
3241 +prepare stmt from 'select * from t1 # 123 with \'quote\'
3248 +show status like "Qcache_queries_in_cache";
3249 +Variable_name Value
3250 +Qcache_queries_in_cache 1
3251 +show status like "Qcache_inserts";
3252 +Variable_name Value
3254 +show status like "Qcache_hits";
3255 +Variable_name Value
3257 +prepare stmt from 'select * from t1
3265 +show status like "Qcache_queries_in_cache";
3266 +Variable_name Value
3267 +Qcache_queries_in_cache 1
3268 +show status like "Qcache_inserts";
3269 +Variable_name Value
3271 +show status like "Qcache_hits";
3272 +Variable_name Value
3274 +prepare stmt from '#456
3283 +show status like "Qcache_queries_in_cache";
3284 +Variable_name Value
3285 +Qcache_queries_in_cache 1
3286 +show status like "Qcache_inserts";
3287 +Variable_name Value
3289 +show status like "Qcache_hits";
3290 +Variable_name Value
3292 +prepare stmt from 'select * from t1 -- 123
3299 +show status like "Qcache_queries_in_cache";
3300 +Variable_name Value
3301 +Qcache_queries_in_cache 1
3302 +show status like "Qcache_inserts";
3303 +Variable_name Value
3305 +show status like "Qcache_hits";
3306 +Variable_name Value
3308 +prepare stmt from 'select * from t1
3316 +show status like "Qcache_queries_in_cache";
3317 +Variable_name Value
3318 +Qcache_queries_in_cache 1
3319 +show status like "Qcache_inserts";
3320 +Variable_name Value
3322 +show status like "Qcache_hits";
3323 +Variable_name Value
3325 +prepare stmt from '-- comment in first
3334 +show status like "Qcache_queries_in_cache";
3335 +Variable_name Value
3336 +Qcache_queries_in_cache 1
3337 +show status like "Qcache_inserts";
3338 +Variable_name Value
3340 +show status like "Qcache_hits";
3341 +Variable_name Value
3343 +prepare stmt from '(#456(
3352 +show status like "Qcache_queries_in_cache";
3353 +Variable_name Value
3354 +Qcache_queries_in_cache 2
3355 +show status like "Qcache_inserts";
3356 +Variable_name Value
3358 +show status like "Qcache_hits";
3359 +Variable_name Value
3361 +prepare stmt from '/*test*/(-- comment in first(
3370 +show status like "Qcache_queries_in_cache";
3371 +Variable_name Value
3372 +Qcache_queries_in_cache 2
3373 +show status like "Qcache_inserts";
3374 +Variable_name Value
3376 +show status like "Qcache_hits";
3377 +Variable_name Value
3379 +prepare stmt from 'select "test",a from t1';
3390 +show status like "Qcache_queries_in_cache";
3391 +Variable_name Value
3392 +Qcache_queries_in_cache 3
3393 +show status like "Qcache_inserts";
3394 +Variable_name Value
3396 +show status like "Qcache_hits";
3397 +Variable_name Value
3399 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
3401 +test /* internal 'comment' */ a
3402 +test /* internal 'comment' */ 1
3403 +test /* internal 'comment' */ 2
3404 +test /* internal 'comment' */ 3
3405 +show status like "Qcache_queries_in_cache";
3406 +Variable_name Value
3407 +Qcache_queries_in_cache 4
3408 +show status like "Qcache_inserts";
3409 +Variable_name Value
3411 +show status like "Qcache_hits";
3412 +Variable_name Value
3414 +prepare stmt from 'select "test #internal comment" ,a from t1';
3416 +test #internal comment a
3417 +test #internal comment 1
3418 +test #internal comment 2
3419 +test #internal comment 3
3420 +show status like "Qcache_queries_in_cache";
3421 +Variable_name Value
3422 +Qcache_queries_in_cache 5
3423 +show status like "Qcache_inserts";
3424 +Variable_name Value
3426 +show status like "Qcache_hits";
3427 +Variable_name Value
3429 +prepare stmt from 'select "test #internal comment" #external comment
3432 +test #internal comment a
3433 +test #internal comment 1
3434 +test #internal comment 2
3435 +test #internal comment 3
3436 +show status like "Qcache_queries_in_cache";
3437 +Variable_name Value
3438 +Qcache_queries_in_cache 5
3439 +show status like "Qcache_inserts";
3440 +Variable_name Value
3442 +show status like "Qcache_hits";
3443 +Variable_name Value
3446 +SET GLOBAL query_cache_size= default;
3447 +set global query_cache_strip_comments=OFF;
3449 +++ b/mysql-test/t/percona_query_cache_with_comments.test
3451 +--disable_ps_protocol
3452 +set global query_cache_strip_comments=ON;
3453 +-- source include/percona_query_cache_with_comments_begin.inc
3454 +-- source include/percona_query_cache_with_comments.inc
3455 +-- source include/percona_query_cache_with_comments_end.inc
3457 +++ b/mysql-test/t/percona_query_cache_with_comments_crash.test
3459 +-- source include/have_query_cache.inc
3460 +set GLOBAL query_cache_size=1355776;
3462 +drop table if exists t1;
3464 +create table t1 (a int not null);
3465 +insert into t1 values (1),(2),(3);
3466 +flush query cache; # This crashed in some versions
3467 +flush query cache; # This crashed in some versions
3470 +( select * from t1 );
3471 +/*!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 */;
3472 +/* only comment */;
3473 +let query=# only comment
3476 +let query=-- only comment
3480 +SET GLOBAL query_cache_size= default;
3482 +++ b/mysql-test/t/percona_query_cache_with_comments_disable.test
3484 +-- source include/percona_query_cache_with_comments_begin.inc
3485 +-- source include/percona_query_cache_with_comments.inc
3486 +-- source include/percona_query_cache_with_comments_end.inc
3488 +++ b/mysql-test/t/percona_query_cache_with_comments_prepared_statements.test
3490 +-- source include/have_query_cache.inc
3492 +set GLOBAL query_cache_size=1355776;
3494 +# Reset query cache variables.
3495 +flush query cache; # This crashed in some versions
3496 +flush query cache; # This crashed in some versions
3500 +drop table if exists t1;
3504 +# First simple test
3507 +create table t1 (a int not null);
3508 +insert into t1 values (1),(2),(3);
3510 +set global query_cache_strip_comments=ON;
3512 +show status like "Qcache_queries_in_cache";
3513 +show status like "Qcache_inserts";
3514 +show status like "Qcache_hits";
3516 +prepare stmt from '/* with comment */ select * from t1';
3519 +show status like "Qcache_queries_in_cache";
3520 +show status like "Qcache_inserts";
3521 +show status like "Qcache_hits";
3529 +show status like "Qcache_queries_in_cache";
3530 +show status like "Qcache_inserts";
3531 +show status like "Qcache_hits";
3533 +prepare stmt from 'select * from t1';
3536 +show status like "Qcache_queries_in_cache";
3537 +show status like "Qcache_inserts";
3538 +show status like "Qcache_hits";
3540 +prepare stmt from 'select * /*internal comment*/from t1';
3543 +show status like "Qcache_queries_in_cache";
3544 +show status like "Qcache_inserts";
3545 +show status like "Qcache_hits";
3547 +prepare stmt from 'select * /*internal comment*/ from t1';
3550 +show status like "Qcache_queries_in_cache";
3551 +show status like "Qcache_inserts";
3552 +show status like "Qcache_hits";
3554 +prepare stmt from 'select * from t1 /* at the end */';
3557 +show status like "Qcache_queries_in_cache";
3558 +show status like "Qcache_inserts";
3559 +show status like "Qcache_hits";
3561 +prepare stmt from 'select * from t1 /* with "quote" */';
3564 +show status like "Qcache_queries_in_cache";
3565 +show status like "Qcache_inserts";
3566 +show status like "Qcache_hits";
3568 +prepare stmt from 'select * from t1 /* with \'quote\' */';
3571 +show status like "Qcache_queries_in_cache";
3572 +show status like "Qcache_inserts";
3573 +show status like "Qcache_hits";
3575 +prepare stmt from 'select * from t1 # 123
3579 +show status like "Qcache_queries_in_cache";
3580 +show status like "Qcache_inserts";
3581 +show status like "Qcache_hits";
3583 +prepare stmt from 'select * from t1 # 123 with "quote"
3587 +show status like "Qcache_queries_in_cache";
3588 +show status like "Qcache_inserts";
3589 +show status like "Qcache_hits";
3591 +prepare stmt from 'select * from t1 # 123 with \'quote\'
3595 +show status like "Qcache_queries_in_cache";
3596 +show status like "Qcache_inserts";
3597 +show status like "Qcache_hits";
3599 +prepare stmt from 'select * from t1
3604 +show status like "Qcache_queries_in_cache";
3605 +show status like "Qcache_inserts";
3606 +show status like "Qcache_hits";
3608 +prepare stmt from '#456
3614 +show status like "Qcache_queries_in_cache";
3615 +show status like "Qcache_inserts";
3616 +show status like "Qcache_hits";
3618 +prepare stmt from 'select * from t1 -- 123
3622 +show status like "Qcache_queries_in_cache";
3623 +show status like "Qcache_inserts";
3624 +show status like "Qcache_hits";
3626 +prepare stmt from 'select * from t1
3631 +show status like "Qcache_queries_in_cache";
3632 +show status like "Qcache_inserts";
3633 +show status like "Qcache_hits";
3635 +prepare stmt from '-- comment in first
3641 +show status like "Qcache_queries_in_cache";
3642 +show status like "Qcache_inserts";
3643 +show status like "Qcache_hits";
3645 +prepare stmt from '(#456(
3651 +show status like "Qcache_queries_in_cache";
3652 +show status like "Qcache_inserts";
3653 +show status like "Qcache_hits";
3655 +prepare stmt from '/*test*/(-- comment in first(
3661 +show status like "Qcache_queries_in_cache";
3662 +show status like "Qcache_inserts";
3663 +show status like "Qcache_hits";
3665 +prepare stmt from 'select "test",a from t1';
3669 +show status like "Qcache_queries_in_cache";
3670 +show status like "Qcache_inserts";
3671 +show status like "Qcache_hits";
3673 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
3676 +show status like "Qcache_queries_in_cache";
3677 +show status like "Qcache_inserts";
3678 +show status like "Qcache_hits";
3680 +prepare stmt from 'select "test #internal comment" ,a from t1';
3683 +show status like "Qcache_queries_in_cache";
3684 +show status like "Qcache_inserts";
3685 +show status like "Qcache_hits";
3687 +prepare stmt from 'select "test #internal comment" #external comment
3691 +show status like "Qcache_queries_in_cache";
3692 +show status like "Qcache_inserts";
3693 +show status like "Qcache_hits";
3696 +SET GLOBAL query_cache_size= default;
3697 +set global query_cache_strip_comments=OFF;
3699 +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
3701 +--source include/have_query_cache.inc
3702 +--source include/have_debug.inc
3703 +--source include/have_debug_sync.inc
3704 +SET GLOBAL query_cache_size=1355776;
3705 +--source include/percona_query_cache_with_comments_clear.inc
3706 +--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
3708 +--connect (mutex_locked_conn, localhost, root,,)
3709 +--connect (try_mutex_lock_conn, localhost, root,,)
3711 +--connection mutex_locked_conn
3712 +SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
3713 +send SELECT "mutex_locked_query" as action;
3715 +--connection default
3716 +SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
3718 +--connection try_mutex_lock_conn
3719 +SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
3720 +send_eval $try_lock_mutex_query;
3722 +--connection default
3723 +SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
3724 +eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query';
3725 +SET DEBUG_SYNC='now SIGNAL unlock_mutex';
3727 +--connection mutex_locked_conn
3729 +--connection try_mutex_lock_conn
3732 +--connection default
3733 +--disconnect mutex_locked_conn
3734 +--disconnect try_mutex_lock_conn
3735 +SET GLOBAL query_cache_size=0;
3736 --- a/mysql-test/r/mysqld--help-notwin.result
3737 +++ b/mysql-test/r/mysqld--help-notwin.result
3738 @@ -493,6 +493,10 @@
3739 The minimum size for blocks allocated by the query cache
3740 --query-cache-size=#
3741 The memory allocated to store results from old queries
3742 + --query-cache-strip-comments
3743 + Enable and disable optimisation "strip comment for query
3744 + cache" - optimisation strip all comments from query while
3745 + search query result in query cache
3746 --query-cache-type=name
3747 OFF = Don't cache or retrieve results. ON = Cache all
3748 results except SELECT SQL_NO_CACHE ... queries. DEMAND =
3750 query-cache-limit 1048576
3751 query-cache-min-res-unit 4096
3753 +query-cache-strip-comments FALSE
3755 query-cache-wlock-invalidate FALSE
3756 query-prealloc-size 8192
3758 +++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
3760 +SET GLOBAL query_cache_size=1355776;
3765 +SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
3766 +SELECT "mutex_locked_query" as action;
3767 +SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
3768 +SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
3769 +SELECT "try_lock_mutex_query" as action;
3770 +SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
3771 +SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action';
3773 +Waiting on query cache mutex
3774 +SET DEBUG_SYNC='now SIGNAL unlock_mutex';
3778 +try_lock_mutex_query
3779 +SET GLOBAL query_cache_size=0;
3781 +++ b/mysql-test/r/percona_query_cache_with_comments_crash_2.result
3783 +DROP TABLE IF EXISTS table17_int;
3784 +DROP TABLE IF EXISTS table30_int;
3785 +CREATE TABLE `table17_int` (pk integer auto_increment primary key, `col_char_10_not_null_key` char(10), `col_enum_not_null_key` int);
3786 +CREATE TABLE `table30_int` (pk integer auto_increment primary key, `col_enum_not_null_key` int);
3787 +SELECT X . `pk` FROM `table17_int` AS X LEFT JOIN `table30_int` AS Y USING ( `col_enum_not_null_key` ) WHERE X . `col_char_10_not_null_key` != ' you need to translate Views labels into other languages, consider installing the <a href=\" !path\">Internationalization</a> package\'s Views translation module.' LIMIT 7 /*Generated by THREAD_ID 1*/;
3789 +DROP TABLE table17_int;
3790 +DROP TABLE table30_int;
3792 +++ b/mysql-test/t/percona_query_cache_with_comments_crash_2-master.opt
3794 +--query-cache-size=10M --query-cache-strip-comments
3796 +++ b/mysql-test/t/percona_query_cache_with_comments_crash_2.test
3799 +DROP TABLE IF EXISTS table17_int;
3800 +DROP TABLE IF EXISTS table30_int;
3802 +CREATE TABLE `table17_int` (pk integer auto_increment primary key, `col_char_10_not_null_key` char(10), `col_enum_not_null_key` int);
3803 +CREATE TABLE `table30_int` (pk integer auto_increment primary key, `col_enum_not_null_key` int);
3804 +SELECT X . `pk` FROM `table17_int` AS X LEFT JOIN `table30_int` AS Y USING ( `col_enum_not_null_key` ) WHERE X . `col_char_10_not_null_key` != ' you need to translate Views labels into other languages, consider installing the <a href=\" !path\">Internationalization</a> package\'s Views translation module.' LIMIT 7 /*Generated by THREAD_ID 1*/;
3805 +DROP TABLE table17_int;
3806 +DROP TABLE table30_int;
3807 --- a/sql/sql_class.cc
3808 +++ b/sql/sql_class.cc
3809 @@ -807,6 +807,99 @@
3810 sql_errno == ER_TRG_NO_DEFINER);
3813 +#ifdef HAVE_QUERY_CACHE
3816 +Query_Without_Comments::Query_Without_Comments() :
3824 +Query_Without_Comments::~Query_Without_Comments()
3833 +bool Query_Without_Comments::allocate(size_t query_length, size_t db_length)
3835 + DBUG_ENTER("Query_Without_Comments::allocate");
3836 + DBUG_PRINT("info", ("old buffer: %p "
3837 + "old query: '%-.4096s' "
3838 + "old buffer length: %u "
3839 + "old query length: %u",
3843 + (uint) q_length));
3844 + /* save maximum query length for check in the set_length */
3845 + q_length= query_length;
3846 + /* according to sql_parse.cc memory allocation */
3847 + size_t new_b_length= (query_length + 1) + sizeof(size_t) + db_length +
3848 + QUERY_CACHE_FLAGS_SIZE;
3849 + if (b_length < new_b_length)
3851 + b_length= new_b_length;
3854 + buffer= (char*) my_realloc(buffer, b_length, MYF(0));
3858 + buffer= (char *) my_malloc(b_length, MYF(0));
3862 + DBUG_PRINT("info", ("buffer: %p "
3863 + "buffer length: %u "
3864 + "query maximum length: %u",
3867 + (uint) q_length));
3868 + DBUG_RETURN(buffer);
3872 +void Query_Without_Comments::set_length(size_t query_length)
3874 + DBUG_ENTER("Query_Without_Comments::set_length");
3875 + DBUG_ASSERT(query_length <= q_length);
3876 + buffer[query_length]= 0;
3877 + DBUG_PRINT("info", ("buffer: %p "
3878 + "query: '%-.4096s' "
3879 + "buffer length: %u "
3880 + "query maximum length: %u "
3881 + "query length: %u",
3886 + (uint) query_length));
3887 + q_length= query_length;
3892 +char* Query_Without_Comments::query()
3898 +size_t Query_Without_Comments::length()
3904 +#endif // HAVE_QUERY_CACHE
3908 :Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,