Anonymous avatar Anonymous committed 2ec123e

allow claim funs to take an arbitrary number of partitions

Comments (0)

Files changed (1)

src/riak_connect.erl

     case NeedsIndexes of
         no -> 
             Ring;
-        {yes, NumToClaim} ->
-            riak_eventer:notify(riak_ring, want_claim, NumToClaim),
-            claim_indexes(Ring, NumToClaim)
+        {yes, _NumToClaim} ->
+            {CMod, CFun} = riak:get_app_env(choose_claim_fun),
+            NewRing = CMod:CFun(Ring),
+            claim_until_balanced(Ring)
     end.
 
-claim_indexes(Ring, 0) -> Ring;
-claim_indexes(Ring, NumToClaim) ->
-    {CMod, CFun} = riak:get_app_env(choose_claim_fun),
-    NewRing = CMod:CFun(Ring),
-    claim_indexes(NewRing, NumToClaim - 1).
-
 ensure_vnodes_started(Ring) ->
     VNodes2Start = case length(riak_ring:all_members(Ring)) of
        1 -> riak_ring:my_indices(Ring);
     end,
     ExitRing = lists:foldl(F, Ring, Indices),
     riak_ring_manager:set_my_ring(ExitRing),
-    
+
     % Send the ring to all other rings...
     [send_ring(X) || X <- riak_ring:all_members(Ring)],
     
     %% Is this line right?
     [gen_server:cast({riak_vnode_master, ExitingNode}, {start_vnode, P}) ||
-        P <- AllIndices].    
+        P <- AllIndices].    
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.