Permalink
Browse files

Added callback to fail get/put requests during shutdown.

  • Loading branch information...
jonmeredith committed Sep 21, 2011
1 parent 5c273bf commit d76f86e633793b4023337952a10c06aab28d4b14
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/riak_kv_vnode.erl
View
@@ -47,6 +47,7 @@
is_empty/1,
delete/1,
handle_handoff_command/3,
+ handle_shutdown_command/3,
handoff_starting/2,
handoff_cancelled/1,
handoff_finished/2,
@@ -474,6 +475,13 @@ handle_handoff_command(Req={backend_callback, _Ref, _Msg}, Sender, State) ->
handle_handoff_command(_Req, _Sender, State) -> {forward, State}.
+handle_shutdown_command(?KV_GET_REQ{req_id = ReqId}, _Sender, State=#state{idx=Idx}) ->
+ {reply, {r, {error, shutdown}, Idx, ReqId}, State};
+handle_shutdown_command(?KV_PUT_REQ{req_id = ReqId}, Sender, State=#state{idx=Idx}) ->
+ riak_core_vnode:reply(Sender, {w, Idx, ReqId}),
+ {reply, {fail, Idx, ReqId}, State}.
+
+
handoff_starting(_TargetNode, State) ->
{true, State#state{in_handoff=true}}.

0 comments on commit d76f86e

Please sign in to comment.