From b00b2126de29598aa059a1c4a839f7c7f9ed1011 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Apr 2005 14:31:04 +0300 Subject: Fixed core dump bug when hot link list in key cache was empty. Bug #10167 mysql-test/r/drop.result: Fixed result --- mysys/mf_keycache.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'mysys/mf_keycache.c') 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) -- cgit v1.2.1