"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/lru-crawler.t" between
memcached-1.6.8.tar.gz and memcached-1.6.9.tar.gz

About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

lru-crawler.t  (memcached-1.6.8):lru-crawler.t  (memcached-1.6.9)
#!/usr/bin/perl #!/usr/bin/perl
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 224; use Test::More tests => 70257;
use FindBin qw($Bin); use FindBin qw($Bin);
use lib "$Bin/lib"; use lib "$Bin/lib";
use MemcachedTest; use MemcachedTest;
my $server = new_memcached('-m 32 -o no_modern'); my $server = new_memcached('-m 32 -o no_modern');
{ {
my $stats = mem_stats($server->sock, ' settings'); my $stats = mem_stats($server->sock, ' settings');
is($stats->{lru_crawler}, "no"); is($stats->{lru_crawler}, "no");
} }
skipping to change at line 80 skipping to change at line 80
# Check that crawler metadump works correctly. # Check that crawler metadump works correctly.
{ {
print $sock "lru_crawler metadump all\r\n"; print $sock "lru_crawler metadump all\r\n";
my $count = 0; my $count = 0;
while (<$sock>) { while (<$sock>) {
last if /^(\.|END)/; last if /^(\.|END)/;
/^(key=) (\S+).*([^\r\n]+)/; /^(key=) (\S+).*([^\r\n]+)/;
$count++; $count++;
} }
is ($count, 60); is ($count, 60, "metadump all returns all items");
} }
for (1 .. 30) { for (1 .. 30) {
mem_get_is($sock, "ifoo$_", "ok"); mem_get_is($sock, "ifoo$_", "ok");
mem_get_is($sock, "lfoo$_", "ok"); mem_get_is($sock, "lfoo$_", "ok");
mem_get_is($sock, "sfoo$_", undef); mem_get_is($sock, "sfoo$_", undef);
} }
# add a few more items into a different slab class
my $mfdata = 'x' x 512;
for (1 .. 30) {
print $sock "set mfoo$_ 0 0 512\r\n$mfdata\r\n";
is(scalar <$sock>, "STORED\r\n", "stored key");
}
# set enough small values to ensure bucket chaining happens
# ... but not enough that hash table expansion happens.
# TODO: check hash power level?
my %bfoo = ();
for (1 .. 70000) {
print $sock "set bfoo$_ 0 0 1 noreply\r\nz\r\n";
$bfoo{$_} = 1;
}
{
print $sock "version\r\n";
my $res = <$sock>;
like($res, qr/^VERSION/, "bulk sets completed");
}
# Check metadump hash table walk returns correct number of items.
{
print $sock "lru_crawler metadump hash\r\n";
my $count = 0;
while (<$sock>) {
last if /^(\.|END)/;
if (/^key=bfoo(\S+)/) {
ok(exists $bfoo{$1}, "found bfoo key $1 is still in test hash");
delete $bfoo{$1};
}
$count++;
}
is ($count, 70090, "metadump hash returns all items");
is ((keys %bfoo), 0, "metadump found all bfoo keys");
}
print $sock "lru_crawler disable\r\n"; print $sock "lru_crawler disable\r\n";
is(scalar <$sock>, "OK\r\n", "disabled lru crawler"); is(scalar <$sock>, "OK\r\n", "disabled lru crawler");
my $settings_match = 0; my $settings_match = 0;
# TODO: we retry a few times since the settings value is changed # TODO: we retry a few times since the settings value is changed
# outside of a memory barrier, but the thread is stopped before the OK is # outside of a memory barrier, but the thread is stopped before the OK is
# returned. # returned.
# At some point better handling of the setings synchronization should happen. # At some point better handling of the setings synchronization should happen.
for (1 .. 10) { for (1 .. 10) {
my $stats = mem_stats($server->sock, ' settings'); my $stats = mem_stats($server->sock, ' settings');
if ($stats->{lru_crawler} eq "no") { if ($stats->{lru_crawler} eq "no") {
 End of changes. 3 change blocks. 
2 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)