php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59270 failover doesn't work
Submitted: 2010-06-17 12:07 UTC Modified: 2012-03-07 17:36 UTC
From: somnium at ukr dot net Assigned: andrei (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.2.4 OS: Ubuntu 8.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: somnium at ukr dot net
New email:
PHP Version: OS:

 

 [2010-06-17 12:07 UTC] somnium at ukr dot net
Description:
------------
If one of two memcached servers is down - system do not selects working memcached server.
In reproduce code server2 is down and server1 is OK. If we remove server2 from $memcache->addServers() method - then code works OK.

ОS: Ubuntu 8.04
Repcached: 2.2
PECL Memcached: 1.0.2
libmemcached: 0.40
PHP: 5.2.4

Reproduce code:
---------------
$memcache = new Memcached();

$memcache->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$memcache->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);

// server2 is down and server1 is OK.
$memcache->addServers(array('server1', 11211), array('server2', 11211));

$memcache->set('var1', 'qwerty');
echo $memcache->get('var1');


Expected result:
----------------
Must be shown "qwerty"

Actual result:
--------------
Nothing shown. (getResultCode() returns RES_WRITE_FAILURE = 5)

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-17 12:47 UTC] andrei@php.net
Thank you for taking the time to write to us, but this is not
a bug.

libmemcached does not do failover like this by default. You 
can use replication with pecl/memcached that's in master 
branch on Github though.
 [2010-06-18 04:08 UTC] somnium at ukr dot net
And I also want to mention that if in servers pool will be server that is down then method Memcached::getStats() will return error.
 [2010-06-18 04:09 UTC] somnium at ukr dot net
Hmmm...I'm not realy understood you.
I've using repcached for replicating data between servers. I'd run server2 as master and server1 as a slave (made test via telnet to check data replicates correctly). Then I'd put down server2(master) and tried to run my test code with server1 and server2 in pool - and I got error RES_WRITE_FAILURE. But I expects that memcached chooses a different server...
Anyway, if libmemcached does not do failover - for what purposes there is options like OPT_RETRY_TIMEOUT, OPT_SERVER_FAILURE_LIMIT? It seems I don't understand something...
 [2010-06-18 08:25 UTC] somnium at ukr dot net
I reopened this issue. Please see my two previous comments.
 [2010-06-18 12:54 UTC] andrei@php.net
pecl/memcached is a pretty thin wrapper on top of 
libmemcached, so you'd be better off asking these questions 
on libmemcached mailing list. Here's the meaning of the 
settings you're asking about (from manpages):


       MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
           This number of times a host can have an error 
before it is disabled.


       MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
           When enabled a host which is problematic will 
only be checked for usage based on the amount of
           time set by this behavior.
 [2012-03-07 17:36 UTC] andrei@php.net
Closing because of age. Please try version 2.0.1 and reopen if this still occurs.
 [2012-03-07 17:36 UTC] andrei@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: andrei
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 07 23:01:27 2024 UTC