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