Skip to content

Commit

Permalink
Prevent hash ring positional collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
jssjr committed Dec 17, 2013
1 parent 4c5a8ca commit 024f9e6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/carbon/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def add_node(self, node):
for i in range(self.replica_count):
replica_key = "%s:%d" % (node, i)
position = self.compute_ring_position(replica_key)
while position in [r[0] for r in self.ring]:
position = position + 1
entry = (position, node)
bisect.insort(self.ring, entry)

Expand Down

0 comments on commit 024f9e6

Please sign in to comment.