You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2016/07/11 19:43:53 UTC
[1/2] fabric commit: updated refs/heads/master to 7d07877
Repository: couchdb-fabric
Updated Branches:
refs/heads/master c38c692fc -> 7d0787785
Use the correct sequence for shard replacement
The call to unpack the since sequence for _changes incorrectly filtered
the value for any shard that didn't exist. This means that any shard
that was moved ended up requiring a complete rescan which is a bug. This
just sets the update sequence to the range of the shard being replaced
rather than zero.
COUCHDB-3055
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/5d099596
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/5d099596
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/5d099596
Branch: refs/heads/master
Commit: 5d0995966c117e3cf946216aff41116c2020c212
Parents: c38c692
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 10 21:49:40 2015 -0600
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Mon Jul 11 12:22:19 2016 -0700
----------------------------------------------------------------------
src/fabric_view_changes.erl | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/5d099596/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 4855989..7e329ac 100644
--- a/src/fabric_view_changes.erl
+++ b/src/fabric_view_changes.erl
@@ -432,9 +432,30 @@ do_unpack_seqs(Opaque, DbName) ->
Ranges = lists:usort(lists:map(Extract, Unpacked)),
Filter = fun(S) -> not lists:member(S#shard.range, Ranges) end,
Replacements = lists:filter(Filter, mem3:shards(DbName)),
- Unpacked ++ [{R, 0} || R <- Replacements]
+ Unpacked ++ [{R, get_old_seq(R, Deduped)} || R <- Replacements]
end.
+
+get_old_seq(#shard{range=R}, SinceSeqs) ->
+ case lists:keyfind(R, 2, SinceSeqs) of
+ {_Node, R, Seq} when is_number(Seq) ->
+ % Unfortunately we don't have access to the db
+ % uuid so we can't set a replacememnt here.
+ 0;
+ {Node, R, {Seq, Uuid}} ->
+ % This update seq is using the old format that
+ % didn't include the node. This information is
+ % important for replacement.
+ {Seq, Uuid, Node};
+ {_Node, R, {Seq, Uuid, EpochNode}} ->
+ % This is the newest sequence format that we
+ % can use for replacement.
+ {Seq, Uuid, EpochNode};
+ _ ->
+ 0
+ end.
+
+
changes_row(Props0) ->
Props1 = case couch_util:get_value(deleted, Props0) of
true ->
[2/2] fabric commit: updated refs/heads/master to 7d07877
Posted by ii...@apache.org.
Merge remote branch 'cloudant:44287-use-correct-sequence-for-shard-replacement'
This closes #62
Signed-off-by: ILYA Khlopotov <ii...@ca.ibm.com>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/7d078778
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/7d078778
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/7d078778
Branch: refs/heads/master
Commit: 7d07877853a9b6c66fae0814005dbd5df7f97289
Parents: c38c692 5d09959
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Mon Jul 11 12:43:39 2016 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Mon Jul 11 12:43:39 2016 -0700
----------------------------------------------------------------------
src/fabric_view_changes.erl | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------