From c9055e8423b2ccbe7bf18fc1224a069574886fd0 Mon Sep 17 00:00:00 2001 From: dormando Date: Tue, 4 Oct 2011 01:19:10 -0700 Subject: Add missing LRU bumps to binary get and others An audit turned up that the LRU bump to move just accessed items to the front was missing from the binary get command. It was also missing from incr/decr and the new touch commands. If someone was using the binary protocol exclusively, memcached would be acting as a FIFO for stored items. --- memcached.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/memcached.c b/memcached.c index c7df0bd..f8c16f1 100644 --- a/memcached.c +++ b/memcached.c @@ -1210,6 +1210,7 @@ static void process_bin_touch(conn *c) { uint16_t keylen = 0; uint32_t bodylen = sizeof(rsp->message.body) + (it->nbytes - 2); + item_update(it); pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.touch_cmds++; c->thread->stats.slab_stats[it->slabs_clsid].touch_hits++; @@ -1297,6 +1298,7 @@ static void process_bin_get(conn *c) { uint16_t keylen = 0; uint32_t bodylen = sizeof(rsp->message.body) + (it->nbytes - 2); + item_update(it); pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.get_cmds++; c->thread->stats.slab_stats[it->slabs_clsid].get_hits++; @@ -2944,6 +2946,7 @@ static void process_touch_command(conn *c, token_t *tokens, const size_t ntokens it = item_touch(key, nkey, realtime(exptime_int)); if (it) { + item_update(it); pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.touch_cmds++; c->thread->stats.slab_stats[it->slabs_clsid].touch_hits++; @@ -3089,6 +3092,7 @@ enum delta_result_type do_add_delta(conn *c, const char *key, const size_t nkey, memcpy(ITEM_data(it), buf, res); memset(ITEM_data(it) + res, ' ', it->nbytes - res - 2); + do_item_update(it); } if (cas) { -- cgit v1.2.1