couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [42/50] fabric commit: updated refs/heads/master to a71701c
Date Thu, 28 Aug 2014 12:21:17 GMT
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/dbcbfc18
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/dbcbfc18
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/dbcbfc18

Branch: refs/heads/master
Commit: dbcbfc1842e9cf1c025b0484ade6abd4f1b6cb7c
Parents: a01d239
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Thu Jan 2 09:18:37 2014 -0500
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Aug 1 15:33:43 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/dbcbfc18/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 8de01f1..5d0672e 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) ->


Mime
View raw message