← Back to team overview

graphite-dev team mailing list archive

[Question #673131]: Why does ConsistentHashRing cut hashes down to 16 bits?

 

New question #673131 on Graphite:
https://answers.launchpad.net/graphite/+question/673131

I'm looking to port the ConsistentHashRing implementation to a different language and I'm trying to get my head around various implementation details, but this one has eluded me so far. I was tinkering with the code as-is when I noticed all the ring positions were <= 65535 even though fnv1a should be returning 32bit hashes.

The code in question: https://github.com/graphite-project/carbon/blob/master/lib/carbon/hashing.py#L42-L53

I know from the current rev it _looks_ like it's to accomodate 16bit algos, but after looking back through the blame history the original implementation didn't look like it was accomodating those, but still cut the hashes in half. I can't really think of a good reason for this since the hash positions are going to be stored as full size integers anyway. I was hoping to glean some reasoning from the commit/PR messages but there's not much to be found, even all the way back to the initial commit 8+ years ago.

Can anyone clarify this for me?

-- 
You received this question notification because your team graphite-dev
is an answer contact for Graphite.