-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new per-slab item stat evicted_nonzero
If an item with exptime != 0 (non unlimited) is evicted the evicted_nonzero counter is incremented. The number of evicted items with no expire time is (evicted - evicted_nonzero)
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/perl | ||
# Test the 'stats items' evictions counters. | ||
|
||
use strict; | ||
use Test::More tests => 92; | ||
use FindBin qw($Bin); | ||
use lib "$Bin/lib"; | ||
use MemcachedTest; | ||
|
||
my $server = new_memcached("-m 3"); | ||
my $sock = $server->sock; | ||
my $value = "B"x66560; | ||
my $key = 0; | ||
|
||
# These aren't set to expire. | ||
for ($key = 0; $key < 40; $key++) { | ||
print $sock "set key$key 0 0 66560\r\n$value\r\n"; | ||
is(scalar <$sock>, "STORED\r\n", "stored key$key"); | ||
} | ||
|
||
# These ones would expire in 600 seconds. | ||
for ($key = 0; $key < 50; $key++) { | ||
print $sock "set key$key 0 600 66560\r\n$value\r\n"; | ||
is(scalar <$sock>, "STORED\r\n", "stored key$key"); | ||
} | ||
|
||
my $stats = mem_stats($sock, "items"); | ||
my $evicted = $stats->{"items:31:evicted"}; | ||
isnt($evicted, "0", "check evicted"); | ||
my $evicted_nonzero = $stats->{"items:31:evicted_nonzero"}; | ||
isnt($evicted_nonzero, "0", "check evicted_nonzero"); |