Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Murmur3 Hash Algorithm Used in Cassandra

Tags:

cassandra

I'm trying to reproduce the Murmur3 hashing in Cassandra. Does anyone know how to get at the actual hash values used in the row keys? I just need some key - hash value pairs from my data to check that my implementation of the hashing is correct.

Alex

like image 589
axle_h Avatar asked Oct 04 '22 03:10

axle_h


1 Answers

Ask Cassandra! Insert some data in your table. Afterwards, you can use the token function in a select query to get the used token values. For example:

select token(id), id from myTable;

A composite partition key is serialized as n-times a byte array (that is always prepended with a short indicating its length) containing the serialized value of your key element and a closing 0. It's unclear to me what these closing zeros are for. Has something to do with SuperColumns...

like image 126
Joost Reuzel Avatar answered Oct 10 '22 02:10

Joost Reuzel