couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [10/23] fabric commit: updated refs/heads/windsor-merge to 4ec3f11
Date Fri, 01 Aug 2014 14:29:50 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/ca1996aa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/ca1996aa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/ca1996aa

Branch: refs/heads/windsor-merge
Commit: ca1996aab03ae1f58af5a2fe349a60b904afcada
Parents: d55908f
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:07:19 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/ca1996aa/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 11478de..4b8811b 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