Below is the list of changes that have just been committed into a local
5.1 repository of thek. When thek does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-22 09:07:28+02:00, thek@adventure.(none) +2 -0
- This patch addesses the performance issues with invalidating the entire
cache by changing the behavior of the query cache resize-method.
- Instead of iterating over all cached statements the cache will be cleared as
one single block of data.
sql/set_var.cc@stripped, 2007-05-22 09:07:25+02:00, thek@adventure.(none) +9 -2
Refactored behavior of function. Instead of setting the global variable
from within the class method scope we return the new cache size as a
result of the method call.
sql/sql_cache.cc@stripped, 2007-05-22 09:07:25+02:00, thek@adventure.(none) +23 -3
- Changed behavior of resize-method. Now, the cache will be cleared as one
single block of data instead of an iteration over all cached statements.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: thek
# Host: adventure.(none)
# Root: /home/thek/Development/cpp/bug21074/my51-bug21074
--- 1.106/sql/sql_cache.cc 2007-03-09 18:09:54 +01:00
+++ 1.107/sql/sql_cache.cc 2007-05-22 09:07:25 +02:00
@@ -799,12 +799,31 @@ ulong Query_cache::resize(ulong query_ca
DBUG_PRINT("qcache", ("from %lu to %lu",query_cache_size,
query_cache_size_arg));
DBUG_ASSERT(initialized);
+
STRUCT_LOCK(&structure_guard_mutex);
- free_cache();
+ while (flush_in_progress)
+ pthread_cond_wait(&COND_flush_finished, &structure_guard_mutex);
+ flush_in_progress= TRUE;
+ STRUCT_UNLOCK(&structure_guard_mutex);
+
+ my_free((gptr) cache, MYF(MY_ALLOW_ZERO_PTR));
+ queries_in_cache= 0;
+ total_blocks= 0;
+ tables_blocks= 0;
query_cache_size= query_cache_size_arg;
- ::query_cache_size= init_cache();
+ hash_free(&queries);
+ hash_free(&tables);
+
+ ulong new_query_cache_size= init_cache();
+
+ DBUG_EXECUTE("check_querycache",check_integrity(0););
+
+ STRUCT_LOCK(&structure_guard_mutex);
+ flush_in_progress= FALSE;
+ pthread_cond_signal(&COND_flush_finished);
STRUCT_UNLOCK(&structure_guard_mutex);
- DBUG_RETURN(::query_cache_size);
+
+ DBUG_RETURN(new_query_cache_size);
}
@@ -1575,6 +1594,7 @@ ulong Query_cache::init_cache()
int align;
DBUG_ENTER("Query_cache::init_cache");
+
approx_additional_data_size = (sizeof(Query_cache) +
sizeof(gptr)*(def_query_hash_size+
def_table_hash_size));
--- 1.227/sql/set_var.cc 2007-04-05 21:22:30 +02:00
+++ 1.228/sql/set_var.cc 2007-05-22 09:07:25 +02:00
@@ -1276,8 +1276,15 @@ static void fix_query_cache_size(THD *th
{
#ifdef HAVE_QUERY_CACHE
ulong requested= query_cache_size;
- query_cache.resize(query_cache_size);
- if (requested != query_cache_size)
+ ulong new_cache_size= query_cache.resize(query_cache_size);
+
+ /*
+ Note: query_cache_size is a global variable reflecting the
+ requested cache size. See also query_cache_size_arg
+ */
+ query_cache_size= new_cache_size;
+
+ if (requested != new_cache_size)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
requested, query_cache_size);
| Thread |
|---|
| • bk commit into 5.1 tree (thek:1.2563) | kpettersson | 22 May |