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

Solve inconsistent hashing behavior #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solve inconsistent hashing behavior #45

wants to merge 1 commit into from

Conversation

tcf909
Copy link

@tcf909 tcf909 commented Aug 12, 2016

In a dynamic cluster (adding and removing nodes), there is a chance when dividing we receive an infinite repeating result which floors to a value that would be less than it needs to be to maintain a consistent hash with a prior state (in which the dividing result is a full integer, or not repeating).

Using round here seems to resolve the issue.

Test case: create a cluster of 6, distribute keys, add a new pnode (total 7), redistribute keys, add a new pnode (total 8), redistribute keys and then run through all keys and check that they exist in the correct location (failure).

solves issue #43

In a dynamic cluster (adding and removing nodes), there is a chance when dividing we receive an infinite repeating result which floors to a value that would be less than it needs to be to maintain a consistent hash with a prior state (in which the dividing result is a full integer, or not repeating).

Using round here seems to resolve the issue.

Test case: create a cluster of 6, distribute keys, add a new pnode (total 7), redistribute keys, add a new pnode (total 8), redistribute keys and then run through all keys and check that they exist in the correct location (failure).
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.

1 participant