[patch] Evictions stats problem when exptime == 0

BUSTARRET, Jean-francois jfbustarret at wat.tv
Tue Jul 17 18:33:40 UTC 2007


I did send the patch last month, but looks like it got lost...
 
evictions are not incremented when exptime == 0 (but they should be,
because those items are still valid, and the definition of evictions is
"the number of valid items kicked out of the LRU").

AFAIK, the code should be :

diff -rup memcached-1.2.2/items.c memcached-1.2.2-new/items.c
--- memcached-1.2.2/items.c     2007-05-03 00:58:51.000000000 +0200
+++ memcached-1.2.2-new/items.c 2007-06-26 09:10:59.000000000 +0200
@@ -105,7 +105,7 @@ item *do_item_alloc(char *key, const siz

         for (search = tails[id]; tries > 0 && search != NULL; tries--,
search=search->prev) {
             if (search->refcount == 0) {
-               if (search->exptime > current_time) {
+               if (search->exptime == 0 || search->exptime >
current_time) {
                        STATS_LOCK();
                        stats.evictions++;
                        STATS_UNLOCK();

Can someone check and commit the patch ?

JFB


More information about the memcached mailing list