couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [10/50] fabric commit: updated refs/heads/master to a71701c
Date Thu, 28 Aug 2014 12:20:45 GMT
Fix `fabric:get_db_info/1`

We weren't properly removing shards that had an error as well as
returning errors to functions that don't expect them.


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

Branch: refs/heads/master
Commit: 0f45478727019daec3131441eaac8ec9b0bba14e
Parents: 5731bf3
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Fri Oct 4 16:34:11 2013 -0500
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Aug 1 15:33:41 2014 +0100

----------------------------------------------------------------------
 src/fabric_db_info.erl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/0f454787/src/fabric_db_info.erl
----------------------------------------------------------------------
diff --git a/src/fabric_db_info.erl b/src/fabric_db_info.erl
index 58139e8..de88632 100644
--- a/src/fabric_db_info.erl
+++ b/src/fabric_db_info.erl
@@ -21,9 +21,13 @@ go(DbName) ->
     Shards = mem3:shards(DbName),
     Workers = fabric_util:submit_jobs(Shards, get_db_info, []),
     RexiMon = fabric_util:create_monitors(Shards),
+    Fun = fun handle_message/3,
     Acc0 = {fabric_dict:init(Workers, nil), []},
     try
-        fabric_util:recv(Workers, #shard.ref, fun handle_message/3, Acc0)
+        case fabric_util:recv(Workers, #shard.ref, Fun, Acc0) of
+            {ok, Acc} -> {ok, Acc};
+            {error, Error} -> throw(Error)
+        end
     after
         rexi_monitor:stop(RexiMon)
     end.
@@ -37,7 +41,7 @@ handle_message({rexi_DOWN, _, {_,NodeRef},_}, _Shard, {Counters, Acc}) ->
     end;
 
 handle_message({rexi_EXIT, Reason}, Shard, {Counters, Acc}) ->
-    NewCounters = lists:keydelete(Shard, #shard.ref, Counters),
+    NewCounters = fabric_dict:erase(Shard, Counters),
     case fabric_view:is_progress_possible(NewCounters) of
     true ->
         {ok, {NewCounters, Acc}};


Mime
View raw message