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 the bug of out of index of the the shard index #365

Merged
merged 4 commits into from
Dec 20, 2019
Merged

Fix the bug of out of index of the the shard index #365

merged 4 commits into from
Dec 20, 2019

Conversation

zhengrenjie
Copy link
Contributor

No description provided.

@ou-taku14
Copy link
Member

There is the hash function in String: hash = s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1](here s[n] is the nth character in the string). I have a problem why the string'hashcode is negative.

@ou-taku14
Copy link
Member

ou-taku14 commented Dec 20, 2019

And I have another problem: the original hash function provides uniform distribution of hash across the range of integers, and does the new hash function which is the function |hashCode()| have the same property? Because the number of the calculated hash value o will be small.

@ou-taku14 ou-taku14 closed this Dec 20, 2019
@ou-taku14 ou-taku14 reopened this Dec 20, 2019
@jovany-wang
Copy link
Collaborator

And I have another problem: the original hash function provides uniform distribution of hash across the range of integers, and does the new hash function which is the function |hashCode()| have the same property? Because the number of the calculated hash value o will be small.

Yes, you are right. But it's not a matter because 0/2^32 is almost 0.

@jovany-wang jovany-wang changed the title WorkerPool hashcode() bug. Fix the bug of out of index of the the shard index Dec 20, 2019
@senyer senyer added the bug Something isn't working label Dec 20, 2019
@senyer senyer merged commit bd0cd4b into distkv-project:master Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants