You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 14:20:51 UTC

[16/50] fabric commit: updated refs/heads/master to a71701c

Use smarter seqs when original shard is down/gone

If a shard that contributes to a sequence a) is on a down node or b) is
no longer part of the shard set we can provide enough detail to the
replacement workers to allow them to choose a smarter replacement
sequence.

This patch does not cover the case where the shard that originally
contributed to the sequence is alive but crashes before initializing the
stream to the coordinator.  In that case we're still firing up
replacement workers and asking them to stream from zero.  The
stream_start semantics make reworking that bit a tad trickier.

BugzID: 22698


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/f4616ee4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/f4616ee4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/f4616ee4

Branch: refs/heads/master
Commit: f4616ee4ba653da19fe386db789732dc9a53308f
Parents: 5d52436
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Sun Nov 17 18:16:07 2013 -0500
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 1 15:33:42 2014 +0100

----------------------------------------------------------------------
 src/fabric_view_changes.erl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/f4616ee4/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 3ca60b1..4ee87e4 100644
--- a/src/fabric_view_changes.erl
+++ b/src/fabric_view_changes.erl
@@ -125,7 +125,8 @@ send_changes(DbName, ChangesArgs, Callback, PackedSeqs, AccIn, Timeout) ->
             % TODO It's possible in rare cases of shard merging to end up
             % with overlapping shard ranges from this technique
             lists:map(fun(#shard{name=Name2, node=N2} = NewShard) ->
-                Ref = rexi:cast(N2, {fabric_rpc, changes, [Name2,ChangesArgs,0]}),
+                Ref = rexi:cast(N2, {fabric_rpc, changes, [Name2, ChangesArgs,
+                    make_replacement_arg(N, Seq)]}),
                 {NewShard#shard{ref = Ref}, 0}
             end, find_replacement_shards(Shard, AllLiveShards))
         end
@@ -255,6 +256,13 @@ handle_message({complete, Props}, Worker, State) ->
     end,
     {Go, NewState}.
 
+make_replacement_arg(Node, {Seq, Uuid}) ->
+    {replace, Node, Uuid, Seq};
+make_replacement_arg(Node, {Seq, Uuid, _}) ->
+    {replace, Node, Uuid, Seq};
+make_replacement_arg(_, _) ->
+    0.
+
 make_changes_args(#changes_args{style=Style, filter=undefined}=Args) ->
     Args#changes_args{filter = Style};
 make_changes_args(Args) ->