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
28 my_bool opt_log_slow_slave_statements= 0;
29 my_bool opt_log_slow_sp_statements= 0;
30 my_bool opt_log_slow_timestamp_every= 0;
31 +my_bool opt_query_cache_strip_comments = 0;
32 my_bool opt_use_global_long_query_time= 0;
33 my_bool opt_slow_query_log_microseconds_timestamp= 0;
34 my_bool lower_case_file_system= 0;
36 OPT_THREAD_STATISTICS,
38 OPT_SUPPRESS_LOG_WARNING_1592,
39 + OPT_QUERY_CACHE_STRIP_COMMENTS,
40 OPT_USE_GLOBAL_LONG_QUERY_TIME,
41 OPT_USE_GLOBAL_LOG_SLOW_CONTROL,
42 OPT_SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP,
43 @@ -6977,6 +6979,10 @@
44 {"use_global_log_slow_control", OPT_USE_GLOBAL_LOG_SLOW_CONTROL,
45 "Choose flags, wich always use the global variables. Multiple flags allowed in a comma-separated string. [none, log_slow_filter, log_slow_rate_limit, log_slow_verbosity, long_query_time, min_examined_row_limit, all]",
46 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, SLOG_UG_NONE, 0, 0},
47 + {"query_cache_strip_comments", OPT_QUERY_CACHE_STRIP_COMMENTS,
48 + "Enable and disable optimisation \"strip comment for query cache\" - optimisation strip all comments from query while search query result in query cache",
49 + (uchar**) &opt_query_cache_strip_comments, (uchar**) &opt_query_cache_strip_comments,
50 + 0, GET_BOOL, REQUIRED_ARG, 0, 0, 1, 0, 1, 0},
51 {"use_global_long_query_time", OPT_USE_GLOBAL_LONG_QUERY_TIME,
52 "Control always use global long_query_time or local long_query_time.",
53 (uchar**) &opt_use_global_long_query_time, (uchar**) &opt_use_global_long_query_time,
54 --- a/sql/mysql_priv.h
55 +++ b/sql/mysql_priv.h
57 extern my_bool opt_log_slow_admin_statements, opt_log_slow_slave_statements;
58 extern my_bool opt_log_slow_sp_statements;
59 extern my_bool opt_log_slow_timestamp_every;
60 +extern my_bool opt_query_cache_strip_comments;
61 extern my_bool opt_use_global_long_query_time;
62 extern my_bool opt_slow_query_log_microseconds_timestamp;
63 extern my_bool sp_automatic_privileges, opt_noacl;
65 +++ b/sql/query_strip_comments.h
67 +#ifndef _SQL_QUERY_STRIPC_COMMENTS_H_
68 +#define _SQL_QUERY_STRIPC_COMMENTS_H_
69 +#ifdef HAVE_QUERY_CACHE
71 +// implemented in sql_cache.cc
72 +class QueryStripComments
75 + QueryStripComments(const QueryStripComments&);
76 + QueryStripComments& operator=(const QueryStripComments&);
78 + QueryStripComments();
79 + ~QueryStripComments();
80 + void set(const char* a_query, uint a_query_length, uint a_additional_length);
82 + char* query() { return buffer; }
83 + uint query_length() { return length; }
88 + uint length /*query length, not buffer length*/;
91 +class QueryStripComments_Backup
94 + QueryStripComments_Backup(THD* a_thd,QueryStripComments* qsc);
95 + ~QueryStripComments_Backup();
102 +#endif // HAVE_QUERY_CACHE
103 +#endif // _SQL_QUERY_STRIPC_COMMENTS_H_
107 static void fix_net_write_timeout(THD *thd, enum_var_type type);
108 static void fix_net_retry_count(THD *thd, enum_var_type type);
109 static void fix_max_join_size(THD *thd, enum_var_type type);
110 +#ifdef HAVE_QUERY_CACHE
111 static void fix_query_cache_size(THD *thd, enum_var_type type);
112 static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type);
114 static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
115 static void fix_max_binlog_size(THD *thd, enum_var_type type);
116 static void fix_max_relay_log_size(THD *thd, enum_var_type type);
118 &SV::div_precincrement);
119 static sys_var_long_ptr sys_rpl_recovery_rank(&vars, "rpl_recovery_rank",
121 -static sys_var_long_ptr sys_query_cache_size(&vars, "query_cache_size",
123 - fix_query_cache_size);
125 static sys_var_thd_ulong sys_range_alloc_block_size(&vars, "range_alloc_block_size",
126 &SV::range_alloc_block_size);
127 @@ -651,14 +650,20 @@
130 #ifdef HAVE_QUERY_CACHE
131 +static sys_var_long_ptr sys_query_cache_size(&vars, "query_cache_size",
133 + fix_query_cache_size);
134 static sys_var_long_ptr sys_query_cache_limit(&vars, "query_cache_limit",
135 &query_cache.query_cache_limit);
136 -static sys_var_long_ptr sys_query_cache_min_res_unit(&vars, "query_cache_min_res_unit",
137 +static sys_var_long_ptr
138 + sys_query_cache_min_res_unit(&vars, "query_cache_min_res_unit",
139 &query_cache_min_res_unit,
140 fix_query_cache_min_res_unit);
141 +static int check_query_cache_type(THD *thd, set_var *var);
142 static sys_var_thd_enum sys_query_cache_type(&vars, "query_cache_type",
143 &SV::query_cache_type,
144 - &query_cache_type_typelib);
145 + &query_cache_type_typelib, NULL,
146 + check_query_cache_type);
147 static sys_var_thd_bool
148 sys_query_cache_wlock_invalidate(&vars, "query_cache_wlock_invalidate",
149 &SV::query_cache_wlock_invalidate);
151 #ifndef EMBEDDED_LIBRARY
152 static sys_var_const_str_ptr sys_repl_report_host(&vars, "report_host", &report_host);
153 static sys_var_const_str_ptr sys_repl_report_user(&vars, "report_user", &report_user);
154 +static sys_var_bool_ptr sys_query_cache_strip_comments(&vars, "query_cache_strip_comments",
155 + &opt_query_cache_strip_comments);
156 static sys_var_const_str_ptr sys_repl_report_password(&vars, "report_password", &report_password);
158 static uchar *slave_get_report_port(THD *thd)
159 @@ -1259,10 +1266,9 @@
161 #endif /* HAVE_REPLICATION */
164 +#ifdef HAVE_QUERY_CACHE
165 static void fix_query_cache_size(THD *thd, enum_var_type type)
167 -#ifdef HAVE_QUERY_CACHE
168 ulong new_cache_size= query_cache.resize(query_cache_size);
171 @@ -1276,11 +1282,35 @@
172 query_cache_size, new_cache_size);
174 query_cache_size= new_cache_size;
179 -#ifdef HAVE_QUERY_CACHE
181 + Trigger before query_cache_type variable is updated.
182 + @param thd Thread handler
183 + @param var Pointer to the new variable status
185 + @return Status code
190 +static int check_query_cache_type(THD *thd, set_var *var)
193 + Don't allow changes of the query_cache_type if the query cache
196 + if (query_cache.is_disabled())
198 + my_error(ER_QUERY_CACHE_DISABLED,MYF(0));
206 static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type)
208 query_cache_min_res_unit=
209 @@ -3638,6 +3668,16 @@
210 Functions to handle SET mysql_internal_variable=const_expr
211 *****************************************************************************/
214 + Verify that the supplied value is correct.
216 + @param thd Thread handler
218 + @return status code
223 int set_var::check(THD *thd)
225 if (var->is_readonly())
226 --- a/sql/sql_cache.cc
227 +++ b/sql/sql_cache.cc
229 if (and only if) this query has a registered result set writer
230 (thd->net.query_cache_query).
231 4. Query_cache::invalidate
232 + Query_cache::invalidate_locked_for_write
233 - Called from various places to invalidate query cache based on data-
234 base, table and myisam file name. During an on going invalidation
235 the query cache is temporarily disabled.
236 @@ -335,6 +336,181 @@
238 #include "../storage/myisammrg/ha_myisammrg.h"
239 #include "../storage/myisammrg/myrg_def.h"
240 +#include "query_strip_comments.h"
242 +QueryStripComments::QueryStripComments()
248 +QueryStripComments::~QueryStripComments()
253 +inline bool query_strip_comments_is_white_space(char c)
255 + return ((' ' == c) || ('\t' == c) || ('\r' == c) || ('\n' ==c ));
257 +void QueryStripComments::set(const char* query, uint query_length, uint additional_length)
259 + uint new_buffer_length = query_length + additional_length;
260 + if(new_buffer_length > buffer_length)
263 + buffer = (char*)my_malloc(new_buffer_length,MYF(0));
264 + memset(buffer,0,new_buffer_length);
266 + uint query_position = 0;
268 + // Skip whitespaces from begin
269 + while((query_position < query_length) && query_strip_comments_is_white_space(query[query_position]))
273 + long int last_space = -1;
274 + while(query_position < query_length)
276 + char current = query[query_position];
277 + bool insert_space = false; // insert space to buffer, (IMPORTANT) don't update query_position
283 + buffer[position++] = query[query_position++]; // copy current symbol
284 + while(query_position < query_length)
286 + if(current == query[query_position]) // found pair quote
290 + buffer[position++] = query[query_position++]; // copy current symbol
296 + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2]))
298 + query_position += 2; // skip "/*"
301 + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/"
303 + query_position += 2; // skip "*/"
304 + insert_space = true;
312 + while(query_position < query_length);
322 + if(query[query_position+1] == '-')
324 + ++query_position; // skip "-", and go to search of "\n"
335 + ++query_position; // skip current symbol (# or -)
336 + if('\n' == query[query_position]) // check for '\n'
338 + ++query_position; // skip '\n'
339 + insert_space = true;
343 + while(query_position < query_length);
354 + if(query_strip_comments_is_white_space(current))
356 + insert_space = true;
359 + break; // make gcc happy
363 + if((uint) (last_space + 1) != position)
365 + last_space = position;
366 + buffer[position++] = ' ';
371 + buffer[position++] = query[query_position++];
374 + while((0 < position) && query_strip_comments_is_white_space(buffer[position - 1]))
378 + buffer[position] = 0;
381 +void QueryStripComments::cleanup()
385 + my_free(buffer,MYF(0));
391 +QueryStripComments_Backup::QueryStripComments_Backup(THD* a_thd,QueryStripComments* qsc)
393 + if(opt_query_cache_strip_comments)
396 + query = thd->query();
397 + length = thd->query_length();
398 + qsc->set(query,length,thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE);
399 + thd->set_query(qsc->query(),qsc->query_length());
408 +QueryStripComments_Backup::~QueryStripComments_Backup()
412 + thd->set_query(query,length);
416 #ifdef EMBEDDED_LIBRARY
417 #include "emb_qcache.h"
419 bool interrupt= FALSE;
420 DBUG_ENTER("Query_cache::try_lock");
422 + THD *thd = current_thd;
423 + const char* old_proc_info= thd->proc_info;
424 + thd_proc_info(thd,"Waiting on query cache mutex");
425 pthread_mutex_lock(&structure_guard_mutex);
426 + DBUG_EXECUTE_IF("status_wait_query_cache_mutex_sleep", {
431 if (m_cache_lock_status == Query_cache::UNLOCKED)
435 pthread_mutex_unlock(&structure_guard_mutex);
436 + thd->proc_info = old_proc_info;
438 DBUG_RETURN(interrupt);
440 @@ -865,11 +1048,14 @@
441 DBUG_EXECUTE_IF("wait_in_query_cache_insert",
442 debug_wait_for_kill("wait_in_query_cache_insert"); );
444 + if(query_cache.is_disabled())
447 if (query_cache.try_lock())
450 Query_cache_block *query_block= (Query_cache_block*)net->query_cache_query;
452 + if (NULL == query_block)
455 We lost the writer and the currently processed query has been
457 if (net->query_cache_query == 0)
460 + if(query_cache.is_disabled())
463 if (query_cache.try_lock())
466 @@ -1056,6 +1245,7 @@
467 query_cache_limit(query_cache_limit_arg),
468 queries_in_cache(0), hits(0), inserts(0), refused(0),
469 total_blocks(0), lowmem_prunes(0),
470 + m_query_cache_is_disabled(FALSE),
471 min_allocation_unit(ALIGN_SIZE(min_allocation_unit_arg)),
472 min_result_data_size(ALIGN_SIZE(min_result_data_size_arg)),
473 def_query_hash_size(ALIGN_SIZE(def_query_hash_size_arg)),
474 @@ -1237,6 +1427,8 @@
478 + QueryStripComments *query_strip_comments = &(thd->query_strip_comments);
479 + QueryStripComments_Backup backup(thd,query_strip_comments);
481 /* Key is query + database + flag */
483 @@ -1407,6 +1599,9 @@
484 Query_cache_block_table *block_table, *block_table_end;
486 Query_cache_query_flags flags;
487 + QueryStripComments *query_strip_comments = &(thd->query_strip_comments);
488 + char *sql_backup = sql;
489 + uint query_length_backup = query_length;
490 DBUG_ENTER("Query_cache::send_result_to_client");
493 @@ -1416,8 +1611,8 @@
495 See also a note on double-check locking usage above.
497 - if (thd->locked_tables || thd->variables.query_cache_type == 0 ||
498 - query_cache_size == 0)
499 + if (is_disabled() || thd->locked_tables ||
500 + thd->variables.query_cache_type == 0 || query_cache_size == 0)
503 if (!thd->lex->safe_to_cache_query)
504 @@ -1428,6 +1623,87 @@
508 + if(opt_query_cache_strip_comments)
510 + /* Skip all comments and non-letter symbols */
511 + uint& query_position = i;
513 + while(query_position < query_length)
515 + bool check = false;
516 + char current = query[query_position];
520 + if(((query_position + 2) < query_length) && ('*' == query[query_position+1]) && ('!' != query[query_position+2]))
522 + query_position += 2; // skip "/*"
525 + if('*' == query[query_position] && '/' == query[query_position+1]) // check for "*/" (without space)
527 + query_position += 2; // skip "*/" (without space)
535 + while(query_position < query_length);
536 + continue; // analyze current symbol
540 + if(query[query_position+1] == '-')
542 + ++query_position; // skip "-"
551 + ++query_position; // skip current symbol
552 + if('\n' == query[query_position]) // check for '\n'
554 + ++query_position; // skip '\n'
558 + while(query_position < query_length);
559 + continue; // analyze current symbol
569 + break; // make gcc happy
570 + } // switch(current)
573 + if(query_position + 2 < query_length)
580 + DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
585 + } // while(query_position < query_length)
587 + else // if(opt_query_cache_strip_comments)
590 Skip '(' characters in queries like following:
591 (select a from t1) union (select a from t1);
592 @@ -1435,6 +1711,7 @@
596 + } // if(opt_query_cache_strip_comments)
598 Test if the query is a SELECT
599 (pre-space is removed in dispatch_command).
600 @@ -1451,7 +1728,6 @@
601 DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
605 if (query_length > 20 && has_no_cache_directive(&sql[i+6]))
608 @@ -1483,6 +1759,12 @@
609 DBUG_ASSERT(thd->net.query_cache_query == 0);
611 Query_cache_block *query_block;
612 + if(opt_query_cache_strip_comments)
614 + query_strip_comments->set(sql, query_length, thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE);
615 + sql = query_strip_comments->query();
616 + query_length = query_strip_comments->query_length();
619 tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
621 @@ -1549,6 +1831,8 @@
622 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
623 query_block = (Query_cache_block *) hash_search(&queries, (uchar*) sql,
626 + query_length = query_length_backup;
627 /* Quick abort on unlocked data */
628 if (query_block == 0 ||
629 query_block->query()->result() == 0 ||
630 @@ -1729,6 +2013,8 @@
631 my_bool using_transactions)
633 DBUG_ENTER("Query_cache::invalidate (table list)");
637 using_transactions= using_transactions &&
638 (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
639 @@ -1759,6 +2045,9 @@
640 void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
642 DBUG_ENTER("Query_cache::invalidate (changed table list)");
646 THD *thd= current_thd;
647 for (; tables_used; tables_used= tables_used->next)
649 @@ -1784,8 +2073,11 @@
651 void Query_cache::invalidate_locked_for_write(TABLE_LIST *tables_used)
653 - THD *thd= current_thd;
654 DBUG_ENTER("Query_cache::invalidate_locked_for_write");
658 + THD *thd= current_thd;
659 for (; tables_used; tables_used= tables_used->next_local)
661 thd_proc_info(thd, "invalidating query cache entries (table)");
662 @@ -1806,6 +2098,8 @@
663 my_bool using_transactions)
665 DBUG_ENTER("Query_cache::invalidate (table)");
669 using_transactions= using_transactions &&
670 (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
671 @@ -1823,6 +2117,8 @@
672 my_bool using_transactions)
674 DBUG_ENTER("Query_cache::invalidate (key)");
678 using_transactions= using_transactions &&
679 (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
680 @@ -1841,9 +2137,11 @@
682 void Query_cache::invalidate(char *db)
684 - bool restart= FALSE;
685 - DBUG_ENTER("Query_cache::invalidate (db)");
687 + DBUG_ENTER("Query_cache::invalidate (db)");
690 + bool restart= FALSE;
692 Lock the query cache and queue all invalidation attempts to avoid
693 the risk of a race between invalidation, cache inserts and flushes.
694 @@ -1928,6 +2226,9 @@
695 void Query_cache::flush()
697 DBUG_ENTER("Query_cache::flush");
701 DBUG_EXECUTE_IF("wait_in_query_cache_flush1",
702 debug_wait_for_kill("wait_in_query_cache_flush1"););
704 @@ -1959,6 +2260,9 @@
706 DBUG_ENTER("Query_cache::pack");
712 If the entire qc is being invalidated we can bail out early
713 instead of waiting for the lock.
714 @@ -2016,6 +2320,15 @@
715 pthread_cond_init(&COND_cache_status_changed, NULL);
716 m_cache_lock_status= Query_cache::UNLOCKED;
719 + If we explicitly turn off query cache from the command line query cache will
720 + be disabled for the reminder of the server life time. This is because we
721 + want to avoid locking the QC specific mutex if query cache isn't going to
724 + if (global_system_variables.query_cache_type == 0)
725 + query_cache.disable_query_cache();
730 @@ -4719,3 +5032,4 @@
731 #endif /* DBUG_OFF */
733 #endif /*HAVE_QUERY_CACHE*/
735 --- a/sql/sql_class.h
736 +++ b/sql/sql_class.h
740 #include "rpl_tblmap.h"
742 +#ifdef HAVE_QUERY_CACHE
743 +#include "query_strip_comments.h"
744 +#endif // HAVE_QUERY_CACHE
746 An interface that is used to take an action when
747 the locking module notices that a table version has changed
750 LEX_STRING query_string;
751 Server_side_cursor *cursor;
752 +#ifdef HAVE_QUERY_CACHE
753 + QueryStripComments query_strip_comments; // see sql_cache.cc
754 +#endif //HAVE_QUERY_CACHE
756 inline char *query() { return query_string.str; }
757 inline uint32 query_length() { return query_string.length; }
759 +++ b/mysql-test/r/query_cache_disabled.result
761 +SHOW GLOBAL VARIABLES LIKE 'query_cache_type';
763 +query_cache_type OFF
764 +SET GLOBAL query_cache_type=ON;
765 +ERROR HY000: Query cache is disabled; restart the server with query_cache_type=1 to enable it
766 +SET GLOBAL query_cache_type=DEMAND;
767 +ERROR HY000: Query cache is disabled; restart the server with query_cache_type=1 to enable it
768 +SET GLOBAL query_cache_type=OFF;
769 +ERROR HY000: Query cache is disabled; restart the server with query_cache_type=1 to enable it
770 +SET GLOBAL query_cache_size=1024*1024;
771 +SHOW GLOBAL VARIABLES LIKE 'query_cache_size';
773 +query_cache_size 1048576
774 +SET GLOBAL query_cache_size=0;
776 +++ b/mysql-test/t/query_cache_disabled-master.opt
778 +--query_cache_type=0
780 +++ b/mysql-test/t/query_cache_disabled.test
782 +-- source include/have_query_cache.inc
784 +# Bug#38551 query cache can still consume [very little] cpu time even when it is off.
786 +SHOW GLOBAL VARIABLES LIKE 'query_cache_type';
787 +--error ER_QUERY_CACHE_DISABLED
788 +SET GLOBAL query_cache_type=ON;
789 +--error ER_QUERY_CACHE_DISABLED
790 +SET GLOBAL query_cache_type=DEMAND;
791 +--error ER_QUERY_CACHE_DISABLED
792 +SET GLOBAL query_cache_type=OFF;
793 +SET GLOBAL query_cache_size=1024*1024;
794 +SHOW GLOBAL VARIABLES LIKE 'query_cache_size';
795 +SET GLOBAL query_cache_size=0;
799 @@ -521,10 +521,16 @@
800 { chain_sys_var(chain); }
801 bool check(THD *thd, set_var *var)
805 - ret= (*check_func)(thd, var);
806 - return ret ? ret : check_enum(thd, var, enum_names);
808 + check_enum fails if the character representation supplied was wrong
809 + or that the integer value was wrong or missing.
811 + if (check_enum(thd, var, enum_names))
813 + else if ((check_func && (*check_func)(thd, var)))
818 bool update(THD *thd, set_var *var);
819 void set_default(THD *thd, enum_var_type type);
820 --- a/sql/share/errmsg.txt
821 +++ b/sql/share/errmsg.txt
822 @@ -6213,3 +6213,8 @@
823 ER_DEBUG_SYNC_HIT_LIMIT
824 eng "debug sync point hit limit reached"
825 ger "Debug Sync Point Hit Limit erreicht"
826 +PADD_QUERY_CACHE_DISABLED 1651
827 + eng "ER_QUERY_CACHE_DISABLED padding to 1651 error"
828 +ER_QUERY_CACHE_DISABLED
829 + eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it"
831 --- a/sql/sql_cache.h
832 +++ b/sql/sql_cache.h
834 enum Cache_lock_status { UNLOCKED, LOCKED_NO_WAIT, LOCKED };
835 Cache_lock_status m_cache_lock_status;
837 + bool m_query_cache_is_disabled;
839 void free_query_internal(Query_cache_block *point);
840 void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
841 + void disable_query_cache(void) { m_query_cache_is_disabled= TRUE; }
846 uint def_query_hash_size = QUERY_CACHE_DEF_QUERY_HASH_SIZE,
847 uint def_table_hash_size = QUERY_CACHE_DEF_TABLE_HASH_SIZE);
849 + bool is_disabled(void) { return m_query_cache_is_disabled; }
851 /* initialize cache (mutex) */
853 /* resize query cache (return real query size, 0 if disabled) */
855 +++ b/mysql-test/include/percona_query_cache_with_comments.inc
857 +--source include/percona_query_cache_with_comments_clear.inc
858 +let $query=/* with comment first */select * from t1;
860 +--source include/percona_query_cache_with_comments_eval.inc
862 +let $query=# with comment first
864 +--source include/percona_query_cache_with_comments_eval.inc
866 +let $query=-- with comment first
868 +--source include/percona_query_cache_with_comments_eval.inc
870 +let $query=/* with comment first and "quote" */select * from t1;
871 +--source include/percona_query_cache_with_comments_eval.inc
873 +let $query=# with comment first and "quote"
875 +--source include/percona_query_cache_with_comments_eval.inc
877 +let $query=-- with comment first and "quote"
879 +--source include/percona_query_cache_with_comments_eval.inc
882 + /* with comment and whitespaces first */select * from t1;
883 +--source include/percona_query_cache_with_comments_eval.inc
886 + # with comment and whitespaces first
888 +--source include/percona_query_cache_with_comments_eval.inc
891 + -- with comment and whitespaces first
893 +--source include/percona_query_cache_with_comments_eval.inc
895 +let $internal=* internal comment *;
897 +let $query=select * /$internal/ from t1;
898 +--source include/percona_query_cache_with_comments_eval.inc
899 +let $query=select */$internal/ from t1;
900 +--source include/percona_query_cache_with_comments_eval.inc
901 +let $query=select */$internal/from t1;
902 +--source include/percona_query_cache_with_comments_eval.inc
904 +let $internal=* internal comment with "quote" *;
906 +let $query=select * /$internal/ from t1;
907 +--source include/percona_query_cache_with_comments_eval.inc
908 +let $query=select */$internal/ from t1;
909 +--source include/percona_query_cache_with_comments_eval.inc
910 +let $query=select */$internal/from t1;
911 +--source include/percona_query_cache_with_comments_eval.inc
913 +let $query=select * from t1
915 +--source include/percona_query_cache_with_comments_eval.inc
917 +let $query=select * from t1 ;
918 +--source include/percona_query_cache_with_comments_eval.inc
920 +let $query=select * from t1 ;
921 +--source include/percona_query_cache_with_comments_eval.inc
923 +let $query=select * from t1
924 +/* comment in the end */;
925 +--source include/percona_query_cache_with_comments_eval.inc
927 +let $query=select * from t1
929 +--source include/percona_query_cache_with_comments_eval.inc
931 +let $query=select * from t1
932 +/* comment in the end */
934 +--source include/percona_query_cache_with_comments_eval.inc
936 +let $query=select * from t1 #comment in the end;
937 +--source include/percona_query_cache_with_comments_eval.inc
939 +let $query=select * from t1 #comment in the end
941 +--source include/percona_query_cache_with_comments_eval.inc
943 +let $query=select * from t1 -- comment in the end;
944 +--source include/percona_query_cache_with_comments_eval.inc
946 +let $query=select * from t1 -- comment in the end
948 +--source include/percona_query_cache_with_comments_eval.inc
950 +let $query=select ' \' ' from t1;
951 +--source include/percona_query_cache_with_comments_eval.inc
953 +++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc
955 +-- source include/have_query_cache.inc
957 +set GLOBAL query_cache_size=1355776;
960 +drop table if exists t1;
963 +create table t1 (a int not null);
964 +insert into t1 values (1),(2),(3);
966 +--source include/percona_query_cache_with_comments_clear.inc
968 +++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc
970 +# Reset query cache variables.
971 +flush query cache; # This crashed in some versions
972 +flush query cache; # This crashed in some versions
976 +++ b/mysql-test/include/percona_query_cache_with_comments_end.inc
979 +SET GLOBAL query_cache_size=default;
980 +set global query_cache_strip_comments=OFF;
982 +++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc
984 +echo -----------------------------------------------------;
986 +echo -----------------------------------------------------;
987 +--source include/percona_query_cache_with_comments_show.inc
990 +--source include/percona_query_cache_with_comments_show.inc
992 +++ b/mysql-test/include/percona_query_cache_with_comments_show.inc
994 +let $show=show status like "Qcache_queries_in_cache";
996 +let $show=show status like "Qcache_inserts";
998 +let $show=show status like "Qcache_hits";
1003 +++ b/mysql-test/r/percona_query_cache_with_comments.result
1005 +set global query_cache_strip_comments=ON;
1006 +set GLOBAL query_cache_size=1355776;
1007 +drop table if exists t1;
1008 +create table t1 (a int not null);
1009 +insert into t1 values (1),(2),(3);
1018 +/* with comment first */select * from t1;
1023 +-----------------------------------------------------
1024 +/* with comment first */select * from t1
1025 +-----------------------------------------------------
1026 +show status like "Qcache_queries_in_cache";
1027 +Variable_name Value
1028 +Qcache_queries_in_cache 1
1029 +show status like "Qcache_inserts";
1030 +Variable_name Value
1032 +show status like "Qcache_hits";
1033 +Variable_name Value
1035 +/* with comment first */select * from t1;
1040 +/* with comment first */select * from t1;
1045 +show status like "Qcache_queries_in_cache";
1046 +Variable_name Value
1047 +Qcache_queries_in_cache 1
1048 +show status like "Qcache_inserts";
1049 +Variable_name Value
1051 +show status like "Qcache_hits";
1052 +Variable_name Value
1054 +-----------------------------------------------------
1055 +# with comment first
1057 +-----------------------------------------------------
1058 +show status like "Qcache_queries_in_cache";
1059 +Variable_name Value
1060 +Qcache_queries_in_cache 1
1061 +show status like "Qcache_inserts";
1062 +Variable_name Value
1064 +show status like "Qcache_hits";
1065 +Variable_name Value
1067 +# with comment first
1073 +# with comment first
1079 +show status like "Qcache_queries_in_cache";
1080 +Variable_name Value
1081 +Qcache_queries_in_cache 1
1082 +show status like "Qcache_inserts";
1083 +Variable_name Value
1085 +show status like "Qcache_hits";
1086 +Variable_name Value
1088 +-----------------------------------------------------
1089 +-- with comment first
1091 +-----------------------------------------------------
1092 +show status like "Qcache_queries_in_cache";
1093 +Variable_name Value
1094 +Qcache_queries_in_cache 1
1095 +show status like "Qcache_inserts";
1096 +Variable_name Value
1098 +show status like "Qcache_hits";
1099 +Variable_name Value
1101 +-- with comment first
1107 +-- with comment first
1113 +show status like "Qcache_queries_in_cache";
1114 +Variable_name Value
1115 +Qcache_queries_in_cache 1
1116 +show status like "Qcache_inserts";
1117 +Variable_name Value
1119 +show status like "Qcache_hits";
1120 +Variable_name Value
1122 +-----------------------------------------------------
1123 +/* with comment first and "quote" */select * from t1
1124 +-----------------------------------------------------
1125 +show status like "Qcache_queries_in_cache";
1126 +Variable_name Value
1127 +Qcache_queries_in_cache 1
1128 +show status like "Qcache_inserts";
1129 +Variable_name Value
1131 +show status like "Qcache_hits";
1132 +Variable_name Value
1134 +/* with comment first and "quote" */select * from t1;
1139 +/* with comment first and "quote" */select * from t1;
1144 +show status like "Qcache_queries_in_cache";
1145 +Variable_name Value
1146 +Qcache_queries_in_cache 1
1147 +show status like "Qcache_inserts";
1148 +Variable_name Value
1150 +show status like "Qcache_hits";
1151 +Variable_name Value
1153 +-----------------------------------------------------
1154 +# with comment first and "quote"
1156 +-----------------------------------------------------
1157 +show status like "Qcache_queries_in_cache";
1158 +Variable_name Value
1159 +Qcache_queries_in_cache 1
1160 +show status like "Qcache_inserts";
1161 +Variable_name Value
1163 +show status like "Qcache_hits";
1164 +Variable_name Value
1166 +# with comment first and "quote"
1172 +# with comment first and "quote"
1178 +show status like "Qcache_queries_in_cache";
1179 +Variable_name Value
1180 +Qcache_queries_in_cache 1
1181 +show status like "Qcache_inserts";
1182 +Variable_name Value
1184 +show status like "Qcache_hits";
1185 +Variable_name Value
1187 +-----------------------------------------------------
1188 +-- with comment first and "quote"
1190 +-----------------------------------------------------
1191 +show status like "Qcache_queries_in_cache";
1192 +Variable_name Value
1193 +Qcache_queries_in_cache 1
1194 +show status like "Qcache_inserts";
1195 +Variable_name Value
1197 +show status like "Qcache_hits";
1198 +Variable_name Value
1200 +-- with comment first and "quote"
1206 +-- with comment first and "quote"
1212 +show status like "Qcache_queries_in_cache";
1213 +Variable_name Value
1214 +Qcache_queries_in_cache 1
1215 +show status like "Qcache_inserts";
1216 +Variable_name Value
1218 +show status like "Qcache_hits";
1219 +Variable_name Value
1221 +-----------------------------------------------------
1222 +/* with comment and whitespaces first */select * from t1
1223 +-----------------------------------------------------
1224 +show status like "Qcache_queries_in_cache";
1225 +Variable_name Value
1226 +Qcache_queries_in_cache 1
1227 +show status like "Qcache_inserts";
1228 +Variable_name Value
1230 +show status like "Qcache_hits";
1231 +Variable_name Value
1233 +/* with comment and whitespaces first */select * from t1;
1238 +/* with comment and whitespaces first */select * from t1;
1243 +show status like "Qcache_queries_in_cache";
1244 +Variable_name Value
1245 +Qcache_queries_in_cache 1
1246 +show status like "Qcache_inserts";
1247 +Variable_name Value
1249 +show status like "Qcache_hits";
1250 +Variable_name Value
1252 +-----------------------------------------------------
1253 +# with comment and whitespaces first
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 +# with comment and whitespaces first
1271 +# with comment and whitespaces first
1277 +show status like "Qcache_queries_in_cache";
1278 +Variable_name Value
1279 +Qcache_queries_in_cache 1
1280 +show status like "Qcache_inserts";
1281 +Variable_name Value
1283 +show status like "Qcache_hits";
1284 +Variable_name Value
1286 +-----------------------------------------------------
1287 +-- with comment and whitespaces first
1289 +-----------------------------------------------------
1290 +show status like "Qcache_queries_in_cache";
1291 +Variable_name Value
1292 +Qcache_queries_in_cache 1
1293 +show status like "Qcache_inserts";
1294 +Variable_name Value
1296 +show status like "Qcache_hits";
1297 +Variable_name Value
1299 +-- with comment and whitespaces first
1305 +-- with comment and whitespaces first
1311 +show status like "Qcache_queries_in_cache";
1312 +Variable_name Value
1313 +Qcache_queries_in_cache 1
1314 +show status like "Qcache_inserts";
1315 +Variable_name Value
1317 +show status like "Qcache_hits";
1318 +Variable_name Value
1320 +-----------------------------------------------------
1321 +select * /* internal comment */ from t1
1322 +-----------------------------------------------------
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 +select * /* internal comment */ from t1;
1337 +select * /* internal comment */ from t1;
1342 +show status like "Qcache_queries_in_cache";
1343 +Variable_name Value
1344 +Qcache_queries_in_cache 1
1345 +show status like "Qcache_inserts";
1346 +Variable_name Value
1348 +show status like "Qcache_hits";
1349 +Variable_name Value
1351 +-----------------------------------------------------
1352 +select */* internal comment */ from t1
1353 +-----------------------------------------------------
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 +select */* internal comment */ from t1;
1368 +select */* internal comment */ from t1;
1373 +show status like "Qcache_queries_in_cache";
1374 +Variable_name Value
1375 +Qcache_queries_in_cache 1
1376 +show status like "Qcache_inserts";
1377 +Variable_name Value
1379 +show status like "Qcache_hits";
1380 +Variable_name Value
1382 +-----------------------------------------------------
1383 +select */* internal comment */from t1
1384 +-----------------------------------------------------
1385 +show status like "Qcache_queries_in_cache";
1386 +Variable_name Value
1387 +Qcache_queries_in_cache 1
1388 +show status like "Qcache_inserts";
1389 +Variable_name Value
1391 +show status like "Qcache_hits";
1392 +Variable_name Value
1394 +select */* internal comment */from t1;
1399 +select */* internal comment */from t1;
1404 +show status like "Qcache_queries_in_cache";
1405 +Variable_name Value
1406 +Qcache_queries_in_cache 1
1407 +show status like "Qcache_inserts";
1408 +Variable_name Value
1410 +show status like "Qcache_hits";
1411 +Variable_name Value
1413 +-----------------------------------------------------
1414 +select * /* internal comment with "quote" */ from t1
1415 +-----------------------------------------------------
1416 +show status like "Qcache_queries_in_cache";
1417 +Variable_name Value
1418 +Qcache_queries_in_cache 1
1419 +show status like "Qcache_inserts";
1420 +Variable_name Value
1422 +show status like "Qcache_hits";
1423 +Variable_name Value
1425 +select * /* internal comment with "quote" */ from t1;
1430 +select * /* internal comment with "quote" */ from t1;
1435 +show status like "Qcache_queries_in_cache";
1436 +Variable_name Value
1437 +Qcache_queries_in_cache 1
1438 +show status like "Qcache_inserts";
1439 +Variable_name Value
1441 +show status like "Qcache_hits";
1442 +Variable_name Value
1444 +-----------------------------------------------------
1445 +select */* internal comment with "quote" */ from t1
1446 +-----------------------------------------------------
1447 +show status like "Qcache_queries_in_cache";
1448 +Variable_name Value
1449 +Qcache_queries_in_cache 1
1450 +show status like "Qcache_inserts";
1451 +Variable_name Value
1453 +show status like "Qcache_hits";
1454 +Variable_name Value
1456 +select */* internal comment with "quote" */ from t1;
1461 +select */* internal comment with "quote" */ from t1;
1466 +show status like "Qcache_queries_in_cache";
1467 +Variable_name Value
1468 +Qcache_queries_in_cache 1
1469 +show status like "Qcache_inserts";
1470 +Variable_name Value
1472 +show status like "Qcache_hits";
1473 +Variable_name Value
1475 +-----------------------------------------------------
1476 +select */* internal comment with "quote" */from t1
1477 +-----------------------------------------------------
1478 +show status like "Qcache_queries_in_cache";
1479 +Variable_name Value
1480 +Qcache_queries_in_cache 1
1481 +show status like "Qcache_inserts";
1482 +Variable_name Value
1484 +show status like "Qcache_hits";
1485 +Variable_name Value
1487 +select */* internal comment with "quote" */from t1;
1492 +select */* internal comment with "quote" */from t1;
1497 +show status like "Qcache_queries_in_cache";
1498 +Variable_name Value
1499 +Qcache_queries_in_cache 1
1500 +show status like "Qcache_inserts";
1501 +Variable_name Value
1503 +show status like "Qcache_hits";
1504 +Variable_name Value
1506 +-----------------------------------------------------
1509 +-----------------------------------------------------
1510 +show status like "Qcache_queries_in_cache";
1511 +Variable_name Value
1512 +Qcache_queries_in_cache 1
1513 +show status like "Qcache_inserts";
1514 +Variable_name Value
1516 +show status like "Qcache_hits";
1517 +Variable_name Value
1531 +show status like "Qcache_queries_in_cache";
1532 +Variable_name Value
1533 +Qcache_queries_in_cache 1
1534 +show status like "Qcache_inserts";
1535 +Variable_name Value
1537 +show status like "Qcache_hits";
1538 +Variable_name Value
1540 +-----------------------------------------------------
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
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 +-----------------------------------------------------
1573 +-----------------------------------------------------
1574 +show status like "Qcache_queries_in_cache";
1575 +Variable_name Value
1576 +Qcache_queries_in_cache 1
1577 +show status like "Qcache_inserts";
1578 +Variable_name Value
1580 +show status like "Qcache_hits";
1581 +Variable_name Value
1593 +show status like "Qcache_queries_in_cache";
1594 +Variable_name Value
1595 +Qcache_queries_in_cache 1
1596 +show status like "Qcache_inserts";
1597 +Variable_name Value
1599 +show status like "Qcache_hits";
1600 +Variable_name Value
1602 +-----------------------------------------------------
1604 +/* comment in the end */
1605 +-----------------------------------------------------
1606 +show status like "Qcache_queries_in_cache";
1607 +Variable_name Value
1608 +Qcache_queries_in_cache 1
1609 +show status like "Qcache_inserts";
1610 +Variable_name Value
1612 +show status like "Qcache_hits";
1613 +Variable_name Value
1616 +/* comment in the end */;
1622 +/* comment in the end */;
1627 +show status like "Qcache_queries_in_cache";
1628 +Variable_name Value
1629 +Qcache_queries_in_cache 1
1630 +show status like "Qcache_inserts";
1631 +Variable_name Value
1633 +show status like "Qcache_hits";
1634 +Variable_name Value
1636 +-----------------------------------------------------
1639 +-----------------------------------------------------
1640 +show status like "Qcache_queries_in_cache";
1641 +Variable_name Value
1642 +Qcache_queries_in_cache 1
1643 +show status like "Qcache_inserts";
1644 +Variable_name Value
1646 +show status like "Qcache_hits";
1647 +Variable_name Value
1661 +show status like "Qcache_queries_in_cache";
1662 +Variable_name Value
1663 +Qcache_queries_in_cache 1
1664 +show status like "Qcache_inserts";
1665 +Variable_name Value
1667 +show status like "Qcache_hits";
1668 +Variable_name Value
1670 +-----------------------------------------------------
1672 +/* comment in the end */
1674 +-----------------------------------------------------
1675 +show status like "Qcache_queries_in_cache";
1676 +Variable_name Value
1677 +Qcache_queries_in_cache 1
1678 +show status like "Qcache_inserts";
1679 +Variable_name Value
1681 +show status like "Qcache_hits";
1682 +Variable_name Value
1685 +/* comment in the end */
1692 +/* comment in the end */
1698 +show status like "Qcache_queries_in_cache";
1699 +Variable_name Value
1700 +Qcache_queries_in_cache 1
1701 +show status like "Qcache_inserts";
1702 +Variable_name Value
1704 +show status like "Qcache_hits";
1705 +Variable_name Value
1707 +-----------------------------------------------------
1708 +select * from t1 #comment in the end
1709 +-----------------------------------------------------
1710 +show status like "Qcache_queries_in_cache";
1711 +Variable_name Value
1712 +Qcache_queries_in_cache 1
1713 +show status like "Qcache_inserts";
1714 +Variable_name Value
1716 +show status like "Qcache_hits";
1717 +Variable_name Value
1719 +select * from t1 #comment in the end;
1724 +select * from t1 #comment in the end;
1729 +show status like "Qcache_queries_in_cache";
1730 +Variable_name Value
1731 +Qcache_queries_in_cache 1
1732 +show status like "Qcache_inserts";
1733 +Variable_name Value
1735 +show status like "Qcache_hits";
1736 +Variable_name Value
1738 +-----------------------------------------------------
1739 +select * from t1 #comment in the end
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 * from t1 #comment in the end
1757 +select * from t1 #comment in the end
1763 +show status like "Qcache_queries_in_cache";
1764 +Variable_name Value
1765 +Qcache_queries_in_cache 1
1766 +show status like "Qcache_inserts";
1767 +Variable_name Value
1769 +show status like "Qcache_hits";
1770 +Variable_name Value
1772 +-----------------------------------------------------
1773 +select * from t1 -- comment in the end
1774 +-----------------------------------------------------
1775 +show status like "Qcache_queries_in_cache";
1776 +Variable_name Value
1777 +Qcache_queries_in_cache 1
1778 +show status like "Qcache_inserts";
1779 +Variable_name Value
1781 +show status like "Qcache_hits";
1782 +Variable_name Value
1784 +select * from t1 -- comment in the end;
1789 +select * from t1 -- comment in the end;
1794 +show status like "Qcache_queries_in_cache";
1795 +Variable_name Value
1796 +Qcache_queries_in_cache 1
1797 +show status like "Qcache_inserts";
1798 +Variable_name Value
1800 +show status like "Qcache_hits";
1801 +Variable_name Value
1803 +-----------------------------------------------------
1804 +select * from t1 -- comment in the end
1806 +-----------------------------------------------------
1807 +show status like "Qcache_queries_in_cache";
1808 +Variable_name Value
1809 +Qcache_queries_in_cache 1
1810 +show status like "Qcache_inserts";
1811 +Variable_name Value
1813 +show status like "Qcache_hits";
1814 +Variable_name Value
1816 +select * from t1 -- comment in the end
1822 +select * from t1 -- comment in the end
1828 +show status like "Qcache_queries_in_cache";
1829 +Variable_name Value
1830 +Qcache_queries_in_cache 1
1831 +show status like "Qcache_inserts";
1832 +Variable_name Value
1834 +show status like "Qcache_hits";
1835 +Variable_name Value
1837 +-----------------------------------------------------
1838 +select ' \' ' from t1
1839 +-----------------------------------------------------
1840 +show status like "Qcache_queries_in_cache";
1841 +Variable_name Value
1842 +Qcache_queries_in_cache 1
1843 +show status like "Qcache_inserts";
1844 +Variable_name Value
1846 +show status like "Qcache_hits";
1847 +Variable_name Value
1849 +select ' \' ' from t1;
1854 +select ' \' ' from t1;
1859 +show status like "Qcache_queries_in_cache";
1860 +Variable_name Value
1861 +Qcache_queries_in_cache 2
1862 +show status like "Qcache_inserts";
1863 +Variable_name Value
1865 +show status like "Qcache_hits";
1866 +Variable_name Value
1869 +SET GLOBAL query_cache_size=default;
1870 +set global query_cache_strip_comments=OFF;
1872 +++ b/mysql-test/r/percona_query_cache_with_comments_crash.result
1874 +set GLOBAL query_cache_size=1355776;
1875 +drop table if exists t1;
1876 +create table t1 (a int not null);
1877 +insert into t1 values (1),(2),(3);
1882 +( select * from t1 );
1887 +/*!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 */;
1888 +/* only comment */;
1894 +SET GLOBAL query_cache_size= default;
1896 +++ b/mysql-test/r/percona_query_cache_with_comments_disable.result
1898 +set GLOBAL query_cache_size=1355776;
1899 +drop table if exists t1;
1900 +create table t1 (a int not null);
1901 +insert into t1 values (1),(2),(3);
1910 +/* with comment first */select * from t1;
1915 +-----------------------------------------------------
1916 +/* with comment first */select * from t1
1917 +-----------------------------------------------------
1918 +show status like "Qcache_queries_in_cache";
1919 +Variable_name Value
1920 +Qcache_queries_in_cache 1
1921 +show status like "Qcache_inserts";
1922 +Variable_name Value
1924 +show status like "Qcache_hits";
1925 +Variable_name Value
1927 +/* with comment first */select * from t1;
1932 +/* with comment first */select * from t1;
1937 +show status like "Qcache_queries_in_cache";
1938 +Variable_name Value
1939 +Qcache_queries_in_cache 1
1940 +show status like "Qcache_inserts";
1941 +Variable_name Value
1943 +show status like "Qcache_hits";
1944 +Variable_name Value
1946 +-----------------------------------------------------
1947 +# with comment first
1949 +-----------------------------------------------------
1950 +show status like "Qcache_queries_in_cache";
1951 +Variable_name Value
1952 +Qcache_queries_in_cache 1
1953 +show status like "Qcache_inserts";
1954 +Variable_name Value
1956 +show status like "Qcache_hits";
1957 +Variable_name Value
1959 +# with comment first
1965 +# with comment first
1971 +show status like "Qcache_queries_in_cache";
1972 +Variable_name Value
1973 +Qcache_queries_in_cache 2
1974 +show status like "Qcache_inserts";
1975 +Variable_name Value
1977 +show status like "Qcache_hits";
1978 +Variable_name Value
1980 +-----------------------------------------------------
1981 +-- with comment first
1983 +-----------------------------------------------------
1984 +show status like "Qcache_queries_in_cache";
1985 +Variable_name Value
1986 +Qcache_queries_in_cache 2
1987 +show status like "Qcache_inserts";
1988 +Variable_name Value
1990 +show status like "Qcache_hits";
1991 +Variable_name Value
1993 +-- with comment first
1999 +-- with comment first
2005 +show status like "Qcache_queries_in_cache";
2006 +Variable_name Value
2007 +Qcache_queries_in_cache 3
2008 +show status like "Qcache_inserts";
2009 +Variable_name Value
2011 +show status like "Qcache_hits";
2012 +Variable_name Value
2014 +-----------------------------------------------------
2015 +/* with comment first and "quote" */select * from t1
2016 +-----------------------------------------------------
2017 +show status like "Qcache_queries_in_cache";
2018 +Variable_name Value
2019 +Qcache_queries_in_cache 3
2020 +show status like "Qcache_inserts";
2021 +Variable_name Value
2023 +show status like "Qcache_hits";
2024 +Variable_name Value
2026 +/* with comment first and "quote" */select * from t1;
2031 +/* with comment first and "quote" */select * from t1;
2036 +show status like "Qcache_queries_in_cache";
2037 +Variable_name Value
2038 +Qcache_queries_in_cache 4
2039 +show status like "Qcache_inserts";
2040 +Variable_name Value
2042 +show status like "Qcache_hits";
2043 +Variable_name Value
2045 +-----------------------------------------------------
2046 +# with comment first and "quote"
2048 +-----------------------------------------------------
2049 +show status like "Qcache_queries_in_cache";
2050 +Variable_name Value
2051 +Qcache_queries_in_cache 4
2052 +show status like "Qcache_inserts";
2053 +Variable_name Value
2055 +show status like "Qcache_hits";
2056 +Variable_name Value
2058 +# with comment first and "quote"
2064 +# with comment first and "quote"
2070 +show status like "Qcache_queries_in_cache";
2071 +Variable_name Value
2072 +Qcache_queries_in_cache 5
2073 +show status like "Qcache_inserts";
2074 +Variable_name Value
2076 +show status like "Qcache_hits";
2077 +Variable_name Value
2079 +-----------------------------------------------------
2080 +-- with comment first and "quote"
2082 +-----------------------------------------------------
2083 +show status like "Qcache_queries_in_cache";
2084 +Variable_name Value
2085 +Qcache_queries_in_cache 5
2086 +show status like "Qcache_inserts";
2087 +Variable_name Value
2089 +show status like "Qcache_hits";
2090 +Variable_name Value
2092 +-- with comment first and "quote"
2098 +-- with comment first and "quote"
2104 +show status like "Qcache_queries_in_cache";
2105 +Variable_name Value
2106 +Qcache_queries_in_cache 6
2107 +show status like "Qcache_inserts";
2108 +Variable_name Value
2110 +show status like "Qcache_hits";
2111 +Variable_name Value
2113 +-----------------------------------------------------
2114 +/* with comment and whitespaces first */select * from t1
2115 +-----------------------------------------------------
2116 +show status like "Qcache_queries_in_cache";
2117 +Variable_name Value
2118 +Qcache_queries_in_cache 6
2119 +show status like "Qcache_inserts";
2120 +Variable_name Value
2122 +show status like "Qcache_hits";
2123 +Variable_name Value
2125 +/* with comment and whitespaces first */select * from t1;
2130 +/* with comment and whitespaces first */select * from t1;
2135 +show status like "Qcache_queries_in_cache";
2136 +Variable_name Value
2137 +Qcache_queries_in_cache 7
2138 +show status like "Qcache_inserts";
2139 +Variable_name Value
2141 +show status like "Qcache_hits";
2142 +Variable_name Value
2144 +-----------------------------------------------------
2145 +# with comment and whitespaces first
2147 +-----------------------------------------------------
2148 +show status like "Qcache_queries_in_cache";
2149 +Variable_name Value
2150 +Qcache_queries_in_cache 7
2151 +show status like "Qcache_inserts";
2152 +Variable_name Value
2154 +show status like "Qcache_hits";
2155 +Variable_name Value
2157 +# with comment and whitespaces first
2163 +# with comment and whitespaces first
2169 +show status like "Qcache_queries_in_cache";
2170 +Variable_name Value
2171 +Qcache_queries_in_cache 8
2172 +show status like "Qcache_inserts";
2173 +Variable_name Value
2175 +show status like "Qcache_hits";
2176 +Variable_name Value
2178 +-----------------------------------------------------
2179 +-- with comment and whitespaces first
2181 +-----------------------------------------------------
2182 +show status like "Qcache_queries_in_cache";
2183 +Variable_name Value
2184 +Qcache_queries_in_cache 8
2185 +show status like "Qcache_inserts";
2186 +Variable_name Value
2188 +show status like "Qcache_hits";
2189 +Variable_name Value
2191 +-- with comment and whitespaces first
2197 +-- with comment and whitespaces first
2203 +show status like "Qcache_queries_in_cache";
2204 +Variable_name Value
2205 +Qcache_queries_in_cache 9
2206 +show status like "Qcache_inserts";
2207 +Variable_name Value
2209 +show status like "Qcache_hits";
2210 +Variable_name Value
2212 +-----------------------------------------------------
2213 +select * /* internal comment */ from t1
2214 +-----------------------------------------------------
2215 +show status like "Qcache_queries_in_cache";
2216 +Variable_name Value
2217 +Qcache_queries_in_cache 9
2218 +show status like "Qcache_inserts";
2219 +Variable_name Value
2221 +show status like "Qcache_hits";
2222 +Variable_name Value
2224 +select * /* internal comment */ from t1;
2229 +select * /* internal comment */ from t1;
2234 +show status like "Qcache_queries_in_cache";
2235 +Variable_name Value
2236 +Qcache_queries_in_cache 10
2237 +show status like "Qcache_inserts";
2238 +Variable_name Value
2240 +show status like "Qcache_hits";
2241 +Variable_name Value
2243 +-----------------------------------------------------
2244 +select */* internal comment */ from t1
2245 +-----------------------------------------------------
2246 +show status like "Qcache_queries_in_cache";
2247 +Variable_name Value
2248 +Qcache_queries_in_cache 10
2249 +show status like "Qcache_inserts";
2250 +Variable_name Value
2252 +show status like "Qcache_hits";
2253 +Variable_name Value
2255 +select */* internal comment */ from t1;
2260 +select */* internal comment */ from t1;
2265 +show status like "Qcache_queries_in_cache";
2266 +Variable_name Value
2267 +Qcache_queries_in_cache 11
2268 +show status like "Qcache_inserts";
2269 +Variable_name Value
2271 +show status like "Qcache_hits";
2272 +Variable_name Value
2274 +-----------------------------------------------------
2275 +select */* internal comment */from t1
2276 +-----------------------------------------------------
2277 +show status like "Qcache_queries_in_cache";
2278 +Variable_name Value
2279 +Qcache_queries_in_cache 11
2280 +show status like "Qcache_inserts";
2281 +Variable_name Value
2283 +show status like "Qcache_hits";
2284 +Variable_name Value
2286 +select */* internal comment */from t1;
2291 +select */* internal comment */from t1;
2296 +show status like "Qcache_queries_in_cache";
2297 +Variable_name Value
2298 +Qcache_queries_in_cache 12
2299 +show status like "Qcache_inserts";
2300 +Variable_name Value
2302 +show status like "Qcache_hits";
2303 +Variable_name Value
2305 +-----------------------------------------------------
2306 +select * /* internal comment with "quote" */ from t1
2307 +-----------------------------------------------------
2308 +show status like "Qcache_queries_in_cache";
2309 +Variable_name Value
2310 +Qcache_queries_in_cache 12
2311 +show status like "Qcache_inserts";
2312 +Variable_name Value
2314 +show status like "Qcache_hits";
2315 +Variable_name Value
2317 +select * /* internal comment with "quote" */ from t1;
2322 +select * /* internal comment with "quote" */ from t1;
2327 +show status like "Qcache_queries_in_cache";
2328 +Variable_name Value
2329 +Qcache_queries_in_cache 13
2330 +show status like "Qcache_inserts";
2331 +Variable_name Value
2333 +show status like "Qcache_hits";
2334 +Variable_name Value
2336 +-----------------------------------------------------
2337 +select */* internal comment with "quote" */ from t1
2338 +-----------------------------------------------------
2339 +show status like "Qcache_queries_in_cache";
2340 +Variable_name Value
2341 +Qcache_queries_in_cache 13
2342 +show status like "Qcache_inserts";
2343 +Variable_name Value
2345 +show status like "Qcache_hits";
2346 +Variable_name Value
2348 +select */* internal comment with "quote" */ from t1;
2353 +select */* internal comment with "quote" */ from t1;
2358 +show status like "Qcache_queries_in_cache";
2359 +Variable_name Value
2360 +Qcache_queries_in_cache 14
2361 +show status like "Qcache_inserts";
2362 +Variable_name Value
2364 +show status like "Qcache_hits";
2365 +Variable_name Value
2367 +-----------------------------------------------------
2368 +select */* internal comment with "quote" */from t1
2369 +-----------------------------------------------------
2370 +show status like "Qcache_queries_in_cache";
2371 +Variable_name Value
2372 +Qcache_queries_in_cache 14
2373 +show status like "Qcache_inserts";
2374 +Variable_name Value
2376 +show status like "Qcache_hits";
2377 +Variable_name Value
2379 +select */* internal comment with "quote" */from t1;
2384 +select */* internal comment with "quote" */from t1;
2389 +show status like "Qcache_queries_in_cache";
2390 +Variable_name Value
2391 +Qcache_queries_in_cache 15
2392 +show status like "Qcache_inserts";
2393 +Variable_name Value
2395 +show status like "Qcache_hits";
2396 +Variable_name Value
2398 +-----------------------------------------------------
2401 +-----------------------------------------------------
2402 +show status like "Qcache_queries_in_cache";
2403 +Variable_name Value
2404 +Qcache_queries_in_cache 15
2405 +show status like "Qcache_inserts";
2406 +Variable_name Value
2408 +show status like "Qcache_hits";
2409 +Variable_name Value
2423 +show status like "Qcache_queries_in_cache";
2424 +Variable_name Value
2425 +Qcache_queries_in_cache 16
2426 +show status like "Qcache_inserts";
2427 +Variable_name Value
2429 +show status like "Qcache_hits";
2430 +Variable_name Value
2432 +-----------------------------------------------------
2434 +-----------------------------------------------------
2435 +show status like "Qcache_queries_in_cache";
2436 +Variable_name Value
2437 +Qcache_queries_in_cache 16
2438 +show status like "Qcache_inserts";
2439 +Variable_name Value
2441 +show status like "Qcache_hits";
2442 +Variable_name Value
2454 +show status like "Qcache_queries_in_cache";
2455 +Variable_name Value
2456 +Qcache_queries_in_cache 16
2457 +show status like "Qcache_inserts";
2458 +Variable_name Value
2460 +show status like "Qcache_hits";
2461 +Variable_name Value
2463 +-----------------------------------------------------
2465 +-----------------------------------------------------
2466 +show status like "Qcache_queries_in_cache";
2467 +Variable_name Value
2468 +Qcache_queries_in_cache 16
2469 +show status like "Qcache_inserts";
2470 +Variable_name Value
2472 +show status like "Qcache_hits";
2473 +Variable_name Value
2485 +show status like "Qcache_queries_in_cache";
2486 +Variable_name Value
2487 +Qcache_queries_in_cache 16
2488 +show status like "Qcache_inserts";
2489 +Variable_name Value
2491 +show status like "Qcache_hits";
2492 +Variable_name Value
2494 +-----------------------------------------------------
2496 +/* comment in the end */
2497 +-----------------------------------------------------
2498 +show status like "Qcache_queries_in_cache";
2499 +Variable_name Value
2500 +Qcache_queries_in_cache 16
2501 +show status like "Qcache_inserts";
2502 +Variable_name Value
2504 +show status like "Qcache_hits";
2505 +Variable_name Value
2508 +/* comment in the end */;
2514 +/* comment in the end */;
2519 +show status like "Qcache_queries_in_cache";
2520 +Variable_name Value
2521 +Qcache_queries_in_cache 17
2522 +show status like "Qcache_inserts";
2523 +Variable_name Value
2525 +show status like "Qcache_hits";
2526 +Variable_name Value
2528 +-----------------------------------------------------
2531 +-----------------------------------------------------
2532 +show status like "Qcache_queries_in_cache";
2533 +Variable_name Value
2534 +Qcache_queries_in_cache 17
2535 +show status like "Qcache_inserts";
2536 +Variable_name Value
2538 +show status like "Qcache_hits";
2539 +Variable_name Value
2553 +show status like "Qcache_queries_in_cache";
2554 +Variable_name Value
2555 +Qcache_queries_in_cache 18
2556 +show status like "Qcache_inserts";
2557 +Variable_name Value
2559 +show status like "Qcache_hits";
2560 +Variable_name Value
2562 +-----------------------------------------------------
2564 +/* comment in the end */
2566 +-----------------------------------------------------
2567 +show status like "Qcache_queries_in_cache";
2568 +Variable_name Value
2569 +Qcache_queries_in_cache 18
2570 +show status like "Qcache_inserts";
2571 +Variable_name Value
2573 +show status like "Qcache_hits";
2574 +Variable_name Value
2577 +/* comment in the end */
2584 +/* comment in the end */
2590 +show status like "Qcache_queries_in_cache";
2591 +Variable_name Value
2592 +Qcache_queries_in_cache 18
2593 +show status like "Qcache_inserts";
2594 +Variable_name Value
2596 +show status like "Qcache_hits";
2597 +Variable_name Value
2599 +-----------------------------------------------------
2600 +select * from t1 #comment in the end
2601 +-----------------------------------------------------
2602 +show status like "Qcache_queries_in_cache";
2603 +Variable_name Value
2604 +Qcache_queries_in_cache 18
2605 +show status like "Qcache_inserts";
2606 +Variable_name Value
2608 +show status like "Qcache_hits";
2609 +Variable_name Value
2611 +select * from t1 #comment in the end;
2616 +select * from t1 #comment in the end;
2621 +show status like "Qcache_queries_in_cache";
2622 +Variable_name Value
2623 +Qcache_queries_in_cache 19
2624 +show status like "Qcache_inserts";
2625 +Variable_name Value
2627 +show status like "Qcache_hits";
2628 +Variable_name Value
2630 +-----------------------------------------------------
2631 +select * from t1 #comment in the end
2633 +-----------------------------------------------------
2634 +show status like "Qcache_queries_in_cache";
2635 +Variable_name Value
2636 +Qcache_queries_in_cache 19
2637 +show status like "Qcache_inserts";
2638 +Variable_name Value
2640 +show status like "Qcache_hits";
2641 +Variable_name Value
2643 +select * from t1 #comment in the end
2649 +select * from t1 #comment in the end
2655 +show status like "Qcache_queries_in_cache";
2656 +Variable_name Value
2657 +Qcache_queries_in_cache 19
2658 +show status like "Qcache_inserts";
2659 +Variable_name Value
2661 +show status like "Qcache_hits";
2662 +Variable_name Value
2664 +-----------------------------------------------------
2665 +select * from t1 -- comment in the end
2666 +-----------------------------------------------------
2667 +show status like "Qcache_queries_in_cache";
2668 +Variable_name Value
2669 +Qcache_queries_in_cache 19
2670 +show status like "Qcache_inserts";
2671 +Variable_name Value
2673 +show status like "Qcache_hits";
2674 +Variable_name Value
2676 +select * from t1 -- comment in the end;
2681 +select * from t1 -- comment in the end;
2686 +show status like "Qcache_queries_in_cache";
2687 +Variable_name Value
2688 +Qcache_queries_in_cache 20
2689 +show status like "Qcache_inserts";
2690 +Variable_name Value
2692 +show status like "Qcache_hits";
2693 +Variable_name Value
2695 +-----------------------------------------------------
2696 +select * from t1 -- comment in the end
2698 +-----------------------------------------------------
2699 +show status like "Qcache_queries_in_cache";
2700 +Variable_name Value
2701 +Qcache_queries_in_cache 20
2702 +show status like "Qcache_inserts";
2703 +Variable_name Value
2705 +show status like "Qcache_hits";
2706 +Variable_name Value
2708 +select * from t1 -- comment in the end
2714 +select * from t1 -- comment in the end
2720 +show status like "Qcache_queries_in_cache";
2721 +Variable_name Value
2722 +Qcache_queries_in_cache 20
2723 +show status like "Qcache_inserts";
2724 +Variable_name Value
2726 +show status like "Qcache_hits";
2727 +Variable_name Value
2729 +-----------------------------------------------------
2730 +select ' \' ' from t1
2731 +-----------------------------------------------------
2732 +show status like "Qcache_queries_in_cache";
2733 +Variable_name Value
2734 +Qcache_queries_in_cache 20
2735 +show status like "Qcache_inserts";
2736 +Variable_name Value
2738 +show status like "Qcache_hits";
2739 +Variable_name Value
2741 +select ' \' ' from t1;
2746 +select ' \' ' from t1;
2751 +show status like "Qcache_queries_in_cache";
2752 +Variable_name Value
2753 +Qcache_queries_in_cache 21
2754 +show status like "Qcache_inserts";
2755 +Variable_name Value
2757 +show status like "Qcache_hits";
2758 +Variable_name Value
2761 +SET GLOBAL query_cache_size=default;
2762 +set global query_cache_strip_comments=OFF;
2764 +++ b/mysql-test/r/percona_query_cache_with_comments_prepared_statements.result
2766 +set GLOBAL query_cache_size=1355776;
2771 +drop table if exists t1;
2772 +create table t1 (a int not null);
2773 +insert into t1 values (1),(2),(3);
2774 +set global query_cache_strip_comments=ON;
2775 +show status like "Qcache_queries_in_cache";
2776 +Variable_name Value
2777 +Qcache_queries_in_cache 0
2778 +show status like "Qcache_inserts";
2779 +Variable_name Value
2781 +show status like "Qcache_hits";
2782 +Variable_name Value
2784 +prepare stmt from '/* with comment */ select * from t1';
2790 +show status like "Qcache_queries_in_cache";
2791 +Variable_name Value
2792 +Qcache_queries_in_cache 1
2793 +show status like "Qcache_inserts";
2794 +Variable_name Value
2796 +show status like "Qcache_hits";
2797 +Variable_name Value
2824 +show status like "Qcache_queries_in_cache";
2825 +Variable_name Value
2826 +Qcache_queries_in_cache 1
2827 +show status like "Qcache_inserts";
2828 +Variable_name Value
2830 +show status like "Qcache_hits";
2831 +Variable_name Value
2833 +prepare stmt from 'select * from t1';
2839 +show status like "Qcache_queries_in_cache";
2840 +Variable_name Value
2841 +Qcache_queries_in_cache 1
2842 +show status like "Qcache_inserts";
2843 +Variable_name Value
2845 +show status like "Qcache_hits";
2846 +Variable_name Value
2848 +prepare stmt from 'select * /*internal comment*/from t1';
2854 +show status like "Qcache_queries_in_cache";
2855 +Variable_name Value
2856 +Qcache_queries_in_cache 1
2857 +show status like "Qcache_inserts";
2858 +Variable_name Value
2860 +show status like "Qcache_hits";
2861 +Variable_name Value
2863 +prepare stmt from 'select * /*internal comment*/ from t1';
2869 +show status like "Qcache_queries_in_cache";
2870 +Variable_name Value
2871 +Qcache_queries_in_cache 1
2872 +show status like "Qcache_inserts";
2873 +Variable_name Value
2875 +show status like "Qcache_hits";
2876 +Variable_name Value
2878 +prepare stmt from 'select * from t1 /* at the end */';
2884 +show status like "Qcache_queries_in_cache";
2885 +Variable_name Value
2886 +Qcache_queries_in_cache 1
2887 +show status like "Qcache_inserts";
2888 +Variable_name Value
2890 +show status like "Qcache_hits";
2891 +Variable_name Value
2893 +prepare stmt from 'select * from t1 /* with "quote" */';
2899 +show status like "Qcache_queries_in_cache";
2900 +Variable_name Value
2901 +Qcache_queries_in_cache 1
2902 +show status like "Qcache_inserts";
2903 +Variable_name Value
2905 +show status like "Qcache_hits";
2906 +Variable_name Value
2908 +prepare stmt from 'select * from t1 /* with \'quote\' */';
2914 +show status like "Qcache_queries_in_cache";
2915 +Variable_name Value
2916 +Qcache_queries_in_cache 1
2917 +show status like "Qcache_inserts";
2918 +Variable_name Value
2920 +show status like "Qcache_hits";
2921 +Variable_name Value
2923 +prepare stmt from 'select * from t1 # 123
2930 +show status like "Qcache_queries_in_cache";
2931 +Variable_name Value
2932 +Qcache_queries_in_cache 1
2933 +show status like "Qcache_inserts";
2934 +Variable_name Value
2936 +show status like "Qcache_hits";
2937 +Variable_name Value
2939 +prepare stmt from 'select * from t1 # 123 with "quote"
2946 +show status like "Qcache_queries_in_cache";
2947 +Variable_name Value
2948 +Qcache_queries_in_cache 1
2949 +show status like "Qcache_inserts";
2950 +Variable_name Value
2952 +show status like "Qcache_hits";
2953 +Variable_name Value
2955 +prepare stmt from 'select * from t1 # 123 with \'quote\'
2962 +show status like "Qcache_queries_in_cache";
2963 +Variable_name Value
2964 +Qcache_queries_in_cache 1
2965 +show status like "Qcache_inserts";
2966 +Variable_name Value
2968 +show status like "Qcache_hits";
2969 +Variable_name Value
2971 +prepare stmt from 'select * from t1
2979 +show status like "Qcache_queries_in_cache";
2980 +Variable_name Value
2981 +Qcache_queries_in_cache 1
2982 +show status like "Qcache_inserts";
2983 +Variable_name Value
2985 +show status like "Qcache_hits";
2986 +Variable_name Value
2988 +prepare stmt from '#456
2997 +show status like "Qcache_queries_in_cache";
2998 +Variable_name Value
2999 +Qcache_queries_in_cache 1
3000 +show status like "Qcache_inserts";
3001 +Variable_name Value
3003 +show status like "Qcache_hits";
3004 +Variable_name Value
3006 +prepare stmt from 'select * from t1 -- 123
3013 +show status like "Qcache_queries_in_cache";
3014 +Variable_name Value
3015 +Qcache_queries_in_cache 1
3016 +show status like "Qcache_inserts";
3017 +Variable_name Value
3019 +show status like "Qcache_hits";
3020 +Variable_name Value
3022 +prepare stmt from 'select * from t1
3030 +show status like "Qcache_queries_in_cache";
3031 +Variable_name Value
3032 +Qcache_queries_in_cache 1
3033 +show status like "Qcache_inserts";
3034 +Variable_name Value
3036 +show status like "Qcache_hits";
3037 +Variable_name Value
3039 +prepare stmt from '-- comment in first
3048 +show status like "Qcache_queries_in_cache";
3049 +Variable_name Value
3050 +Qcache_queries_in_cache 1
3051 +show status like "Qcache_inserts";
3052 +Variable_name Value
3054 +show status like "Qcache_hits";
3055 +Variable_name Value
3057 +prepare stmt from '(#456(
3066 +show status like "Qcache_queries_in_cache";
3067 +Variable_name Value
3068 +Qcache_queries_in_cache 2
3069 +show status like "Qcache_inserts";
3070 +Variable_name Value
3072 +show status like "Qcache_hits";
3073 +Variable_name Value
3075 +prepare stmt from '/*test*/(-- comment in first(
3084 +show status like "Qcache_queries_in_cache";
3085 +Variable_name Value
3086 +Qcache_queries_in_cache 2
3087 +show status like "Qcache_inserts";
3088 +Variable_name Value
3090 +show status like "Qcache_hits";
3091 +Variable_name Value
3093 +prepare stmt from 'select "test",a from t1';
3104 +show status like "Qcache_queries_in_cache";
3105 +Variable_name Value
3106 +Qcache_queries_in_cache 3
3107 +show status like "Qcache_inserts";
3108 +Variable_name Value
3110 +show status like "Qcache_hits";
3111 +Variable_name Value
3113 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
3115 +test /* internal 'comment' */ a
3116 +test /* internal 'comment' */ 1
3117 +test /* internal 'comment' */ 2
3118 +test /* internal 'comment' */ 3
3119 +show status like "Qcache_queries_in_cache";
3120 +Variable_name Value
3121 +Qcache_queries_in_cache 4
3122 +show status like "Qcache_inserts";
3123 +Variable_name Value
3125 +show status like "Qcache_hits";
3126 +Variable_name Value
3128 +prepare stmt from 'select "test #internal comment" ,a from t1';
3130 +test #internal comment a
3131 +test #internal comment 1
3132 +test #internal comment 2
3133 +test #internal comment 3
3134 +show status like "Qcache_queries_in_cache";
3135 +Variable_name Value
3136 +Qcache_queries_in_cache 5
3137 +show status like "Qcache_inserts";
3138 +Variable_name Value
3140 +show status like "Qcache_hits";
3141 +Variable_name Value
3143 +prepare stmt from 'select "test #internal comment" #external comment
3146 +test #internal comment a
3147 +test #internal comment 1
3148 +test #internal comment 2
3149 +test #internal comment 3
3150 +show status like "Qcache_queries_in_cache";
3151 +Variable_name Value
3152 +Qcache_queries_in_cache 5
3153 +show status like "Qcache_inserts";
3154 +Variable_name Value
3156 +show status like "Qcache_hits";
3157 +Variable_name Value
3160 +SET GLOBAL query_cache_size= default;
3161 +set global query_cache_strip_comments=OFF;
3163 +++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
3165 +set GLOBAL query_cache_size=1355776;
3170 +DROP TABLE IF EXISTS t;
3171 +CREATE TABLE t(id INT, number INT);
3172 +INSERT INTO t VALUES (0,1);
3173 +INSERT INTO t VALUES (1,2);
3174 +INSERT INTO t VALUES (2,3);
3175 +SELECT number from t where id > 0;
3179 +SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
3180 +SELECT number from t where id > 0;
3181 +SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
3182 +SELECT number from t where id > 0;
3183 +SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
3185 +Id User Host db Command Time State Info
3186 +Id root localhost test Sleep Time NULL
3187 +Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
3188 +Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
3189 +Id root localhost test Query Time NULL SHOW PROCESSLIST
3191 +set GLOBAL query_cache_size=0;
3193 +++ b/mysql-test/t/percona_query_cache_with_comments.test
3195 +--disable_ps_protocol
3196 +set global query_cache_strip_comments=ON;
3197 +-- source include/percona_query_cache_with_comments_begin.inc
3198 +-- source include/percona_query_cache_with_comments.inc
3199 +-- source include/percona_query_cache_with_comments_end.inc
3201 +++ b/mysql-test/t/percona_query_cache_with_comments_crash.test
3203 +-- source include/have_query_cache.inc
3204 +set GLOBAL query_cache_size=1355776;
3206 +drop table if exists t1;
3208 +create table t1 (a int not null);
3209 +insert into t1 values (1),(2),(3);
3210 +flush query cache; # This crashed in some versions
3211 +flush query cache; # This crashed in some versions
3214 +( select * from t1 );
3215 +/*!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 */;
3216 +/* only comment */;
3217 +let query=# only comment
3220 +let query=-- only comment
3224 +SET GLOBAL query_cache_size= default;
3226 +++ b/mysql-test/t/percona_query_cache_with_comments_disable.test
3228 +-- source include/percona_query_cache_with_comments_begin.inc
3229 +-- source include/percona_query_cache_with_comments.inc
3230 +-- source include/percona_query_cache_with_comments_end.inc
3232 +++ b/mysql-test/t/percona_query_cache_with_comments_prepared_statements.test
3234 +-- source include/have_query_cache.inc
3236 +set GLOBAL query_cache_size=1355776;
3238 +# Reset query cache variables.
3239 +flush query cache; # This crashed in some versions
3240 +flush query cache; # This crashed in some versions
3244 +drop table if exists t1;
3248 +# First simple test
3251 +create table t1 (a int not null);
3252 +insert into t1 values (1),(2),(3);
3254 +set global query_cache_strip_comments=ON;
3256 +show status like "Qcache_queries_in_cache";
3257 +show status like "Qcache_inserts";
3258 +show status like "Qcache_hits";
3260 +prepare stmt from '/* with comment */ select * from t1';
3263 +show status like "Qcache_queries_in_cache";
3264 +show status like "Qcache_inserts";
3265 +show status like "Qcache_hits";
3273 +show status like "Qcache_queries_in_cache";
3274 +show status like "Qcache_inserts";
3275 +show status like "Qcache_hits";
3277 +prepare stmt from 'select * from t1';
3280 +show status like "Qcache_queries_in_cache";
3281 +show status like "Qcache_inserts";
3282 +show status like "Qcache_hits";
3284 +prepare stmt from 'select * /*internal comment*/from t1';
3287 +show status like "Qcache_queries_in_cache";
3288 +show status like "Qcache_inserts";
3289 +show status like "Qcache_hits";
3291 +prepare stmt from 'select * /*internal comment*/ from t1';
3294 +show status like "Qcache_queries_in_cache";
3295 +show status like "Qcache_inserts";
3296 +show status like "Qcache_hits";
3298 +prepare stmt from 'select * from t1 /* at the end */';
3301 +show status like "Qcache_queries_in_cache";
3302 +show status like "Qcache_inserts";
3303 +show status like "Qcache_hits";
3305 +prepare stmt from 'select * from t1 /* with "quote" */';
3308 +show status like "Qcache_queries_in_cache";
3309 +show status like "Qcache_inserts";
3310 +show status like "Qcache_hits";
3312 +prepare stmt from 'select * from t1 /* with \'quote\' */';
3315 +show status like "Qcache_queries_in_cache";
3316 +show status like "Qcache_inserts";
3317 +show status like "Qcache_hits";
3319 +prepare stmt from 'select * from t1 # 123
3323 +show status like "Qcache_queries_in_cache";
3324 +show status like "Qcache_inserts";
3325 +show status like "Qcache_hits";
3327 +prepare stmt from 'select * from t1 # 123 with "quote"
3331 +show status like "Qcache_queries_in_cache";
3332 +show status like "Qcache_inserts";
3333 +show status like "Qcache_hits";
3335 +prepare stmt from 'select * from t1 # 123 with \'quote\'
3339 +show status like "Qcache_queries_in_cache";
3340 +show status like "Qcache_inserts";
3341 +show status like "Qcache_hits";
3343 +prepare stmt from 'select * from t1
3348 +show status like "Qcache_queries_in_cache";
3349 +show status like "Qcache_inserts";
3350 +show status like "Qcache_hits";
3352 +prepare stmt from '#456
3358 +show status like "Qcache_queries_in_cache";
3359 +show status like "Qcache_inserts";
3360 +show status like "Qcache_hits";
3362 +prepare stmt from 'select * from t1 -- 123
3366 +show status like "Qcache_queries_in_cache";
3367 +show status like "Qcache_inserts";
3368 +show status like "Qcache_hits";
3370 +prepare stmt from 'select * from t1
3375 +show status like "Qcache_queries_in_cache";
3376 +show status like "Qcache_inserts";
3377 +show status like "Qcache_hits";
3379 +prepare stmt from '-- comment in first
3385 +show status like "Qcache_queries_in_cache";
3386 +show status like "Qcache_inserts";
3387 +show status like "Qcache_hits";
3389 +prepare stmt from '(#456(
3395 +show status like "Qcache_queries_in_cache";
3396 +show status like "Qcache_inserts";
3397 +show status like "Qcache_hits";
3399 +prepare stmt from '/*test*/(-- comment in first(
3405 +show status like "Qcache_queries_in_cache";
3406 +show status like "Qcache_inserts";
3407 +show status like "Qcache_hits";
3409 +prepare stmt from 'select "test",a from t1';
3413 +show status like "Qcache_queries_in_cache";
3414 +show status like "Qcache_inserts";
3415 +show status like "Qcache_hits";
3417 +prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
3420 +show status like "Qcache_queries_in_cache";
3421 +show status like "Qcache_inserts";
3422 +show status like "Qcache_hits";
3424 +prepare stmt from 'select "test #internal comment" ,a from t1';
3427 +show status like "Qcache_queries_in_cache";
3428 +show status like "Qcache_inserts";
3429 +show status like "Qcache_hits";
3431 +prepare stmt from 'select "test #internal comment" #external comment
3435 +show status like "Qcache_queries_in_cache";
3436 +show status like "Qcache_inserts";
3437 +show status like "Qcache_hits";
3440 +SET GLOBAL query_cache_size= default;
3441 +set global query_cache_strip_comments=OFF;
3443 +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
3445 +--source include/have_query_cache.inc
3446 +--source include/have_debug.inc
3447 +set GLOBAL query_cache_size=1355776;
3448 +--source include/percona_query_cache_with_comments_clear.inc
3450 +-- disable_warnings
3451 +DROP TABLE IF EXISTS t;
3453 +CREATE TABLE t(id INT, number INT);
3454 +INSERT INTO t VALUES (0,1);
3455 +INSERT INTO t VALUES (1,2);
3456 +INSERT INTO t VALUES (2,3);
3457 +SELECT number from t where id > 0;
3458 +--connect (conn0,localhost,root,,)
3459 +--connect (conn1,localhost,root,,)
3460 +--connect (conn2,localhost,root,,)
3463 +--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
3464 +SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
3465 +SEND SELECT number from t where id > 0;
3469 +--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
3470 +SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
3471 +SEND SELECT number from t where id > 0;
3475 +--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
3476 +SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
3477 +--replace_column 1 Id 6 Time
3481 +set GLOBAL query_cache_size=0;