From b61c59844017f71782289c87f93be431f995baa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Fri, 22 Nov 2024 15:14:24 +0100 Subject: [PATCH 1/2] rabbit_vhosts: Don't reconcile vhosts if `rabbit` is stopped [Why] That timer was started during boot and continued regardless if `rabbit` was running or stopped. This caused the reconsiliation to crash if the `rabbit` app was stopped before the it ended because it tried to access the database even though it was stopped or even reset. [How] We just check if `rabbit` is running before running one reconciliation and scheduling a new one. (cherry picked from commit 03f9d369880a782c655fb070f85e229fce9affc9) --- deps/rabbit/src/rabbit_vhosts.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/rabbit/src/rabbit_vhosts.erl b/deps/rabbit/src/rabbit_vhosts.erl index 641522d0fc95..42fd158c1fd9 100644 --- a/deps/rabbit/src/rabbit_vhosts.erl +++ b/deps/rabbit/src/rabbit_vhosts.erl @@ -51,7 +51,7 @@ boot() -> %% See start_processes_for_all/1. -spec reconcile() -> 'ok'. reconcile() -> - case is_reconciliation_enabled() of + case rabbit:is_running() andalso is_reconciliation_enabled() of false -> ok; true -> _ = reconcile_once(), From acbc895192ae2fdda5fb482b7671e87d8dbb34ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Fri, 22 Nov 2024 16:07:08 +0100 Subject: [PATCH 2/2] quorum_queue_member_reconciliation_SUITE: Improve `reset_nodes/2` [How] The function now accepts that the node to reset is already out of the cluster. This avoids a mismatch exception for a situation that is ok. (cherry picked from commit fe2061b13b386db6055d6c3a00673958b56e23ee) --- .../rabbit/test/quorum_queue_member_reconciliation_SUITE.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps/rabbit/test/quorum_queue_member_reconciliation_SUITE.erl b/deps/rabbit/test/quorum_queue_member_reconciliation_SUITE.erl index 00ccb34402fe..73a51b2c5a4d 100644 --- a/deps/rabbit/test/quorum_queue_member_reconciliation_SUITE.erl +++ b/deps/rabbit/test/quorum_queue_member_reconciliation_SUITE.erl @@ -92,7 +92,10 @@ reset_nodes([], _Leader) -> ok; reset_nodes([Node| Nodes], Leader) -> ok = rabbit_control_helper:command(stop_app, Node), - ok = rabbit_control_helper:command(forget_cluster_node, Leader, [atom_to_list(Node)]), + case rabbit_control_helper:command(forget_cluster_node, Leader, [atom_to_list(Node)]) of + ok -> ok; + {error, _, <<"Error:\n{:not_a_cluster_node, ~c\"The node selected is not in the cluster.\"}">>} -> ok + end, ok = rabbit_control_helper:command(reset, Node), ok = rabbit_control_helper:command(start_app, Node), reset_nodes(Nodes, Leader).