Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-fabric/pull/9#discussion_r22363748
  
    --- Diff: src/fabric_group_info.erl ---
    @@ -38,41 +39,74 @@ go(DbName, #doc{id=DDocId}) ->
             rexi_monitor:stop(RexiMon)
         end.
     
    -handle_message({rexi_DOWN, _, {_,NodeRef},_}, _Shard, {Counters, Acc}) ->
    +handle_message({rexi_DOWN, _, {_,NodeRef},_}, _Shard,
    +        {Counters, Acc, Ushards}) ->
         case fabric_util:remove_down_workers(Counters, NodeRef) of
         {ok, NewCounters} ->
    -        {ok, {NewCounters, Acc}};
    +        {ok, {NewCounters, Acc, Ushards}};
         error ->
             {error, {nodedown, <<"progress not possible">>}}
         end;
     
    -handle_message({rexi_EXIT, Reason}, Shard, {Counters, Acc}) ->
    +handle_message({rexi_EXIT, Reason}, Shard, {Counters, Acc, Ushards}) ->
         NewCounters = lists:keydelete(Shard, #shard.ref, Counters),
         case fabric_view:is_progress_possible(NewCounters) of
         true ->
    -        {ok, {NewCounters, Acc}};
    +        {ok, {NewCounters, Acc, Ushards}};
         false ->
             {error, Reason}
         end;
     
    -handle_message({ok, Info}, Shard, {Counters, Acc}) ->
    -    case fabric_dict:lookup_element(Shard, Counters) of
    -    undefined ->
    -        % already heard from someone else in this range
    -        {ok, {Counters, Acc}};
    -    nil ->
    -        C1 = fabric_dict:store(Shard, ok, Counters),
    -        C2 = fabric_view:remove_overlapping_shards(Shard, C1),
    -        case fabric_dict:any(nil, C2) of
    -        true ->
    -            {ok, {C2, [Info|Acc]}};
    -        false ->
    -            {stop, merge_results(lists:flatten([Info|Acc]))}
    -        end
    +handle_message({ok, Info}, Shard, {Counters0, Acc, Ushards}) ->
    +    NewAcc = append_result(Info, Shard, Acc, Ushards),
    +    Counters = fabric_dict:store(Shard, ok, Counters0),
    +    case is_complete(Counters) of
    +    false ->
    +        {ok, {Counters, NewAcc, Ushards}};
    +    true ->
    +        Pending = aggregate_pending(NewAcc),
    +        Infos = get_infos(NewAcc),
    +        Results = [{updates_pending, {Pending}}|merge_results(Infos)],
    --- End diff --
    
    Surround `|` with spaces.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to