Skip to content

Commit 7f8f229

Browse files
Merge pull request #10369 from rabbitmq/rabbitmq-server-10367
Make 'rabbitmqctl rename_cluster_node' and 'rabbitmqctl update_cluster_nodes ' no-ops
2 parents 9b884bb + 725ddaa commit 7f8f229

18 files changed

+42
-1175
lines changed

deps/rabbit/BUILD.bazel

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,6 @@ rabbitmq_integration_suite(
321321
],
322322
)
323323

324-
rabbitmq_integration_suite(
325-
name = "cluster_rename_SUITE",
326-
size = "large",
327-
flaky = True,
328-
shard_count = 3,
329-
)
330-
331324
rabbitmq_integration_suite(
332325
name = "cluster_SUITE",
333326
size = "medium",
@@ -347,7 +340,7 @@ rabbitmq_integration_suite(
347340
additional_beam = [
348341
":test_clustering_utils_beam",
349342
],
350-
shard_count = 48,
343+
shard_count = 45,
351344
sharding_method = "case",
352345
)
353346

@@ -613,10 +606,7 @@ rabbitmq_integration_suite(
613606
rabbitmq_integration_suite(
614607
name = "per_vhost_connection_limit_SUITE",
615608
size = "medium",
616-
additional_beam = [
617-
":cluster_rename_SUITE_beam_files",
618-
],
619-
shard_count = 10,
609+
shard_count = 9,
620610
)
621611

622612
rabbitmq_integration_suite(

deps/rabbit/app.bzl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ def all_beam_files(name = "all_beam_files"):
169169
"src/rabbit_mirror_queue_slave.erl",
170170
"src/rabbit_mirror_queue_sync.erl",
171171
"src/rabbit_mnesia.erl",
172-
"src/rabbit_mnesia_rename.erl",
173172
"src/rabbit_mnesia_to_khepri_record_converter.erl",
174173
"src/rabbit_msg_file.erl",
175174
"src/rabbit_msg_record.erl",
@@ -434,7 +433,6 @@ def all_test_beam_files(name = "all_test_beam_files"):
434433
"src/rabbit_mirror_queue_slave.erl",
435434
"src/rabbit_mirror_queue_sync.erl",
436435
"src/rabbit_mnesia.erl",
437-
"src/rabbit_mnesia_rename.erl",
438436
"src/rabbit_mnesia_to_khepri_record_converter.erl",
439437
"src/rabbit_msg_file.erl",
440438
"src/rabbit_msg_record.erl",
@@ -717,7 +715,6 @@ def all_srcs(name = "all_srcs"):
717715
"src/rabbit_mirror_queue_slave.erl",
718716
"src/rabbit_mirror_queue_sync.erl",
719717
"src/rabbit_mnesia.erl",
720-
"src/rabbit_mnesia_rename.erl",
721718
"src/rabbit_mnesia_to_khepri_record_converter.erl",
722719
"src/rabbit_msg_file.erl",
723720
"src/rabbit_msg_record.erl",
@@ -867,15 +864,6 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
867864
deps = ["//deps/amqp_client:erlang_app"],
868865
)
869866

870-
erlang_bytecode(
871-
name = "cluster_rename_SUITE_beam_files",
872-
testonly = True,
873-
srcs = ["test/cluster_rename_SUITE.erl"],
874-
outs = ["test/cluster_rename_SUITE.beam"],
875-
app_name = "rabbit",
876-
erlc_opts = "//:test_erlc_opts",
877-
deps = ["//deps/amqp_client:erlang_app"],
878-
)
879867
erlang_bytecode(
880868
name = "clustering_management_SUITE_beam_files",
881869
testonly = True,

deps/rabbit/docs/rabbitmqctl.8

Lines changed: 1 addition & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -463,124 +463,6 @@ is part of, as a ram node:
463463
To learn more, see the
464464
.Lk https://www.rabbitmq.com/clustering.html "RabbitMQ Clustering guide".
465465
.\" ------------------------------------------------------------------
466-
.It Cm rename_cluster_node Ar oldnode1 Ar newnode1 Op Ar oldnode2 Ar newnode2 ...
467-
.Pp
468-
Supports renaming of cluster nodes in the local database.
469-
.Pp
470-
This subcommand causes
471-
.Nm
472-
to temporarily become the node in order to make the change.
473-
The local cluster node must therefore be completely stopped; other nodes
474-
can be online or offline.
475-
.Pp
476-
This subcommand takes an even number of arguments, in pairs representing
477-
the old and new names for nodes.
478-
You must specify the old and new names for this node and for any other
479-
nodes that are stopped and being renamed at the same time.
480-
.Pp
481-
It is possible to stop all nodes and rename them all simultaneously (in
482-
which case old and new names for all nodes must be given to every node)
483-
or stop and rename nodes one at a time (in which case each node only
484-
needs to be told how its own name is changing).
485-
.Pp
486-
For example, this command will rename the node
487-
.Qq rabbit@misshelpful
488-
to the node
489-
.Qq rabbit@cordelia
490-
.sp
491-
.Dl rabbitmqctl rename_cluster_node rabbit@misshelpful rabbit@cordelia
492-
.Pp
493-
Note that this command only changes the local database.
494-
It may also be necessary to rename the local database directories
495-
and configure the new node name.
496-
For example:
497-
.sp
498-
.Bl -enum -compact
499-
.It
500-
Stop the node:
501-
.sp
502-
.Dl rabbitmqctl stop rabbit@misshelpful
503-
.sp
504-
.It
505-
Rename the node in the local database:
506-
.sp
507-
.Dl rabbitmqctl rename_cluster_node rabbit@misshelpful rabbit@cordelia
508-
.sp
509-
.It
510-
Rename the local database directories (note, you do not need to do this
511-
if you have set the RABBITMQ_MNESIA_DIR environment variable):
512-
.sp
513-
.Bd -literal -offset indent -compact
514-
mv \\
515-
/var/lib/rabbitmq/mnesia/rabbit\\@misshelpful \\
516-
/var/lib/rabbitmq/mnesia/rabbit\\@cordelia
517-
mv \\
518-
/var/lib/rabbitmq/mnesia/rabbit\\@misshelpful-rename \\
519-
/var/lib/rabbitmq/mnesia/rabbit\\@cordelia-rename
520-
mv \\
521-
/var/lib/rabbitmq/mnesia/rabbit\\@misshelpful-plugins-expand \\
522-
/var/lib/rabbitmq/mnesia/rabbit\\@cordelia-plugins-expand
523-
.Ed
524-
.sp
525-
.It
526-
If node name is configured e.g. using
527-
.Ar /etc/rabbitmq/rabbitmq-env.conf
528-
, it also needs to be updated there.
529-
.sp
530-
.It
531-
Start the node when ready
532-
.El
533-
.\" ------------------------------------------------------------------
534-
.It Cm update_cluster_nodes Ar clusternode
535-
.Bl -tag -width Ds
536-
.It Ar clusternode
537-
The node to consult for up-to-date information.
538-
.El
539-
.Pp
540-
Instructs an already clustered node to contact
541-
.Ar clusternode
542-
to cluster when booting up.
543-
This is different from
544-
.Cm join_cluster
545-
since it does not join any cluster - it checks that the node is already
546-
in a cluster with
547-
.Ar clusternode .
548-
.Pp
549-
The need for this command is motivated by the fact that clusters can
550-
change while a node is offline.
551-
Consider a situation where node
552-
.Va rabbit@A
553-
and
554-
.Va rabbit@B
555-
are clustered.
556-
.Va rabbit@A
557-
goes down,
558-
.Va rabbit@C
559-
clusters with
560-
.Va rabbit@B ,
561-
and then
562-
.Va rabbit@B
563-
leaves the cluster.
564-
When
565-
.Va rabbit@A
566-
starts back up, it'll try to contact
567-
.Va rabbit@B ,
568-
but this will fail since
569-
.Va rabbit@B
570-
is not in the cluster anymore.
571-
The following command will rename node
572-
.Va rabbit@B
573-
to
574-
.Va rabbit@C
575-
on node
576-
.Va rabbitA
577-
.sp
578-
.Dl update_cluster_nodes -n Va rabbit@A Va rabbit@B Va rabbit@C
579-
.Pp
580-
To learn more, see the
581-
.Lk https://www.rabbitmq.com/clustering.html "RabbitMQ Clustering guide"
582-
.El
583-
.\" ------------------------------------------------------------------
584466
.\" ## Classic Mirrored Queues
585467
.\" ------------------------------------------------------------------
586468
.Ss Replication
@@ -598,7 +480,7 @@ The queue will block while synchronisation takes place (all publishers
598480
and consumers using the queue will block or temporarily see no activity).
599481
This command can only be used with mirrored queues.
600482
To learn more, see the
601-
.Lk https://www.rabbitmq.com/ha.html "RabbitMQ Mirroring guide"
483+
.Lk https://www.rabbitmq.com/ha.html "RabbitMQ Classic Queue Mirroring guide"
602484
.Pp
603485
Note that queues with unsynchronised replicas and active consumers
604486
will become synchronised eventually (assuming that consumers make progress).

deps/rabbit/src/rabbit_db_cluster.erl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +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([rename/2,
30-
update_cluster_nodes/1]).
31-
3226
-type node_type() :: disc_node_type() | ram_node_type().
3327
-type disc_node_type() :: disc.
3428
-type ram_node_type() :: ram.
@@ -390,15 +384,3 @@ cli_cluster_status_using_mnesia() ->
390384

391385
cli_cluster_status_using_khepri() ->
392386
rabbit_khepri:cli_cluster_status().
393-
394-
rename(Node, NodeMapList) ->
395-
case rabbit_khepri:is_enabled() of
396-
true -> {error, not_supported};
397-
false -> rabbit_mnesia_rename:rename(Node, NodeMapList)
398-
end.
399-
400-
update_cluster_nodes(DiscoveryNode) ->
401-
case rabbit_khepri:is_enabled() of
402-
true -> {error, not_supported};
403-
false -> rabbit_mnesia:update_cluster_nodes(DiscoveryNode)
404-
end.

deps/rabbit/src/rabbit_mnesia.erl

Lines changed: 4 additions & 27 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,
@@ -37,7 +36,8 @@
3736
dir/0,
3837
cluster_status_from_mnesia/0,
3938

40-
%% Operations on the db and utils, mainly used in `rabbit_mnesia_rename' and `rabbit'
39+
%% Operations on the db and utils, mainly used in `rabbit' and Mnesia-era modules
40+
%% (some of which may now be gone)
4141
init_db_unchecked/2,
4242
copy_db/1,
4343
check_mnesia_consistency/1,
@@ -284,27 +284,6 @@ change_cluster_node_type(Type) ->
284284
ok = reset(),
285285
ok = join_cluster(Node, Type).
286286

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

10881067
error_description(clustering_only_disc_node) ->
10891068
"You cannot cluster a node if it is the only disc node in its existing "
1090-
" cluster. If new nodes joined while this node was offline, use "
1091-
"'update_cluster_nodes' to add them manually.";
1069+
" cluster.";
10921070
error_description(resetting_only_disc_node) ->
10931071
"You cannot reset a node when it is the only disc node in a cluster. "
10941072
"Please convert another node of the cluster to a disc node first.";
10951073
error_description(not_clustered) ->
10961074
"Non-clustered nodes can only be disc nodes.";
10971075
error_description(no_online_cluster_nodes) ->
1098-
"Could not find any online cluster nodes. If the cluster has changed, "
1099-
"you can use the 'update_cluster_nodes' command.";
1076+
"Could not find any online cluster nodes.";
11001077
error_description(inconsistent_cluster) ->
11011078
"The nodes provided do not have this node as part of the cluster.";
11021079
error_description(not_a_cluster_node) ->

0 commit comments

Comments
 (0)