Document defensive code

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

Branch: refs/heads/import
Commit: bfcc1bfb6a09b658be6da7401b7e038af2449184
Parents: 9828f8a
Author: Bob Dionne <[email protected]>
Authored: Thu Feb 21 16:14:20 2013 -0500
Committer: Bob Dionne <[email protected]>
Committed: Thu Feb 21 16:14:20 2013 -0500

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


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/bfcc1bfb/src/fabric_view_changes.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_changes.erl b/src/fabric_view_changes.erl
index 8a7f7c7..e2a5fe8 100644
--- a/src/fabric_view_changes.erl
+++ b/src/fabric_view_changes.erl
@@ -183,6 +183,8 @@ handle_message(#change{key=Seq} = Row0, {Worker, From}, St) 
->
     _ ->
         S1 = fabric_dict:store(Worker, Seq, S0),
         S2 = fabric_view:remove_overlapping_shards(Worker, S1),
+        % this check should not be necessary at all, as holes in the ranges
+        % created from DOWN messages would have led to errors
         case fabric_view:is_progress_possible(S2) of
         true ->
             Row = Row0#change{key = pack_seqs(S2)},
@@ -214,7 +216,9 @@ handle_message({complete, EndSeq}, Worker, State) ->
         NewState = State#collector{counters=S2, total_rows=Completed+1},
         case fabric_dict:size(S2) =:= (Completed+1) of
         true ->
-            % final check ranges are covered
+            % check ranges are covered, again this should not be neccessary
+            % as any holes in the ranges due to DOWN messages would have 
errored
+            % out sooner
             case fabric_view:is_progress_possible(S2) of
             true ->
                 {stop, NewState};

Reply via email to