Skip to content

Commit e3583db

Browse files
committed
Use "all" ring options for purged_infos
Previously we used the `{any, Shards}` option, that option is most useful for partitioned dbs when we may want to get results from any of the partitioned shards (possibly non-exactly matching with start/ends after shards splitting). For purged_infos using `all` is more appropriate and this makes it more clear we wait for all viable shards to return.
1 parent 458bc0d commit e3583db

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/fabric/src/fabric_db_purged_infos.erl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
-record(pacc, {
2020
counters,
21-
replies,
22-
ring_opts
21+
replies
2322
}).
2423

2524
go(DbName) ->
@@ -29,8 +28,7 @@ go(DbName) ->
2928
Fun = fun handle_message/3,
3029
Acc0 = #pacc{
3130
counters = fabric_dict:init(Workers, nil),
32-
replies = couch_util:new_set(),
33-
ring_opts = [{any, Shards}]
31+
replies = couch_util:new_set()
3432
},
3533
try
3634
case fabric_util:recv(Workers, #shard.ref, Fun, Acc0) of
@@ -48,17 +46,17 @@ go(DbName) ->
4846
end.
4947

5048
handle_message({rexi_DOWN, _, {_, NodeRef}, _}, _Shard, #pacc{} = Acc) ->
51-
#pacc{counters = Counters, ring_opts = RingOpts} = Acc,
52-
case fabric_util:remove_down_workers(Counters, NodeRef, RingOpts) of
49+
#pacc{counters = Counters} = Acc,
50+
case fabric_util:remove_down_workers(Counters, NodeRef, [all]) of
5351
{ok, NewCounters} ->
5452
{ok, Acc#pacc{counters = NewCounters}};
5553
error ->
5654
{error, {nodedown, <<"progress not possible">>}}
5755
end;
5856
handle_message({rexi_EXIT, Reason}, Shard, #pacc{} = Acc) ->
59-
#pacc{counters = Counters, ring_opts = RingOpts} = Acc,
57+
#pacc{counters = Counters} = Acc,
6058
NewCounters = fabric_dict:erase(Shard, Counters),
61-
case fabric_ring:is_progress_possible(NewCounters, RingOpts) of
59+
case fabric_ring:is_progress_possible(NewCounters, [all]) of
6260
true ->
6361
{ok, Acc#pacc{counters = NewCounters}};
6462
false ->
@@ -92,8 +90,7 @@ make_shards() ->
9290
init_acc(Shards) ->
9391
#pacc{
9492
counters = fabric_dict:init(Shards, nil),
95-
replies = couch_util:new_set(),
96-
ring_opts = [{any, Shards}]
93+
replies = couch_util:new_set()
9794
}.
9895

9996
first_result_ok_test() ->

0 commit comments

Comments
 (0)