#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
-diff -ruN /dev/null b/patch_info/query_cache_enhance.patch
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ b/patch_info/query_cache_enhance.patch 2011-04-09 18:48:53.000000000 +0400
+--- /dev/null
++++ b/patch_info/query_cache_enhance.patch
@@ -0,0 +1,15 @@
+File=query_cache_enhance.patch
+Name= query cache Percona's cumulative patch
+2010-07 - Fix incorrect behavior diff (query_cache_with_comments.patch)
+2010-09 - Merge patches to one
+2010-11 - Ported to 5.5
-diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
---- a/sql/mysqld.cc 2011-04-09 18:48:50.000000000 +0400
-+++ b/sql/mysqld.cc 2011-04-09 18:48:53.000000000 +0400
-@@ -903,6 +903,7 @@
+--- a/sql/mysqld.cc
++++ b/sql/mysqld.cc
+@@ -904,6 +904,7 @@
#endif
#ifdef HAVE_QUERY_CACHE
ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
Query_cache query_cache;
#endif
#ifdef HAVE_SMEM
-diff -ruN a/sql/mysqld.h b/sql/mysqld.h
---- a/sql/mysqld.h 2011-04-09 18:48:50.000000000 +0400
-+++ b/sql/mysqld.h 2011-04-09 18:48:53.000000000 +0400
+--- a/sql/mysqld.h
++++ b/sql/mysqld.h
@@ -91,6 +91,7 @@
extern my_bool opt_log, opt_slow_log;
extern my_bool opt_backup_history_log;
extern ulonglong log_output_options;
extern ulong log_backup_output_options;
extern my_bool opt_log_queries_not_using_indexes;
-diff -ruN /dev/null b/sql/query_strip_comments.h
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ b/sql/query_strip_comments.h 2011-04-09 18:48:53.000000000 +0400
+--- /dev/null
++++ b/sql/query_strip_comments.h
@@ -0,0 +1,37 @@
+#ifndef _SQL_QUERY_STRIPC_COMMENTS_H_
+#define _SQL_QUERY_STRIPC_COMMENTS_H_
+
+#endif // HAVE_QUERY_CACHE
+#endif // _SQL_QUERY_STRIPC_COMMENTS_H_
-diff -ruN a/sql/sql_cache.cc b/sql/sql_cache.cc
---- a/sql/sql_cache.cc 2011-04-09 18:48:50.000000000 +0400
-+++ b/sql/sql_cache.cc 2011-04-09 18:48:53.000000000 +0400
+--- a/sql/sql_cache.cc
++++ b/sql/sql_cache.cc
@@ -344,6 +344,181 @@
#include "probes_mysql.h"
#include "transaction.h"
#ifdef EMBEDDED_LIBRARY
#include "emb_qcache.h"
#endif
-@@ -454,7 +629,12 @@
+@@ -454,7 +629,14 @@
Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
DBUG_ENTER("Query_cache::try_lock");
+ const char* old_proc_info= thd->proc_info;
+ thd_proc_info(thd,"Waiting on query cache mutex");
mysql_mutex_lock(&structure_guard_mutex);
-+ DBUG_EXECUTE_IF("status_wait_query_cache_mutex_sleep", {
-+ sleep(5);
++ DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");
++ DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
++ sleep(1);
+ });
++ thd->proc_info = old_proc_info;
while (1)
{
if (m_cache_lock_status == Query_cache::UNLOCKED)
-@@ -501,6 +681,7 @@
- }
- }
- mysql_mutex_unlock(&structure_guard_mutex);
-+ thd->proc_info = old_proc_info;
-
- DBUG_RETURN(interrupt);
- }
-@@ -1274,6 +1455,8 @@
+@@ -1274,6 +1456,8 @@
unlock();
DBUG_VOID_RETURN;
}
/* Key is query + database + flag */
if (thd->db_length)
-@@ -1451,6 +1634,9 @@
+@@ -1451,6 +1635,9 @@
Query_cache_block_table *block_table, *block_table_end;
ulong tot_length;
Query_cache_query_flags flags;
DBUG_ENTER("Query_cache::send_result_to_client");
/*
-@@ -1472,21 +1658,103 @@
+@@ -1472,21 +1659,103 @@
{
uint i= 0;
if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
-@@ -1521,6 +1789,12 @@
+@@ -1521,6 +1790,12 @@
goto err_unlock;
Query_cache_block *query_block;
tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
if (thd->db_length)
-@@ -1587,6 +1861,8 @@
+@@ -1587,6 +1862,8 @@
(uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,
tot_length);
/* Quick abort on unlocked data */
if (query_block == 0 ||
query_block->query()->result() == 0 ||
-diff -ruN a/sql/sql_class.h b/sql/sql_class.h
---- a/sql/sql_class.h 2011-04-09 18:48:50.000000000 +0400
-+++ b/sql/sql_class.h 2011-04-09 18:48:53.000000000 +0400
+--- a/sql/sql_class.h
++++ b/sql/sql_class.h
@@ -40,6 +40,9 @@
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
THR_LOCK_INFO */
class Reprepare_observer;
class Relay_log_info;
-@@ -765,6 +768,9 @@
+@@ -760,6 +763,9 @@
statement lifetime. FIXME: must be const
*/
ulong id;
/*
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
-diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
---- a/sql/sys_vars.cc 2011-04-09 18:48:50.000000000 +0400
-+++ b/sql/sys_vars.cc 2011-04-09 18:48:53.000000000 +0400
-@@ -1750,6 +1750,11 @@
+--- a/sql/sys_vars.cc
++++ b/sql/sys_vars.cc
+@@ -1786,6 +1786,11 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_query_cache_size));