Subject: | fails to remove dead servers from loop on initialize |
The client lib does not remove dead servers from the loop when trying to
store data. this causes consistent failures in storing data that's
distributed by the hashing mechanism to those servers.
I hope this can get fixed soon since everything else rocks, this issue
is proving to be a show stopper.
Thanks
Subject: | removes_dead_hosts_from_loop.t |
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 2;
use Cache::Memcached;
use Cache::Memcached::Fast;
my $config = {
servers => [
'127.0.0.1:11211',
'127.0.0.1:11212', # non-existent
'127.0.0.1:11213', # non-existent
],
};
my $simple = Cache::Memcached->new($config);
my $fast = Cache::Memcached::Fast->new($config);
# expect first time failures.
$simple->set($_, $_) for 1..100;
# second time the failed servers should not be used.
$simple->set($_, $_) for 1..100;
is_deeply(
[ map { $simple->get($_) } (1..100) ],
[ 1..100 ],
'Cache::Memcached removes failed servers from loop'
);
$simple->flush_all;
# expect first time failures.
$fast->set($_, $_) for 1..100;
# second time the failed servers should not be used.
$fast->set($_, $_) for 1..100;
is_deeply(
[ map { $fast->get($_) } (1..100) ],
[ 1..100 ],
'Cache::Memcached::Fast removes failed servers from loop'
);