summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2005-01-19 12:55:54 +0200
committerunknown <timour@mysql.com>2005-01-19 12:55:54 +0200
commit8e1e1e73d811d4090255b49128ffa697163b2e1d (patch)
tree75bcf07f1651331afc8970e24f80afa45a0bdead /mysys
parent49ab428c8ddc0cbafb99cb10ee77167081a23914 (diff)
downloadmariadb-git-8e1e1e73d811d4090255b49128ffa697163b2e1d.tar.gz
Final patch for BUG#4285.
This patch collects all previous patches into one. The main problem was due to that there is are two variables - dflt_key_cache and sql_key_cache with have more or less duplicate function. The reson for the bug was that the default value in the key cache hash was set to dflt_key_cache, then sql_key_cache was set to a new key cache object, and then dflt_key_cache was set to sql_key_cache which was different from the dflt_key_cache_var. After sending SIGHUP, the server was using the original default value for the key cache hash, which was different from the actual key cache object used for the default key cache. include/keycache.h: Import patch 4285.diff mysys/mf_keycache.c: Import patch 4285.diff sql/mysql_priv.h: Import patch 4285.diff sql/mysqld.cc: Import patch 4285.diff sql/set_var.cc: Import patch 4285.diff sql/sql_parse.cc: Import patch 4285.diff sql/sql_show.cc: Import patch 4285.diff
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_keycache.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 052d6c79ab9..a1227989a4b 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -2444,6 +2444,41 @@ static int flush_all_key_blocks(KEY_CACHE *keycache)
}
+/*
+ Reset the counters of a key cache.
+
+ SYNOPSIS
+ reset_key_cache_counters()
+ name the name of a key cache
+ key_cache pointer to the key kache to be reset
+
+ DESCRIPTION
+ This procedure is used by process_key_caches() to reset the counters of all
+ currently used key caches, both the default one and the named ones.
+
+ RETURN
+ 0 on success (always because it can't fail)
+*/
+
+int reset_key_cache_counters(const char *name, KEY_CACHE *key_cache)
+{
+ DBUG_ENTER("reset_key_cache_counters");
+ if (!key_cache->key_cache_inited)
+ {
+ DBUG_PRINT("info", ("Key cache %s not initialized.", name));
+ DBUG_RETURN(0);
+ }
+ DBUG_PRINT("info", ("Resetting counters for key cache %s.", name));
+
+ key_cache->global_blocks_changed= 0; /* Key_blocks_not_flushed */
+ key_cache->global_cache_r_requests= 0; /* Key_read_requests */
+ key_cache->global_cache_read= 0; /* Key_reads */
+ key_cache->global_cache_w_requests= 0; /* Key_write_requests */
+ key_cache->global_cache_write= 0; /* Key_writes */
+ DBUG_RETURN(0);
+}
+
+
#ifndef DBUG_OFF
/*
Test if disk-cache is ok