summaryrefslogtreecommitdiff
path: root/t/slabs-reassign2.t
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2015-09-28 17:32:49 -0700
committerdormando <dormando@rydia.net>2015-11-18 23:14:35 -0800
commit004e221190cd5521593db5f462fd51f998a3265f (patch)
tree77759597774735be97f420142a449c874cfe6207 /t/slabs-reassign2.t
parent826403dd5e83bfe9cdf4feb412ad7e5ef983f9e5 (diff)
downloadmemcached-004e221190cd5521593db5f462fd51f998a3265f.tar.gz
slab mover rescues valid items with free chunks
During a slab page move items are typically ejected regardless of their validity. Now, if an item is valid and free chunks are available in the same slab class, copy the item over and replace it. It's up to external systems to try to ensure free chunks are available before moving a slab page. If there is no memory it will simply evict them as normal. Also adds counters so we can finally tell how often these cases happen.
Diffstat (limited to 't/slabs-reassign2.t')
-rw-r--r--t/slabs-reassign2.t9
1 files changed, 6 insertions, 3 deletions
diff --git a/t/slabs-reassign2.t b/t/slabs-reassign2.t
index d0a8518..8de4a05 100644
--- a/t/slabs-reassign2.t
+++ b/t/slabs-reassign2.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 5;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
@@ -42,7 +42,7 @@ for (1 .. $keycount) {
} else {
$body .= scalar(<$sock>) . scalar(<$sock>);
if ($body ne $expected) {
- print STDERR "Something terrible has happened: $body\n";
+ print STDERR "Something terrible has happened: $expected\nBODY:\n$body\nDONETEST\n";
} else {
$hits++;
}
@@ -52,10 +52,13 @@ for (1 .. $keycount) {
{
my $stats = mem_stats($sock);
- cmp_ok($stats->{evictions}, '<', 1000, 'evictions were less than 1000');
+ cmp_ok($stats->{evictions}, '<', 2000, 'evictions were less than 2000');
# for ('evictions', 'reclaimed', 'curr_items', 'cmd_set', 'bytes') {
# print STDERR "$_: ", $stats->{$_}, "\n";
# }
}
cmp_ok($hits, '>', 4000, 'were able to fetch back 2/3rds of 8k keys');
+my $stats_done = mem_stats($sock);
+cmp_ok($stats_done->{slab_reassign_rescues}, '>', 0, 'some reassign rescues happened');
+cmp_ok($stats_done->{slab_reassign_evictions}, '>', 0, 'some reassing evictions happened');