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/28 14:20:59 UTC

[24/50] fabric commit: updated refs/heads/master to a71701c

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 <pa...@gmail.com>
Authored: Tue Dec 10 11:35:22 2013 -0600
Committer: Robert Newson <rn...@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],