couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [24/50] fabric commit: updated refs/heads/master to a71701c
Date Thu, 28 Aug 2014 12:20:59 GMT
Be defensive when calcualting pending_count

Its theoretically possible that during the upgrade we end up with a
mixed set of RPC workers. This makes sure that we don't crash the
coordinator with a badarith error.

BugzId: 24236


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

Branch: refs/heads/master
Commit: af206990c0a953eda3d7098bd480ba7b5e72df3a
Parents: 7826ce5
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Tue Dec 10 11:35:22 2013 -0600
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Aug 1 15:33:42 2014 +0100

----------------------------------------------------------------------
 src/fabric_view_changes.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/af206990/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 60dc54c..1797539 100644
--- a/src/fabric_view_changes.erl
+++ b/src/fabric_view_changes.erl
@@ -351,7 +351,12 @@ collect_update_seqs(Seq, Shard, Counters) when is_integer(Seq) ->
     end.
 
 pending_count(Dict) ->
-    fabric_dict:fold(fun(_Worker, C, Acc) -> C+Acc end, 0, Dict).
+    fabric_dict:fold(fun
+        (_Worker, Count, Acc) when is_integer(Count), is_integer(Acc) ->
+            Count + Acc;
+        (_Worker, _Count, _Acc) ->
+            null
+    end, 0, Dict).
 
 pack_seqs(Workers) ->
     SeqList = [{N,R,S} || {#shard{node=N, range=R}, S} <- Workers],


Mime
View raw message