Skip to content

Commit 7aae987

Browse files
Make rabbitmqctl rename_cluster_node's friend, update_cluster_nodes, a no-op
1 parent 3883623 commit 7aae987

File tree

6 files changed

+17
-136
lines changed

6 files changed

+17
-136
lines changed

deps/rabbit/src/rabbit_db_cluster.erl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
check_consistency/0,
2424
cli_cluster_status/0]).
2525

26-
%% These two functions are not supported by Khepri and probably
27-
%% shouldn't be part of this API in the future, but currently
28-
%% they're needed here so they can fail when invoked using Khepri.
29-
-export([update_cluster_nodes/1]).
30-
3126
-type node_type() :: disc_node_type() | ram_node_type().
3227
-type disc_node_type() :: disc.
3328
-type ram_node_type() :: ram.
@@ -389,9 +384,3 @@ cli_cluster_status_using_mnesia() ->
389384

390385
cli_cluster_status_using_khepri() ->
391386
rabbit_khepri:cli_cluster_status().
392-
393-
update_cluster_nodes(DiscoveryNode) ->
394-
case rabbit_khepri:is_enabled() of
395-
true -> {error, not_supported};
396-
false -> rabbit_mnesia:update_cluster_nodes(DiscoveryNode)
397-
end.

deps/rabbit/src/rabbit_mnesia.erl

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
join_cluster/2,
1818
reset/0,
1919
force_reset/0,
20-
update_cluster_nodes/1,
2120
change_cluster_node_type/1,
2221
forget_cluster_node/2,
2322
force_load_next_boot/0,
@@ -285,27 +284,6 @@ change_cluster_node_type(Type) ->
285284
ok = reset(),
286285
ok = join_cluster(Node, Type).
287286

288-
-spec update_cluster_nodes(node()) -> 'ok'.
289-
290-
update_cluster_nodes(DiscoveryNode) ->
291-
ensure_mnesia_not_running(),
292-
ensure_mnesia_dir(),
293-
Status = {AllNodes, _, _} = discover_cluster([DiscoveryNode]),
294-
case rabbit_nodes:me_in_nodes(AllNodes) of
295-
true ->
296-
%% As in `check_consistency/0', we can safely delete the
297-
%% schema here, since it'll be replicated from the other
298-
%% nodes
299-
_ = mnesia:delete_schema([node()]),
300-
rabbit_node_monitor:write_cluster_status(Status),
301-
rabbit_log:info("Updating cluster nodes from ~tp",
302-
[DiscoveryNode]),
303-
init_db_with_mnesia(AllNodes, node_type(), true, true, _Retry = false);
304-
false ->
305-
e(inconsistent_cluster)
306-
end,
307-
ok.
308-
309287
%% We proceed like this: try to remove the node locally. If the node
310288
%% is offline, we remove the node if:
311289
%% * This node is a disc node
@@ -1088,16 +1066,14 @@ e(Tag) -> throw({error, {Tag, error_description(Tag)}}).
10881066

10891067
error_description(clustering_only_disc_node) ->
10901068
"You cannot cluster a node if it is the only disc node in its existing "
1091-
" cluster. If new nodes joined while this node was offline, use "
1092-
"'update_cluster_nodes' to add them manually.";
1069+
" cluster.";
10931070
error_description(resetting_only_disc_node) ->
10941071
"You cannot reset a node when it is the only disc node in a cluster. "
10951072
"Please convert another node of the cluster to a disc node first.";
10961073
error_description(not_clustered) ->
10971074
"Non-clustered nodes can only be disc nodes.";
10981075
error_description(no_online_cluster_nodes) ->
1099-
"Could not find any online cluster nodes. If the cluster has changed, "
1100-
"you can use the 'update_cluster_nodes' command.";
1076+
"Could not find any online cluster nodes.";
11011077
error_description(inconsistent_cluster) ->
11021078
"The nodes provided do not have this node as part of the cluster.";
11031079
error_description(not_a_cluster_node) ->

deps/rabbit/test/clustering_management_SUITE.erl

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ groups() ->
4343
join_to_start_interval,
4444
forget_cluster_node,
4545
change_cluster_node_type,
46-
change_cluster_when_node_offline,
47-
update_cluster_nodes,
48-
force_reset_node
46+
change_cluster_when_node_offline
4947
]}
5048
]},
5149
{clustered_2_nodes, [],
@@ -83,8 +81,7 @@ groups() ->
8381
persistent_cluster_id,
8482
stop_start_cluster_node,
8583
restart_cluster_node,
86-
unsupported_forget_cluster_node_offline,
87-
unsupported_update_cluster_nodes
84+
unsupported_forget_cluster_node_offline
8885

8986
]}
9087
]},
@@ -926,39 +923,6 @@ change_cluster_when_node_offline(Config) ->
926923
assert_not_clustered(Bunny),
927924
ok.
928925

929-
930-
update_cluster_nodes(Config) ->
931-
[Rabbit, Hare, Bunny] = cluster_members(Config),
932-
933-
%% Mnesia is running...
934-
assert_failure(fun () -> update_cluster_nodes(Config, Rabbit, Hare) end),
935-
936-
ok = stop_app(Config, Rabbit),
937-
ok = join_cluster(Config, Rabbit, Hare),
938-
ok = stop_app(Config, Bunny),
939-
ok = join_cluster(Config, Bunny, Hare),
940-
ok = start_app(Config, Bunny),
941-
stop_reset_start(Config, Hare),
942-
assert_failure(fun () -> start_app(Config, Rabbit) end),
943-
%% Bogus node
944-
assert_failure(fun () -> update_cluster_nodes(Config, Rabbit, non@existent) end),
945-
%% Inconsistent node
946-
assert_failure(fun () -> update_cluster_nodes(Config, Rabbit, Hare) end),
947-
ok = update_cluster_nodes(Config, Rabbit, Bunny),
948-
ok = start_app(Config, Rabbit),
949-
assert_not_clustered(Hare),
950-
assert_clustered([Rabbit, Bunny]).
951-
952-
unsupported_update_cluster_nodes(Config) ->
953-
[Rabbit, Hare] = cluster_members(Config),
954-
955-
%% Mnesia is running...
956-
assert_failure(fun () -> update_cluster_nodes(Config, Rabbit, Hare) end),
957-
958-
ok = stop_app(Config, Rabbit),
959-
Ret = update_cluster_nodes(Config, Rabbit, Hare),
960-
is_not_supported(Ret).
961-
962926
is_not_supported(Ret) ->
963927
?assertMatch({error, _, _}, Ret),
964928
{error, _, Msg} = Ret,
@@ -1012,22 +976,6 @@ classic_config_discovery_node_list(Config) ->
1012976
assert_failure(fun () -> start_app(Config, Hare) end),
1013977
assert_not_clustered(Rabbit).
1014978

1015-
force_reset_node(Config) ->
1016-
[Rabbit, Hare, _Bunny] = cluster_members(Config),
1017-
1018-
stop_join_start(Config, Rabbit, Hare),
1019-
stop_app(Config, Rabbit),
1020-
force_reset(Config, Rabbit),
1021-
%% Hare thinks that Rabbit is still clustered
1022-
assert_cluster_status({[Rabbit, Hare], [Rabbit, Hare], [Hare]},
1023-
[Hare]),
1024-
%% %% ...but it isn't
1025-
assert_cluster_status({[Rabbit], [Rabbit], []}, [Rabbit]),
1026-
%% We can rejoin Rabbit and Hare
1027-
update_cluster_nodes(Config, Rabbit, Hare),
1028-
start_app(Config, Rabbit),
1029-
assert_clustered([Rabbit, Hare]).
1030-
1031979
force_reset_node_in_khepri(Config) ->
1032980
[Rabbit, Hare, _Bunny] = cluster_members(Config),
1033981

@@ -1412,15 +1360,6 @@ change_cluster_node_type(Config, Node, Type) ->
14121360
Error -> Error
14131361
end.
14141362

1415-
update_cluster_nodes(Config, Node, DiscoveryNode) ->
1416-
Ret = rabbit_ct_broker_helpers:rabbitmqctl(
1417-
Config, Node,
1418-
["update_cluster_nodes", atom_to_list(DiscoveryNode)]),
1419-
case Ret of
1420-
{ok, _} -> ok;
1421-
Error -> Error
1422-
end.
1423-
14241363
stop_join_start(Config, Node, ClusterTo, Ram) ->
14251364
ok = stop_app(Config, Node),
14261365
ok = join_cluster(Config, Node, ClusterTo, Ram),

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/node_health_check_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## License, v. 2.0. If a copy of the MPL was not distributed with this
33
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
##
5-
## Copyright (c) 2007-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
5+
## Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Ctl.Commands.NodeHealthCheckCommand do
88
alias RabbitMQ.CLI.Core.DocGuide

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## License, v. 2.0. If a copy of the MPL was not distributed with this
33
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
##
5-
## Copyright (c) 2016-2023 VMware, Inc. or its affiliates. All rights reserved.
5+
## Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Ctl.Commands.RenameClusterNodeCommand do
88
require Integer

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## License, v. 2.0. If a copy of the MPL was not distributed with this
33
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
##
5-
## Copyright (c) 2016-2023 VMware, Inc. or its affiliates. All rights reserved.
5+
## Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Ctl.Commands.UpdateClusterNodesCommand do
88
alias RabbitMQ.CLI.Core.{Config, DocGuide, Helpers}
@@ -13,21 +13,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.UpdateClusterNodesCommand do
1313
use RabbitMQ.CLI.Core.AcceptsOnePositionalArgument
1414
use RabbitMQ.CLI.Core.RequiresRabbitAppStopped
1515

16-
def run([seed_node], options = %{node: node_name}) do
17-
long_or_short_names = Config.get_option(:longnames, options)
18-
seed_node_normalised = Helpers.normalise_node(seed_node, long_or_short_names)
19-
20-
case :rabbit_misc.rpc_call(node_name, :rabbit_db_cluster, :update_cluster_nodes, [
21-
seed_node_normalised
22-
]) do
23-
{:badrpc, {:EXIT, {:undef, _}}} ->
24-
:rabbit_misc.rpc_call(node_name, :rabbit_mnesia, :update_cluster_nodes, [
25-
seed_node_normalised
26-
])
27-
28-
ret0 ->
29-
ret0
30-
end
16+
def run([_seed_node], _opts) do
17+
:ok
3118
end
3219

3320
def usage() do
@@ -46,25 +33,15 @@ defmodule RabbitMQ.CLI.Ctl.Commands.UpdateClusterNodesCommand do
4633
]
4734
end
4835

49-
def help_section(), do: :cluster_management
50-
51-
def description(),
52-
do:
53-
"Instructs a cluster member node to sync the list of known cluster members from <seed_node>"
54-
55-
def banner([seed_node], %{node: node_name}) do
56-
"Will seed #{node_name} from #{seed_node} on next start"
57-
end
36+
def help_section(), do: :deprecated
5837

59-
def output({:error, :mnesia_unexpectedly_running}, %{node: node_name}) do
60-
{:error, RabbitMQ.CLI.Core.ExitCodes.exit_software(),
61-
RabbitMQ.CLI.DefaultOutput.mnesia_running_error(node_name)}
38+
def description() do
39+
"DEPRECATED. This command is a no-op. Node renaming is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
6240
end
6341

64-
def output({:error, :cannot_cluster_node_with_itself}, %{node: node_name}) do
65-
{:error, RabbitMQ.CLI.Core.ExitCodes.exit_software(),
66-
"Error: cannot cluster node with itself: #{node_name}"}
42+
def banner(_, _opts) do
43+
[
44+
"DEPRECATED. This command is a no-op. Node renaming is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
45+
]
6746
end
68-
69-
use RabbitMQ.CLI.DefaultOutput
70-
end
47+
end

0 commit comments

Comments
 (0)