Skip to content

Commit

Permalink
Fixes sibling explosion bug caused by forwarding coordination request…
Browse files Browse the repository at this point in the history
…s during

handoff

Forward port of this issue from 1.4 to 2.0:
basho/riak_kv#1046

Original fix is:
76cbdc2

There is a matching PR for riak_kv
  • Loading branch information
Gordon Guthrie committed Dec 15, 2014
1 parent 8a01777 commit 61854d0
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/riak_core_vnode.erl
Expand Up @@ -417,24 +417,30 @@ vnode_handoff_command(Sender, Request, ForwardTo,
riak_core_vnode_worker_pool:handle_work(Pool, Work, From),
continue(State, NewModState);
{forward, NewModState} ->
case HOType of
%% resize op and transfer ongoing
resize_transfer -> vnode_forward(resize, ForwardTo, Sender,
{resize_forward, Request}, State);
%% resize op ongoing, no resize transfer ongoing, arrive here
%% via forward_or_vnode_command
undefined -> vnode_forward(resize, ForwardTo, Sender,
{resize_forward, Request}, State);
%% normal explicit forwarding during ownership transfer
_ -> vnode_forward(explicit, HOTarget, Sender, Request, State)
end,
forward_request(HOType, Request, HOTarget, ForwardTo, Sender, State),
continue(State, NewModState);
{forward, NewReq, NewModState} ->
forward_request(HOType, NewReq, HOTarget, ForwardTo, Sender, State),
continue(State, NewModState);
{drop, NewModState} ->
continue(State, NewModState);
{stop, Reason, NewModState} ->
{stop, Reason, State#state{modstate=NewModState}}
end.

%% @private wrap the request for resize forwards, and use the resize
%% target.
forward_request(resize_transfer, Request, _HOTarget, ResizeTarget, Sender, State) ->
%% resize op and transfer ongoing
vnode_forward(resize, ResizeTarget, Sender, {resize_forward, Request}, State);
forward_request(undefined, Request, _HOTarget, ResizeTarget, Sender, State) ->
%% resize op ongoing, no resize transfer ongoing, arrive here
%% via forward_or_vnode_command
vnode_forward(resize, ResizeTarget, Sender, {resize_forward, Request}, State);
forward_request(_, Request, HOTarget, _ResizeTarget, Sender, State) ->
%% normal explicit forwarding during owhership transfer
vnode_forward(explicit, HOTarget, Sender, Request, State).

vnode_forward(Type, ForwardTo, Sender, Request, State) ->
lager:debug("Forwarding (~p) {~p,~p} -> ~p~n",
[Type, State#state.index, node(), ForwardTo]),
Expand Down

5 comments on commit 61854d0

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from seancribbs
at 61854d0

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_core/bug/gg/gh1046-forwardport = 61854d0 into borshop-integration-672-bug/gg/gh1046-forwardport

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_core/bug/gg/gh1046-forwardport = 61854d0 merged ok, testing candidate = f0a7ab2

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding 2.0 to borshop-integration-672-bug/gg/gh1046-forwardport = f0a7ab2

Please sign in to comment.