Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assume handoff if vnode exits 'normal' during queue requeuest #68

Merged
merged 3 commits into from
Mar 1, 2013

Conversation

russelldb
Copy link
Member

RE-OPENING…#64 closed in error.

The pipe_verify_handoff_blocking test in riak_test PR 154 demonstrated
that the monitor used by riak_pipe_vnode:queue_work_send may fire while
handoff is taking place. This situation is further described in
riak_pipe issue 63.

This commit addresses the problem by first checking whether the Reason
for the vnode's exit was 'normal'. If it was not 'normal', the
vnode_down error is returned as before. If it was 'normal', then it is
assumed that handoff happened, and the monitor is moved to the new
vnode, as indicated by riak_core_ring:next_owner/2.

The pipe_verify_handoff_blocking test in riak_test PR 154 demonstrated
that the monitor used by riak_pipe_vnode:queue_work_send may fire while
handoff is taking place. This situation is further described in
riak_pipe issue 63.

This commit addresses the problem by first checking whether the Reason
for the vnode's exit was 'normal'. If it was not 'normal', the
vnode_down error is returned as before. If it was 'normal', then it is
assumed that handoff happened, and the monitor is moved to the new
vnode, as indicated by riak_core_ring:next_owner/2.
{'DOWN',MonRef,process,VnodePid,normal} ->
%% the vnode likely just shut down after completing handoff
{ok, Ring} = riak_core_ring_manager:get_my_ring(),
case riak_core_ring:next_owner(Ring, Index) of
Copy link
Member Author

Choose a reason for hiding this comment

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

Emacs erlang-flymake complains about exporting Next from this case statement. I'm a recent, zealotus convert to this stylistic preference. I think it makes the provenance of bindings much, much easier to find. I this case Next is used very close to this case statement, so is less of an issue.

Russell's review says this makes Emacs erlang-flymake happier.
As Russell pointed out, it's possible that two+ transfers could happen
in the time between receiving the DOWN and checking the owner. Ignore
where the transfer is _from_, and just monitor wherever it's going to.
@russelldb
Copy link
Member Author

Ran basho/riak_test#154 before and after and got fail and pass as you'd expect.

WFM +1.

@ghost ghost assigned beerriot Mar 1, 2013
beerriot added a commit that referenced this pull request Mar 1, 2013
@beerriot beerriot merged commit a87f40a into master Mar 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants