Skip to content

Commit 50aec18

Browse files
committed
quorum_queue_member_reconciliation_SUITE: Disconnect node after removing it from cluster
[Why] We want to disconnect a node that was just reset from the remote cluster nodes because it may impact peer discovery when the local node is restarted (as a standalone node). In particular, it may trigger the recovery code of peer discovery that tries to repair a cluster after a node lost its disk entirely. It could also affect the remote cluster as well.
1 parent 4d80901 commit 50aec18

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

deps/rabbit/test/quorum_queue_member_reconciliation_SUITE.erl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,21 @@ reset_nodes([], _Leader) ->
9191
ok;
9292
reset_nodes([Node| Nodes], Leader) ->
9393
ok = rabbit_control_helper:command(stop_app, Node),
94-
ok = rabbit_control_helper:command(forget_cluster_node, Leader, [atom_to_list(Node)]),
94+
case rabbit_control_helper:command(forget_cluster_node, Leader, [atom_to_list(Node)]) of
95+
ok -> ok;
96+
{error, 69,
97+
<<"Error:\n{:not_a_cluster_node, ~c\"The node selected is not in the cluster.\"}">>} -> ok
98+
end,
9599
ok = rabbit_control_helper:command(reset, Node),
100+
%% Disconnect explicitly nodes from the node we just reset because it way
101+
%% interfere with the restart of RabbitMQ below and peer discovery.
102+
ClusterNodes = rpc:call(Leader, rabbit_db_cluster, members, []),
103+
lists:foreach(
104+
fun(N) ->
105+
_ = catch erpc:call(
106+
N,
107+
erlang, disconnect_node, [Node])
108+
end, ClusterNodes),
96109
ok = rabbit_control_helper:command(start_app, Node),
97110
reset_nodes(Nodes, Leader).
98111

0 commit comments

Comments
 (0)