Skip to content

Commit

Permalink
Merge pull request basho#703 from basho/dr-better_required_queue_list
Browse files Browse the repository at this point in the history
Prevent fallback vnodes' solrqs from stopping if they are still needed
  • Loading branch information
fadushin authored Nov 10, 2016
2 parents 381e573 + e228268 commit 490cd21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/yz_solrq_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ validate_child_started(Error) ->
throw(Error).

required_queues() ->
{ok, Ring} = riak_core_ring_manager:get_my_ring(),
Partitions = yz_misc:owned_and_next_partitions(node(), Ring),
AllVnodes = riak_core_vnode_manager:all_vnodes(riak_kv_vnode),
Partitions = [Idx || {_Mod, Idx, _Pid} <- AllVnodes],
%% Indexes includes ?YZ_INDEX_TOMBSTONE because we need to write the entries
%% for non-indexed data to the YZ AAE tree. Excluding them makes this process
%% constantly start and stop these queues.
Indexes = yz_index:get_indexes_from_meta() ++ [?YZ_INDEX_TOMBSTONE],
CalculatedQueues = [{Index, Partition} ||
Partition <- ordsets:to_list(Partitions),
Partition <- Partitions,
Index <- Indexes],
CalculatedQueues.
%% TODO: we shouldn't need ?YZ_INDEX_TOMBSTONE if we just update the YZ AAE tree
Expand Down
6 changes: 4 additions & 2 deletions test/yz_solrq_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,10 @@ wait_for_vnodes_msgs([Pid | Pids], Ref) ->

start_solrqs(Partitions, Indexes) ->
%% Ring retrieval for required workers
meck:expect(riak_core_ring_manager, get_my_ring, fun() -> {ok, not_a_real_ring} end),
meck:expect(yz_misc, owned_and_next_partitions, fun(_, _) -> unique_entries(Partitions) end),
UniquePartitions = unique_entries(Partitions),
meck:expect(riak_core_vnode_manager, all_vnodes, fun(riak_kv_vnode) ->
[{riak_kv_vnode, Idx, fake_pid} || Idx <- UniquePartitions]
end),
meck:expect(yz_index, get_indexes_from_meta, fun() -> unique_entries(Indexes) -- [?YZ_INDEX_TOMBSTONE] end),
%% And start up supervisors to own the solrq/solrq helper
_ = yz_solrq_sup:start_link(),
Expand Down

0 comments on commit 490cd21

Please sign in to comment.