Hi!

I've applied this patch. It should be pushed within the hour.

Thanks,
        -Brian

On Apr 14, 2009, at 3:50 AM, Nikhils wrote:

Hi Brian,

A careful perusal of the memcached_mget_by_key() function revealed the bug.

The code was generating the serverid by using the master key first. However if the serverid was 0, the following check was causing re- evaluation of the serverid by using the buffer key leading to the query being sent to another server:

if (master_server_key) /* if the serverid had evaluated to zero, we go to else */
      server_key= master_server_key;
    else
server_key= memcached_generate_hash(ptr, keys[x], key_length[x]);

After fixing this, the *_by_key logic appears to be working just fine.

Please find attached, a patch (diff -c format) which fixes this.

Regards,
Nikhils

On Tue, Apr 14, 2009 at 12:27 PM, Nikhils <[email protected]> wrote:
Hi,

I recently shifted to using the memcached_get/set_by_key APIs. The trouble is that even after warming the cache with all of the content, a subsequent query to fetch the key/value pair fails with a not found error. I am seeing this behaviour in a 2-node memcached cluster.

Its occurring consistently and on reverting back to using the normal memcached_get/set APIs, the key/value pairs can be retrieved appropriately! However I do need to use these by_key APIs for my data consistency logic.

I have added appropriate logging information in my C code (am linking to libmemcached 0.27) and confirmed that the master key is the same in both set_by_key/get_by_key calls.

Anything obvious that I am missing? Has anyone observed such dubious behaviour before with these by_key calls? Comments appreciated.

Regards,
Nikhils

<libmemcached_mget_by_key_bug.patch>

--
_______________________________________________________
Brian "Krow" Aker, brian at tangent.org
Seattle, Washington
http://krow.net/                     <-- Me
http://tangent.org/                <-- Software
_______________________________________________________
You can't grep a dead tree.



Reply via email to