Skip to content

single get() failover doesnt work! #154

Closed
@stangl

Description

@stangl

php-memcached: 2.2.0
libmemcached: 1.0.16

$a = new Memcached();
$a->setOption(Memcached::OPT_BINARY_PROTOCOL,true);
$a->setOption(Memcached::OPT_REMOVE_FAILED_SERVERS, true);
$a->setOption(Memcached::OPT_DISTRIBUTION,Memcached::DISTRIBUTION_CONSISTENT);
$a->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE,true);
$a->addServer('working_host', 11211);
$a->addServer('non_working_host', 11211);

$a->set('key_on_non_working_host', 1); // = TRUE -> WORKS! value stored on working_host

// Setup new connection
$b = new Memcached();
$b->setOption(Memcached::OPT_BINARY_PROTOCOL,true);
$b->setOption(Memcached::OPT_REMOVE_FAILED_SERVERS, true);
$b->setOption(Memcached::OPT_DISTRIBUTION,Memcached::DISTRIBUTION_CONSISTENT);
$b->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE,true);
$b->addServer('working_host', 11211);
$b->addServer('non_working_host', 11211);

$b->get('key_on_non_working_host'); // = FALSE -> DOENST WORK!

// we have to do AFTER first false-get():

$b->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE,true);
$b->get('key_on_non_working_host'); // = TRUE -> SECOND CALL NOW WORKS!

this failure doenst happen if the inital set() and the get() are called in same connection. then it seems the system "remember" from set() that the non_working_host istn available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions