Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 205 by [email protected]: Flushed items not considered as usable during set
http://code.google.com/p/memcached/issues/detail?id=205

What steps will reproduce the problem?
1. Have nodes with lots of items written on which you don't do any get
2. Issue flush_all
3. Do some set

What is the expected output? What do you see instead?
New chunks are used to store the items set in step 3 whereas I'd expect chunks of some flushed items to be used.

What version of the product are you using? On what operating system?
memcached 1.4.2 but issue seems to exist in 1.4.5 too

Please provide any additional information below.
This can be fixed with the following patch:

diff --git a/items.c b/items.c
index 3e7f8c4..5eb3a52 100644
--- a/items.c
+++ b/items.c
@@ -103,7 +103,7 @@ item *do_item_alloc(char *key, const size_t nkey,
const int flags, const rel_tim
         tries > 0 && search != NULL;
         tries--, search=search->prev) {
        if (search->refcount == 0 &&
-            (search->exptime != 0 && search->exptime < current_time))
{
+            ((search->exptime != 0 && search->exptime < current_time)
|| (search->time <= settings.oldest_live))) {
            it = search;
            /* I don't want to actually free the object, just steal
             * the item to avoid to grab the slab mutex twice ;-)


Reply via email to