Skip to content

Conversation

hyperair
Copy link
Contributor

Some keys which should be hashed to 0 end up being hashed to 1 in cmemcache_hash. This results in a discrepancy between the server hash chosen by python-memcached and pylibmc (and other libmemcached derivatives).

Remove the or 1 that causes this.

An example of a key that is hashed to 0 by libmemcached using crc32+modula is ob.

@linsomniac
Copy link
Owner

That is a good catch, thanks for the patch. That "or 1" dates back to 2009 when that code was originally imported. I can't see that this patch is a problem, but I also can't confirm (or disconfirm) the need for the "or 1".

@linsomniac linsomniac merged commit 9320f72 into linsomniac:master Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants