diff options
-rw-r--r-- | crawler.c | 8 | ||||
-rw-r--r-- | t/lru-crawler.t | 14 |
2 files changed, 21 insertions, 1 deletions
@@ -533,6 +533,14 @@ static int do_lru_crawler_start(uint32_t id, uint32_t remaining) { if (remaining == LRU_CRAWLER_CAP_REMAINING) { remaining = do_get_lru_size(sid); } + /* Values for remaining: + * remaining = 0 + * - scan all elements, until a NULL is reached + * - if empty, NULL is reached right away + * remaining = n + 1 + * - first n elements are parsed (or until a NULL is reached) + */ + if (remaining) remaining++; crawlers[sid].remaining = remaining; crawlers[sid].slabs_clsid = sid; crawlers[sid].reclaimed = 0; diff --git a/t/lru-crawler.t b/t/lru-crawler.t index 18375c2..4e94fb3 100644 --- a/t/lru-crawler.t +++ b/t/lru-crawler.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 221; +use Test::More tests => 222; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; @@ -60,6 +60,18 @@ while (1) { is($items->{"items:1:crawler_reclaimed"}, 30, "slab1 has 30 reclaims"); } +# Check that crawler metadump works correctly. +{ + print $sock "lru_crawler metadump all\r\n"; + my $count = 0; + while (<$sock>) { + last if /^(\.|END)/; + /^(key=) (\S+).*([^\r\n]+)/; + $count++; + } + is ($count, 60); +} + for (1 .. 30) { mem_get_is($sock, "ifoo$_", "ok"); mem_get_is($sock, "lfoo$_", "ok"); |