Skip to content

Bug: hash collision leads to inconsistent sharding #5

Description

@or-else

A hash collision is possible at /consistent.go#L76. That means the consistency of results is dependent on the order of Add() calls.

I think the easiest fix is to get rid of Consistent.circle altogether and just use .sortedHashes to keep something like struct {hash uint32, key string}.
search() would have to be updated to compare not just the hashes but key values too.

Regardless of this bug, Consistent.circle adds unnecessary complexity.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions