Commit 8c54ccc5 authored by Guilhem Bichot's avatar Guilhem Bichot

Undoing mikael@mysql.com-20081015100345-8tu2vmh7mzs60c23

"Patch to fix bug 38551": it was a manual backport (2008-10-15) of
http://lists.mysql.com/commits/56418.
But that was an early, non-final patch from the fixer of this bug (TheK):
after that backport was made by Mikael, TheK decided to do a different fix,
which was finally pushed into 6.0.
Then 5.1's code was changed for some other reasons, so now we have a
conflict between the old never-approved TheK patch backported to Summit and
the latest 5.1. The backport cannot stay, it has to be removed due to
the conflict, and then rewritten if desired.
parent acce96d1
......@@ -3573,19 +3573,6 @@ You should consider changing lower_case_table_names to 1 or 2",
files_charset_info :
&my_charset_bin);
/*
If we explicitly turn off query cache from the command line query cache will
be disabled for the reminder of the server life time. This is because we
want to avoid locking the QC specific mutex if query cache isn't going to
be used.
*/
if (global_system_variables.query_cache_type == 0)
{
have_query_cache= SHOW_OPTION_NO;
query_cache.disable_query_cache();
}
return 0;
}
......@@ -6889,10 +6876,12 @@ The minimum value for this variable is 4096.",
(uchar**) &query_cache_min_res_unit, (uchar**) &query_cache_min_res_unit,
0, GET_ULONG, REQUIRED_ARG, QUERY_CACHE_MIN_RESULT_DATA_SIZE,
0, ULONG_MAX, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
"The memory allocated to store results from old queries.",
(uchar**) &query_cache_size, (uchar**) &query_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0},
#ifdef HAVE_QUERY_CACHE
{"query_cache_type", OPT_QUERY_CACHE_TYPE,
"0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
(uchar**) &global_system_variables.query_cache_type,
......
......@@ -835,7 +835,7 @@ void query_cache_insert(NET *net, const char *packet, ulong length)
DBUG_ENTER("query_cache_insert");
/* See the comment on double-check locking usage above. */
if (query_cache.is_disabled() || net->query_cache_query == 0)
if (net->query_cache_query == 0)
DBUG_VOID_RETURN;
DBUG_EXECUTE_IF("wait_in_query_cache_insert",
......@@ -930,7 +930,7 @@ void query_cache_end_of_result(THD *thd)
DBUG_ENTER("query_cache_end_of_result");
/* See the comment on double-check locking usage above. */
if (query_cache.is_disabled() || thd->net.query_cache_query == 0)
if (thd->net.query_cache_query == 0)
DBUG_VOID_RETURN;
/* Ensure that only complete results are cached. */
......@@ -1032,7 +1032,6 @@ Query_cache::Query_cache(ulong query_cache_limit_arg,
query_cache_limit(query_cache_limit_arg),
queries_in_cache(0), hits(0), inserts(0), refused(0),
total_blocks(0), lowmem_prunes(0),
m_query_cache_is_disabled(FALSE),
min_allocation_unit(ALIGN_SIZE(min_allocation_unit_arg)),
min_result_data_size(ALIGN_SIZE(min_result_data_size_arg)),
def_query_hash_size(ALIGN_SIZE(def_query_hash_size_arg)),
......@@ -1117,7 +1116,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
See also a note on double-check locking usage above.
*/
if (m_query_cache_is_disabled || thd->locked_tables || query_cache_size == 0)
if (thd->locked_tables || query_cache_size == 0)
DBUG_VOID_RETURN;
uint8 tables_type= 0;
......@@ -1332,9 +1331,6 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_query_flags flags;
DBUG_ENTER("Query_cache::send_result_to_client");
if (m_query_cache_is_disabled)
DBUG_RETURN(0);
/*
Testing 'query_cache_size' without a lock here is safe: the thing
we may loose is that the query won't be served from cache, but we
......@@ -2625,48 +2621,6 @@ void Query_cache::invalidate_table(THD *thd, TABLE *table)
void Query_cache::invalidate_table(THD *thd, uchar * key, uint32 key_length)
{
#ifdef TO_BE_REMOVED
/*
This ifdef'd piece comes from Summit, it's a manual backport (2008-10-15) of
http://lists.mysql.com/commits/56418.
But that was an early, non-final patch: after that backport was made, the
author of the patch decided to abandon it, and his final patch (put into 6.0)
was different.
Then 5.1's code was changed for some other reasons, so now we have a
conflict between the old patch backported to Summit and the latest 5.1.
The backport cannot stay, it has to be removed and then rewritten if
desired.
*/
bool interrupt;
if (m_query_cache_is_disabled)
return;
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size == 0)
{
STRUCT_UNLOCK(&structure_guard_mutex);
return;
}
wait_while_table_flush_is_in_progress(&interrupt);
if (interrupt)
{
STRUCT_UNLOCK(&structure_guard_mutex);
return;
}
||||||| BASE-REVISION
bool interrupt;
STRUCT_LOCK(&structure_guard_mutex);
wait_while_table_flush_is_in_progress(&interrupt);
if (interrupt)
{
STRUCT_UNLOCK(&structure_guard_mutex);
return;
}
=======
/* current 5.1 code: */
#endif
DBUG_EXECUTE_IF("wait_in_query_cache_invalidate1",
debug_wait_for_kill("wait_in_query_cache_invalidate1"); );
......
......@@ -279,8 +279,6 @@ class Query_cache
enum Cache_lock_status { UNLOCKED, LOCKED_NO_WAIT, LOCKED };
Cache_lock_status m_cache_lock_status;
bool m_query_cache_is_disabled;
void free_query_internal(Query_cache_block *point);
void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
......@@ -437,14 +435,6 @@ class Query_cache
/* register query in cache */
void store_query(THD *thd, TABLE_LIST *used_tables);
/**
At startup the user has an option to disable the query cache
to avoid locking the structure_guard_mutex.
This option is enabled by explicitly setting query_cache_type=OFF
in the command line.
*/
void disable_query_cache(void) { m_query_cache_is_disabled= TRUE; }
/*
Check if the query is in the cache and if this is true send the
data to client.
......@@ -477,7 +467,6 @@ class Query_cache
friend void query_cache_end_of_result(THD *thd);
friend void query_cache_abort(NET *net);
bool is_disabled(void) { return m_query_cache_is_disabled; }
/*
The following functions are only used when debugging
We don't protect these with ifndef DBUG_OFF to not have to recompile
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment