Custom hashing (partitioning) functions

Sargun Dhillon sargun at sargun.me
Mon Jan 20 16:08:54 EST 2014


So, I don't know how many people are aware of if, but Riak supports
custom hashing (partitioning) functions. It's exposed as a bucket
property (chash_keyfun), in which you can deploy your own code to hash
keys to ensure data locality to specific vnodes. This can come in
handy when doing custom mapreduce jobs, riak_pipe, or riak_core
applications.

After playing around with this feature set quite a bit recently, it
seems like there are some places that don't entirely respect this.
Specifically, the place where I'm looking at right now is
riak_kv_pipe_get, when try_preflist gets called (if try_partition
falls through), it falls back to riak_core_util:chash_key (L188), as
opposed to looking at the riak_pipe chashfun, or the bucket chashfun.
What's the approach that most people have taken here with custom hash
functions?




More information about the riak-users mailing list