summaryrefslogtreecommitdiff
path: root/mysys/mf_keycache.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-04-27 14:31:04 +0300
committerunknown <monty@mysql.com>2005-04-27 14:31:04 +0300
commitb00b2126de29598aa059a1c4a839f7c7f9ed1011 (patch)
treeaebd3ecc452ccbe3a35112fe242ee9e5277bc4dd /mysys/mf_keycache.c
parentbf17c826deb66a82fe528e4a95edb4caee0ff652 (diff)
downloadmariadb-git-b00b2126de29598aa059a1c4a839f7c7f9ed1011.tar.gz
Fixed core dump bug when hot link list in key cache was empty. Bug #10167
mysql-test/r/drop.result: Fixed result
Diffstat (limited to 'mysys/mf_keycache.c')
-rw-r--r--mysys/mf_keycache.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 9feaf8dcd57..cee1b7eb4e9 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -1025,8 +1025,8 @@ static void reg_requests(KEY_CACHE *keycache, BLOCK_LINK *block, int count)
for a too long time (this time is determined by parameter age_threshold).
*/
-static inline void unreg_request(KEY_CACHE *keycache,
- BLOCK_LINK *block, int at_end)
+static void unreg_request(KEY_CACHE *keycache,
+ BLOCK_LINK *block, int at_end)
{
if (! --block->requests)
{
@@ -1045,10 +1045,13 @@ static inline void unreg_request(KEY_CACHE *keycache,
}
link_block(keycache, block, hot, (my_bool)at_end);
block->last_hit_time= keycache->keycache_time;
- if (++keycache->keycache_time - keycache->used_ins->last_hit_time >
+ keycache->keycache_time++;
+
+ block= keycache->used_ins;
+ /* Check if we should link a hot block to the warm block */
+ if (block && keycache->keycache_time - block->last_hit_time >
keycache->age_threshold)
{
- block= keycache->used_ins;
unlink_block(keycache, block);
link_block(keycache, block, 0, 0);
if (block->temperature != BLOCK_WARM)