for ( $i=0; $i<100; $i++ ) {
sleep(1); var_dump($m->set('key', 1));
if ($m->getResultCode() > 0) {
if ($m->getResultCode() !== Memcached::RES_NOTFOUND ) { echo $m->getResultMessage().PHP_EOL;
}
}
}
?>
After several successful cycles, dropping down second server (192.168.0.1).
Expected behavior:
1. After dropping connection and polling timeout, server will be marked as FAULTY.
2. After first connecting attempt, server will be marked as DEAD. Memcached ext./libmemcached will redistribute key to first memcached server (127.0.0.1).
Observed behavior:
1. After dropping connection and polling timeout, server is marked as FAULTY? (It's an assumption, cannot check).
2. Memcached ext./libmemcached open connection to first server (127.0.0.1), SUCCESSFULLY stores the key AND getResultMessage returns "SERVER IS MARKED DEAD". (It's normal)
3. At the next cycle, Memcached ext./libmemcached successfully stores the key. (It's normal, too)
4. At the next and further cycles, Memcached ext./libmemcached return FALSE on set() operation and getResultMessage returns "SERVER IS MARKED DEAD".
It's hard confusing. Why just using first server further?
I check memcached extension's sources and believe it pass ketama options to libmemcached well.
So I propose that unexpected behavior is a bug. Or maybe I use invalid option set with memcached extension/libmemcached?
All software is self-builded: PHP 5.3.10 + memcached extension 2.1.0, linked with libmemcached 1.0.14. Memcached: :OPT_COMPRESSIO N, false); Memcached: :OPT_CONNECT_ TIMEOUT, 10); Memcached: :OPT_RETRY_ TIMEOUT, 1); Memcached: :OPT_DISTRIBUTI ON, Memcached: :DISTRIBUTION_ CONSISTENT) ; Memcached: :OPT_LIBKETAMA_ COMPATIBLE, true); Memcached: :OPT_SERVER_ FAILURE_ LIMIT, 1); Memcached: :OPT_REMOVE_ FAILED_ SERVERS, true);
Running simple PHP-script:
<?php
$m = new Memcached();
$m->setOption(
$m->setOption(
$m->setOption(
// ketama options
$m->setOption(
$m->setOption(
$m->setOption(
$m->setOption(
$servers = array(); 192.168. 0.1', 11212, 100); $servers) ;
$servers[] = array('127.0.0.1', 11211, 100);
$servers[] = array('
$m->addServers(
for ( $i=0; $i<100; $i++ ) {
var_dump( $m->set( 'key', 1)); ode() > 0) { ode() !== Memcached: :RES_NOTFOUND ) {
echo $m->getResultMe ssage() .PHP_EOL;
sleep(1);
if ($m->getResultC
if ($m->getResultC
}
}
}
?>
After several successful cycles, dropping down second server (192.168.0.1).
Expected behavior:
1. After dropping connection and polling timeout, server will be marked as FAULTY.
2. After first connecting attempt, server will be marked as DEAD. Memcached ext./libmemcached will redistribute key to first memcached server (127.0.0.1).
Observed behavior:
1. After dropping connection and polling timeout, server is marked as FAULTY? (It's an assumption, cannot check).
2. Memcached ext./libmemcached open connection to first server (127.0.0.1), SUCCESSFULLY stores the key AND getResultMessage returns "SERVER IS MARKED DEAD". (It's normal)
3. At the next cycle, Memcached ext./libmemcached successfully stores the key. (It's normal, too)
4. At the next and further cycles, Memcached ext./libmemcached return FALSE on set() operation and getResultMessage returns "SERVER IS MARKED DEAD".
It's hard confusing. Why just using first server further?
I check memcached extension's sources and believe it pass ketama options to libmemcached well. libmemcached?
So I propose that unexpected behavior is a bug. Or maybe I use invalid option set with memcached extension/