locating an object

Bogunov bogunov at gmail.com
Thu May 10 16:01:00 EDT 2012


Look here.
https://github.com/basho/riak_kv/blob/master/src/riak_kv_get_fsm.erl

prepare(timeout, StateData=#state{bkey=BKey={Bucket,_Key}}) ->
    {ok, Ring} = riak_core_ring_manager:get_my_ring(),
    BucketProps = riak_core_bucket:get_bucket(Bucket, Ring),
    DocIdx = riak_core_util:chash_key(BKey),
    N = proplists:get_value(n_val,BucketProps),
    UpNodes = riak_core_node_watcher:nodes(riak_kv),
    Preflist2 = riak_core_apl:get_apl_ann(DocIdx, N, Ring, UpNodes).


Just do riak attach and enter the code b hand.

Preflist2 is what you need. Actually it have vnode names, but correspondign
vnodes are trivial to locate.




On Thu, May 10, 2012 at 11:48 PM, Sam Lang <samlang at gmail.com> wrote:

>
> Hello,
>
> Is there a way to query a riak object to get its current locations, i.e.
> which nodes/vnodes in the ring own the object?
>
> Thanks,
> -sam
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>


-- 
email: bogunov at gmail.com
skype: i.bogunov
phone: +7 903 131 8499
Regards, Bogunov Ilya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120511/980d7c5d/attachment.html>


More information about the riak-users mailing list