I'm following the instructions at
http://docs.basho.com/riak/1.2.0/cookbooks/Erlang-Named-Functions/ to setup a
custom hash function, how safe or not is it to assume its the same process ?
Currently when i try and PUT the bucket config to specify the new function i
get back
{error,badarg,
[{erlang,list_to_existing_atom,["sfdc_hash"],[]},
{riak_kv_wm_props,erlify_bucket_prop,1,
[{file,"src/riak_kv_wm_props.erl"},{line,304}]},
{lists,map,2,[{file,"lists.erl"},{line,1173}]},
{riak_kv_wm_props,accept_bucket_body,2,
[{file,"src/riak_kv_wm_props.erl"},{line,201}]},
{webmachine_resource,resource_call,3,
[{file,"src/webmachine_resource.erl"},{line,169}]},
{webmachine_resource,do,3,
[{file,"src/webmachine_resource.erl"},{line,128}]},
{webmachine_decision_core,resource_call,1,
[{file,"src/webmachine_decision_core.erl"},{line,48}]},
{webmachine_decision_core,accept_helper,0,
My .beam file is in /tmp/riak_fun, and i added {add_paths, ["/tmp/riak_fun"]},
to the riak_kv section in the app.config, and the .beam file is world readable.
I'm running this to set the properties
curl -v --data-binary @props.json -H Content-Type:application/json
http://riak1.local:8098/riak/ex -X PUT
props.json contains
{"props": { "chash_keyfun":{"mod":"sfdc_hash","fun":"kv_hash_fun"} } }
Is there a more detailed log somewhere? is there an easy way to see if riak can
actually load my .beam file?
the source for the module is very straighforward (we just want to hash on part
of the key)
-module(sfdc_hash).
-export([extract_id/1, kv_hash_fun/1]).
extract_id(Key) ->
case binary:match(Key,<<",">>) of
{Pos, 1} -> binary:part(Key, 0, Pos);
_ -> Key
end.
kv_hash_fun({Bucket,Key}) ->
chash:key_of({Bucket, extract_id(Key)}).
This is with riak 1.2.0 on Unbuntu.
Thanks
Simon
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com