Comment #1 on issue 183 by [email protected]: Reclaiming the space of
flushed items is needed.
http://code.google.com/p/memcached/issues/detail?id=183
There is one more place in do_item_alloc() that the flushed items should be
reclaimed.
for (search = tails[id]; tries > 0 && search != NULL; tries--,
search=search->prev) {
if (search->refcount == 0) {
#if 1 // NEW CODE
if ((search->exptime != 0 && search->exptime <
current_time) ||
(search->time < settings.oldest_live &&
settings.oldest_live <= current_time)) {
itemstats[id].evicted++;
itemstats[id].evicted_time = current_time -
search->time;
if (search->exptime != 0)
itemstats[id].evicted_nonzero++;
STATS_LOCK();
stats.evictions++;
STATS_UNLOCK();
} else {
itemstats[id].reclaimed++;
STATS_LOCK();
stats.reclaimed++;
STATS_UNLOCK();
}
#else
if (search->exptime == 0 || search->exptime > current_time)
{
itemstats[id].evicted++;
itemstats[id].evicted_time = current_time -
search->time;
if (search->exptime != 0)
itemstats[id].evicted_nonzero++;
STATS_LOCK();
stats.evictions++;
STATS_UNLOCK();
} else {
itemstats[id].reclaimed++;
STATS_LOCK();
stats.reclaimed++;
STATS_UNLOCK();
}
#endif
do_item_unlink(search);
break;
}
}