From 83a0eedb4ebaff0576b13473b4d3e689e8a3a8fd Mon Sep 17 00:00:00 2001 From: Simon Unge Date: Mon, 20 May 2024 20:49:09 +0000 Subject: [PATCH] Let QQs check if it needs to repair amqqueue nodes --- deps/rabbit/src/rabbit_quorum_queue.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/deps/rabbit/src/rabbit_quorum_queue.erl b/deps/rabbit/src/rabbit_quorum_queue.erl index 2086f4639955..e91a4bff19aa 100644 --- a/deps/rabbit/src/rabbit_quorum_queue.erl +++ b/deps/rabbit/src/rabbit_quorum_queue.erl @@ -552,6 +552,12 @@ handle_tick(QName, | info(Q, Keys)], rabbit_core_metrics:queue_stats(QName, Infos), ok = repair_leader_record(Q, Self), + case repair_amqqueue_nodes(Q) of + ok -> + ok; + repaired -> + rabbit_log:debug("Repaired quorum queue ~ts amqqueue record", [rabbit_misc:rs(QName)]) + end, ExpectedNodes = rabbit_nodes:list_members(), case Nodes -- ExpectedNodes of [] -> @@ -604,8 +610,8 @@ repair_amqqueue_nodes(QName = #resource{}) -> repair_amqqueue_nodes(Q0); repair_amqqueue_nodes(Q0) -> QName = amqqueue:get_name(Q0), - Leader = amqqueue:get_pid(Q0), - {ok, Members, _} = ra:members(Leader), + {Name, _} = amqqueue:get_pid(Q0), + Members = ra_leaderboard:lookup_members(Name), RaNodes = [N || {_, N} <- Members], #{nodes := Nodes} = amqqueue:get_type_state(Q0), case lists:sort(RaNodes) =:= lists:sort(Nodes) of