Skip to content
This repository
Browse code

Merge pull request #223 from basho/az756-async-handoff-forwarding

  • Loading branch information...
commit 07c140c04047416d818c38af50dacd818473556d 2 parents 8bef377 + 8408e37
Joseph Blomstedt jtuple authored

Showing 1 changed file with 14 additions and 5 deletions. Show diff stats Hide diff stats

  1. +14 5 src/riak_kv_vnode.erl
19 src/riak_kv_vnode.erl
@@ -459,11 +459,20 @@ handle_coverage(?KV_INDEX_REQ{bucket=Bucket,
459 459 {reply, {error, {indexes_not_supported, Mod}}, State}
460 460 end.
461 461
462   -handle_handoff_command(Req=?FOLD_REQ{}, Sender, State) ->
463   - handle_command(Req, Sender, State);
464   -handle_handoff_command(Req={backend_callback, _Ref, _Msg}, Sender, State) ->
465   - handle_command(Req, Sender, State);
466   -handle_handoff_command(_Req, _Sender, State) -> {forward, State}.
  462 +%% While in handoff, vnodes have the option of returning {forward, State}
  463 +%% which will cause riak_core to forward the request to the handoff target
  464 +%% node. For riak_kv, we issue a put locally as well as forward it in case
  465 +%% the vnode has already handed off the previous version. All other requests
  466 +%% are handled locally and not forwarded since the relevant data may not have
  467 +%% yet been handed off to the target node. Since we do not forward deletes it
  468 +%% is possible that we do not clear a tombstone that was already handed off.
  469 +%% This is benign as the tombstone will eventually be re-deleted.
  470 +handle_handoff_command(Req=?KV_PUT_REQ{}, Sender, State) ->
  471 + {noreply, NewState} = handle_command(Req, Sender, State),
  472 + {forward, NewState};
  473 +%% Handle all unspecified cases locally without forwarding
  474 +handle_handoff_command(Req, Sender, State) ->
  475 + handle_command(Req, Sender, State).
467 476
468 477
469 478 handoff_starting(_TargetNode, State) ->

0 comments on commit 07c140c

Please sign in to comment.
Something went wrong with that request. Please try again.