Riak claim & wants funs.

Guido Medina guido.medina at temetra.com
Tue Jan 28 12:25:02 EST 2014


Hi,

I'm trying to get different distributions on the ring and I used before 
the following Erlang code, which for Riak 1.4.7 is not re-triggering a 
re-calculation:

  * What is the latest algorithm version? v3? And is there a list of the
    last 2 or 3 versions? Sometimes depending on the keys one algorithm
    can fit better than the other (From what I have learned)

    *Changes algorithm:*

    rpc:multicall(application, set_env, [riak_core, wants_claim_fun,
    {riak_core_claim, wants_claim_v3}]).
    rpc:multicall(application, set_env, [riak_core, choose_claim_fun,
    {riak_core_claim, choose_claim_v3}]).

  * Not working in Riak 1.4.7, any Riak/Erlang expert know why?

    *Triggers a recalculation:*

    fun() ->
            Node = node(),
            riak_core_ring_manager:ring_trans(
              fun(Ring, []) ->
                      case riak_core_ring:claimant(Ring) of
                          Node ->
                              %% Set next to []
                              NewRing1 = setelement(7, Ring, []),
                              %% Increment ring version
                              RVsn1 = element(11, NewRing1),
                              RVsn2 = vclock:increment(Node, RVsn1),
                              NewRing2 = setelement(11, NewRing1, RVsn2),
                              {new_ring, NewRing2};
                          _ ->
                              io:format("Failed. This node is not the
    claimant~n"),
                              ignore
                      end
              end, []),
            ok
    end().


Regards,

Guido.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140128/b0445544/attachment.html>


More information about the riak-users mailing list