Skip to content

Commit

Permalink
Ensure only alive QQ replica states are reported
Browse files Browse the repository at this point in the history
when checking replica states to help avoid missing
inactive replicas e.g. on QQ checks from cli tools

(cherry picked from commit 4914850)
  • Loading branch information
Ayanda-D authored and michaelklishin committed Nov 14, 2024
1 parent d5063c7 commit 9070e39
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions deps/rabbit/src/rabbit_quorum_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -442,17 +442,25 @@ become_leader0(QName, Name) ->
all_replica_states() ->
Rows0 = ets:tab2list(ra_state),
Rows = lists:map(fun
({K, follower, promotable}) ->
{K, promotable};
({K, follower, non_voter}) ->
{K, non_voter};
({K, S, _}) ->
%% voter or unknown
{K, S};
(T) ->
T
(T = {K, _, _}) ->
case rabbit_process:is_registered_process_alive(K) of
true ->
to_replica_state(T);
false ->
[]
end;
(_T) ->
[]
end, Rows0),
{node(), maps:from_list(Rows)}.
{node(), maps:from_list(lists:flatten(Rows))}.

to_replica_state({K, follower, promotable}) ->
{K, promotable};
to_replica_state({K, follower, non_voter}) ->
{K, non_voter};
to_replica_state({K, S, _}) ->
%% voter or unknown
{K, S}.

-spec list_with_minimum_quorum() -> [amqqueue:amqqueue()].
list_with_minimum_quorum() ->
Expand Down

0 comments on commit 9070e39

Please sign in to comment.