Circular hashing algorithms provide consistency given a static set of targets. For instance:
- I have an initial set of targets, let's call them
A
,B
andC
. - I have a key, let's call it
x
- I have a circular hashing function, let's call it
hash(key, targets)
- When I call
hash(x, [A,B,C])
,x
always hashes toA
Seems obvious enough. The fact that I always get A
given x
represents the consistency I expect when using circular hashes. However, let's now consider what happens if I add a new
node D
:
- My target set is rebalanced to include
A
,B
,C
, andD
- I reapply my key
x
tohash(x, [A,B,C,D])
- Because the circle is rebalanced, I am not guaranteed to get
A
anymore
Am I missing something or am I just out of luck? The problem is further exacerbated when you start reordering the nodes (e.g. hash(x, [B,A,D,C])
) or if you insert a new node in the middle of an existing node list (e.g. hash(x, [A,AA,B,C,D])
). I've looked a bit into the academic side of circular hashing and this type of "scaling consistency" doesn't seem to be one of its primary concerns. Maybe I'm just using the wrong type of hashing algorithm?