You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2017/03/01 16:38:04 UTC
[06/50] fabric commit: updated refs/heads/2971-count-distinct to
5d18415
Ignore already received replies for same shards
It is possible to get a reply for same shard
from different node sent before its collector
get stopped in remove_overlapping_shards.
This running condition leads to a possibility
of same info to be aggregated multiple times.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/ae2a8f7c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/ae2a8f7c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/ae2a8f7c
Branch: refs/heads/2971-count-distinct
Commit: ae2a8f7cb61dd4fc160c3b26091a885fb254f23f
Parents: b17c880
Author: Eric Avdey <ei...@eiri.ca>
Authored: Fri Jul 8 15:54:47 2016 -0300
Committer: Eric Avdey <ei...@eiri.ca>
Committed: Tue Jul 12 15:21:23 2016 -0300
----------------------------------------------------------------------
src/fabric_group_info.erl | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/ae2a8f7c/src/fabric_group_info.erl
----------------------------------------------------------------------
diff --git a/src/fabric_group_info.erl b/src/fabric_group_info.erl
index 24232a8..f6ed9cb 100644
--- a/src/fabric_group_info.erl
+++ b/src/fabric_group_info.erl
@@ -58,17 +58,23 @@ handle_message({rexi_EXIT, Reason}, Shard, {Counters, Acc, Ushards}) ->
end;
handle_message({ok, Info}, Shard, {Counters0, Acc, Ushards}) ->
- NewAcc = append_result(Info, Shard, Acc, Ushards),
- Counters1 = fabric_dict:store(Shard, ok, Counters0),
- Counters = fabric_view:remove_overlapping_shards(Shard, Counters1),
- 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)],
- {stop, Results}
+ case fabric_dict:lookup_element(Shard, Counters0) of
+ undefined ->
+ % already heard from other node in this range
+ {ok, {Counters0, Acc, Ushards}};
+ nil ->
+ NewAcc = append_result(Info, Shard, Acc, Ushards),
+ Counters1 = fabric_dict:store(Shard, ok, Counters0),
+ Counters = fabric_view:remove_overlapping_shards(Shard, Counters1),
+ 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)],
+ {stop, Results}
+ end
end;
handle_message(_, _, Acc) ->
{ok, Acc}.