php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59472 memcache.hash_strategy issues
Submitted: 2010-10-22 11:00 UTC Modified: -
From: bellosthomas at gmail dot com Assigned:
Status: Open Package: memcache (PECL)
PHP Version: 5.3.2 OS: CentOS 5.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bellosthomas at gmail dot com
New email:
PHP Version: OS:

 

 [2010-10-22 11:00 UTC] bellosthomas at gmail dot com
Description:
------------
Hi,

Using php 5.3.3 and memcache 3.0.3.

I have 2 centos (master and slave) running one memcached instance each.
Additionaly I use the below setting
memcache.hash_strategy = consistent

Which, based on the documentation:
"allows servers to be added or removed from the pool without causing keys to be remapped"

I start both instances and navigate through the app causing items to be stored on the servers.
Using memcache.php I see that master has 5 items and slave 2 items.

I bring down the master and navigate through the app, which causes the items
that were previously stored on the master, to be cached on the slave.
So far so good.

I then bring up the master and again navigate through the app. 
The items are now cached again to the master, meaning that both nodes now have cached the same items.

Now, consider the following scenario.
I update a database item, which (due to the above) is stored on both nodes. 
I then do a get on the item's key from the server pool and I get back the cached item from master.
I update its contents and put it back to the cache.

For some reason, master crashes. However, when I check the cache for its key, I get a hit since it is
on the slave server, BUT the contents are old, out of sync with the database (bad news).


I would have expected that the key mapping would be such that it will not have to save keys to the 
master again, since they are already cached in the slave.




Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 04:01:27 2019 UTC