-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
i think we should take crc32 hash value conflict in add function, as shown in
// need c.Lock() before calling
func (c *Consistent) add(elt string) {
for i := 0; i < c.NumberOfReplicas; i++ {
c.circle[c.hashKey(c.eltKey(elt, i))] = elt
}
c.members[elt] = true
c.updateSortedHashes()
c.count++
}
the c.hashKey(c.eltKey(elt, i)) may return a conflict, i.e., a duplicate crc32 hash value and in such a situation we can not guarantee that we can have specified NumberOfReplicas for each node.
For more info, an example can be get in carbon
def add_node(self, node):
self.nodes.add(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)
Metadata
Metadata
Assignees
Labels
No labels