allen8807 / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

Flushed items not considered as usable during set #205

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 ;-)

Original issue reported on code.google.com by colin.pi...@gmail.com on 23 May 2011 at 3:55

GoogleCodeExporter commented 9 years ago
Same problem as issue 183

Original comment by colin.pi...@gmail.com on 18 Jul 2011 at 12:00

GoogleCodeExporter commented 9 years ago

Original comment by trond.no...@gmail.com on 18 Jul 2011 at 5:27