Skip to content

Commit ff5a324

Browse files
Merge pull request #11716 from rabbitmq/cmq-cleanup
CMQ cleanup
2 parents c34faf9 + 5346339 commit ff5a324

File tree

3 files changed

+12
-119
lines changed

3 files changed

+12
-119
lines changed

deps/rabbit/docs/rabbitmqctl.8

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -463,38 +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-
.\" ## Classic Mirrored Queues
467-
.\" ------------------------------------------------------------------
468-
.Ss Replication
469-
.Bl -tag -width Ds
470-
.\" ------------------------------------------------------------------
471-
.It Cm sync_queue Oo Fl p Ar vhost Oc Ar queue
472-
.Bl -tag -width Ds
473-
.It Ar queue
474-
The name of the queue to synchronise.
475-
.El
476-
.Pp
477-
Instructs a mirrored queue with unsynchronised mirrors (follower replicas)
478-
to synchronise them.
479-
The queue will block while synchronisation takes place (all publishers
480-
and consumers using the queue will block or temporarily see no activity).
481-
This command can only be used with mirrored queues.
482-
To learn more, see the
483-
.Lk https://www.rabbitmq.com/ha.html "RabbitMQ Classic Queue Mirroring guide"
484-
.Pp
485-
Note that queues with unsynchronised replicas and active consumers
486-
will become synchronised eventually (assuming that consumers make progress).
487-
This command is primarily useful for queues that do not have active consumers.
488-
.\" ------------------------------------------------------------------
489-
.It Cm cancel_sync_queue Oo Fl p Ar vhost Oc Ar queue
490-
.Bl -tag -width Ds
491-
.It Ar queue
492-
The name of the queue to cancel synchronisation for.
493-
.El
494-
.Pp
495-
Instructs a synchronising mirrored queue to stop synchronising itself.
496-
.El
497-
.\" ------------------------------------------------------------------
498466
.\" ## User management
499467
.\" ------------------------------------------------------------------
500468
.Ss User Management
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# This script is called by rabbitmq-server-ha.ocf during RabbitMQ
22
# cluster start up. It is a convenient place to set your cluster
3-
# policy here, for example:
4-
# ${OCF_RESKEY_ctl} set_policy ha-all "." '{"ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 0
3+
# policy here. See https://www.rabbitmq.com/docs/parameters for examples

deps/rabbitmq_cli/lib/rabbitmq/cli/queues/commands/check_if_node_is_mirror_sync_critical_command.ex

Lines changed: 11 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
defmodule RabbitMQ.CLI.Queues.Commands.CheckIfNodeIsMirrorSyncCriticalCommand do
88
@moduledoc """
9+
DEPRECATED: this command does nothing in RabbitMQ 4.0 and newer.
10+
911
Exits with a non-zero code if there are classic mirrored queues that don't
1012
have any in sync mirrors online and would potentially lose data
1113
if the target node is shut down.
@@ -15,113 +17,37 @@ defmodule RabbitMQ.CLI.Queues.Commands.CheckIfNodeIsMirrorSyncCriticalCommand do
1517

1618
@behaviour RabbitMQ.CLI.CommandBehaviour
1719

18-
import RabbitMQ.CLI.Core.Platform, only: [line_separator: 0]
19-
2020
def scopes(), do: [:diagnostics, :queues]
2121

2222
use RabbitMQ.CLI.Core.AcceptsDefaultSwitchesAndTimeout
2323
use RabbitMQ.CLI.Core.MergesNoDefaults
2424
use RabbitMQ.CLI.Core.AcceptsNoPositionalArguments
2525
use RabbitMQ.CLI.Core.RequiresRabbitAppRunning
2626

27-
def run([], %{node: node_name, timeout: timeout}) do
28-
case :rabbit_misc.rpc_call(node_name, :rabbit_nodes, :is_single_node_cluster, [], timeout) do
29-
# if target node is the only one in the cluster, the check makes little sense
30-
# and false positives can be misleading
31-
true ->
32-
{:ok, :single_node_cluster}
33-
34-
false ->
35-
case :rabbit_misc.rpc_call(
36-
node_name,
37-
:rabbit_amqqueue,
38-
:list_local_mirrored_classic_without_synchronised_mirrors_for_cli,
39-
[],
40-
timeout
41-
) do
42-
[] -> {:ok, []}
43-
qs when is_list(qs) -> {:ok, qs}
44-
other -> other
45-
end
46-
47-
other ->
48-
other
49-
end
50-
end
51-
52-
def output({:ok, :single_node_cluster}, %{formatter: "json"}) do
53-
{:ok,
54-
%{
55-
"result" => "ok",
56-
"message" =>
57-
"Target node seems to be the only one in a single node cluster, the check does not apply"
58-
}}
27+
def run([], _opts) do
28+
:ok
5929
end
6030

61-
def output({:ok, []}, %{formatter: "json"}) do
31+
def output(:ok, %{formatter: "json"}) do
6232
{:ok, %{"result" => "ok"}}
6333
end
6434

65-
def output({:ok, :single_node_cluster}, %{silent: true}) do
66-
{:ok, :check_passed}
67-
end
68-
69-
def output({:ok, []}, %{silent: true}) do
70-
{:ok, :check_passed}
71-
end
72-
73-
def output({:ok, :single_node_cluster}, %{node: node_name}) do
74-
{:ok,
75-
"Node #{node_name} seems to be the only one in a single node cluster, the check does not apply"}
76-
end
77-
78-
def output({:ok, []}, %{node: node_name}) do
79-
{:ok,
80-
"Node #{node_name} reported no classic mirrored queues without online synchronised mirrors"}
81-
end
82-
83-
def output({:ok, qs}, %{node: node_name, formatter: "json"}) when is_list(qs) do
84-
{:error, :check_failed,
85-
%{
86-
"result" => "error",
87-
"queues" => qs,
88-
"message" =>
89-
"Node #{node_name} reported local classic mirrored queues without online synchronised mirrors"
90-
}}
91-
end
92-
93-
def output({:ok, qs}, %{silent: true}) when is_list(qs) do
94-
{:error, :check_failed}
95-
end
96-
97-
def output({:ok, qs}, %{node: node_name}) when is_list(qs) do
98-
lines = queue_lines(qs, node_name)
99-
100-
{:error, :check_failed, Enum.join(lines, line_separator())}
35+
def output(:ok, _opts) do
36+
{:ok, "ok"}
10137
end
10238

10339
use RabbitMQ.CLI.DefaultOutput
10440

105-
def help_section(), do: :observability_and_health_checks
41+
def help_section(), do: :deprecated
10642

10743
def description() do
108-
"Health check that exits with a non-zero code if there are classic mirrored queues " <>
109-
"without online synchronised mirrors (queues that would potentially lose data if the target node is shut down)"
44+
"DEPRECATED. Mirrored queues were removed in RabbitMQ 4.0. This command is a no-op."
11045
end
11146

11247
def usage, do: "check_if_node_is_mirror_sync_critical"
11348

114-
def banner([], %{node: node_name}) do
115-
"Checking if node #{node_name} is critical for data safety of any classic mirrored queues ..."
49+
def banner([], _) do
50+
"This command is DEPRECATED and is a no-op. It will be removed in a future version."
11651
end
11752

118-
#
119-
# Implementation
120-
#
121-
122-
def queue_lines(qs, node_name) do
123-
for q <- qs do
124-
"#{q["readable_name"]} would lose its only synchronised replica (master) if node #{node_name} is stopped"
125-
end
126-
end
12753
end

0 commit comments

Comments
 (0)