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:56 UTC

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

Make _changes?descending=true aware of maint. mode

The _changes coordinator was using a one-off thing to get the start
sequence for a database which did not provide any error handling at all.
This patch replaces that one-off with a call to get_db_info/1, which
does include all the normal error handling.

A future enhancement could teach the coordinator to understand a
"sequence" like eof that would cause all the workers to automatically
seek to the end, but I wanted to stay conservative here in order to land
this for the next release.

BugzID: 25944


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

Branch: refs/heads/windsor-merge
Commit: 4b00274c5a177f342c50b5dac8593c8a71a23823
Parents: 4705b6c
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Thu Jan 2 09:18:37 2014 -0500
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 1 15:19:30 2014 +0100

----------------------------------------------------------------------
 src/fabric_view_changes.erl | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/4b00274c/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 693a98a..0447bd6 100644
--- a/src/fabric_view_changes.erl
+++ b/src/fabric_view_changes.erl
@@ -328,30 +328,11 @@ make_changes_args(Args) ->
 
 get_start_seq(DbName, #changes_args{dir=Dir, since=Since})
   when Dir == rev; Since == "now" ->
-    Shards = mem3:shards(DbName),
-    Workers = fabric_util:submit_jobs(Shards, get_update_seq, []),
-    {ok, Seqs} = fabric_util:recv(Workers, #shard.ref,
-        fun collect_update_seqs/3, fabric_dict:init(Workers, -1)),
-    Seqs;
+    {ok, Info} = fabric:get_db_info(DbName),
+    couch_util:get_value(update_seq, Info);
 get_start_seq(_DbName, #changes_args{dir=fwd, since=Since}) ->
     Since.
 
-collect_update_seqs(Seq, Shard, Counters) when is_integer(Seq) ->
-    case fabric_dict:lookup_element(Shard, Counters) of
-    undefined ->
-        % already heard from someone else in this range
-        {ok, Counters};
-    -1 ->
-        C1 = fabric_dict:store(Shard, Seq, Counters),
-        C2 = fabric_view:remove_overlapping_shards(Shard, C1),
-        case fabric_dict:any(-1, C2) of
-        true ->
-            {ok, C2};
-        false ->
-            {stop, pack_seqs(C2)}
-        end
-    end.
-
 pending_count(Dict) ->
     fabric_dict:fold(fun
         (_Worker, Count, Acc) when is_integer(Count), is_integer(Acc) ->