Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cmemcahe_hash 0 values being translated to 1 #152

Merged
merged 2 commits into from
Apr 16, 2023

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