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/01 16:29:42 UTC

[02/23] fabric commit: updated refs/heads/windsor-merge to 4ec3f11

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/ef085816
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/ef085816
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/ef085816

Branch: refs/heads/windsor-merge
Commit: ef0858165c308f21f174be029d1854220afa3be5
Parents: ce1873b
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 14:24:08 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/ef085816/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) ->