Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #331 from basho/jrw-resize-foh-fix

fix forced_ownership_handoff during resize
  • Loading branch information...
commit 7acc8c9c7a05a6ac44298763b6ca85c797634d26 2 parents 7b157f1 + d99549d
@jrwest jrwest authored
Showing with 21 additions and 7 deletions.
  1. +21 −7 src/riak_core_vnode_manager.erl
View
28 src/riak_core_vnode_manager.erl
@@ -421,7 +421,7 @@ handle_info(management_tick, State0) ->
_ ->
Repairs = State#state.repairs,
kill_repairs(Repairs, ownership_change),
- trigger_ownership_handoff(Transfers, Mods, State2),
+ trigger_ownership_handoff(Transfers, Mods, Ring, State2),
State2#state{repairs=[]}
end,
@@ -485,7 +485,7 @@ ring_changed(Ring, CHBin, State) ->
%% Trigger ownership transfers.
Transfers = riak_core_ring:pending_changes(Ring),
- trigger_ownership_handoff(Transfers, Mods, State3),
+ trigger_ownership_handoff(Transfers, Mods, Ring, State3),
State3.
maybe_ensure_vnodes_started(Ring) ->
@@ -514,11 +514,9 @@ schedule_management_timer() ->
10000),
erlang:send_after(ManagementTick, ?MODULE, management_tick).
-trigger_ownership_handoff(Transfers, Mods, State) ->
- Limit = app_helper:get_env(riak_core,
- forced_ownership_handoff,
- ?DEFAULT_OWNERSHIP_TRIGGER),
- Throttle = lists:sublist(Transfers, Limit),
+trigger_ownership_handoff(Transfers, Mods, Ring, State) ->
+ IsResizing = riak_core_ring:is_resizing(Ring),
+ Throttle = limit_ownership_handoff(Transfers, IsResizing),
Awaiting = [{Mod, Idx} || {Idx, Node, _, CMods, S} <- Throttle,
Mod <- Mods,
S =:= awaiting,
@@ -527,6 +525,22 @@ trigger_ownership_handoff(Transfers, Mods, State) ->
[maybe_trigger_handoff(Mod, Idx, State) || {Mod, Idx} <- Awaiting],
ok.
+limit_ownership_handoff(Transfers, IsResizing) ->
+ Limit = app_helper:get_env(riak_core,
+ forced_ownership_handoff,
+ ?DEFAULT_OWNERSHIP_TRIGGER),
+ limit_ownership_handoff(Limit, Transfers, IsResizing).
+
+limit_ownership_handoff(Limit, Transfers, false) ->
+ lists:sublist(Transfers, Limit);
+limit_ownership_handoff(Limit, Transfers, true) ->
+ %% if we are resizing: filter out completed resize operations,
+ %% since they remain in the list until all are complete. then
+ %% treat transfers as normal
+ Filtered = [Transfer || {_,_,_,_,Status}=Transfer <- Transfers,
+ Status =:= awaiting],
+ limit_ownership_handoff(Limit, Filtered, false).
+
%% @private
idx2vnode(Idx, Mod, _State=#state{idxtab=T}) ->
case ets:lookup(T, {Idx, Mod}) of
Please sign in to comment.
Something went wrong with that request. Please try again.