Skip to content

Make a minimal set of rabbitmq-queues CLI commands generic#15226

Merged
ansd merged 3 commits intomainfrom
da-queue-commands
Jan 19, 2026
Merged

Make a minimal set of rabbitmq-queues CLI commands generic#15226
ansd merged 3 commits intomainfrom
da-queue-commands

Conversation

@ansd
Copy link
Copy Markdown
Member

@ansd ansd commented Jan 8, 2026

What?

This commit makes the following rabbitmq-queues CLI commands queue
type generic such that they do not only work against quorum queues, but
also against other (replicated or Ra based) queue types:

rabbitmq-queues add_member
rabbitmq-queues delete_member
rabbitmq-queues quorum_status
rabbitmq-queues grow
rabbitmq-queues shrink

This PR is a subset of what was aimed for in #14119.

Why?

Plugins may introduce other Ra based queue types which should
also support above CLI commands. Instead of creating new queue type
specific CLI commands, it's more user friendly if above existing CLI
commands work with the new queue types.

How?

The following queue based CLI commands already work against multiple
queue types:

rabbitmqctl list_queues
rabbitmqctl purge_queue
rabbitmqctl delete_queue
rabbitmqctl list_unresponsive_queues
rabbitmq-queues rebalance
rabbitmq-queues check_if_node_is_quorum_critical

The following CLI commands stay quorum queue specific:

rabbitmq-queues check_if_new_quorum_queue_replicas_have_finished_initial_sync
rabbitmq-queues peek
rabbitmq-queues reclaim_quorum_memory
rabbitmq-diagnostics check_for_quorum_queues_without_an_elected_leader
rabbitmq-queues force_checkpoint

Command rabbitmq-queues force_checkpoint will be a no-op starting in 4.3 thanks to Ra v3.

The following CLI commands are made queue type generic:

rabbitmq-queues add_member
rabbitmq-queues delete_member
rabbitmq-queues quorum_status
rabbitmq-queues grow
rabbitmq-queues shrink

Adding a member, deleting a member, and getting the status for a queue
are the most essential commands. Commands grow and shrink are only
wrappers for add_member and delete_member. Arguably, a simple bash
script is sufficient to call add_member or delete_member multiple
times. But for consistency and convenience this commit decides to make
grow and shrink also generic.

These CLI commands call from now on into rabbit_queue_type_ra instead of
calling into rabbit_quorum_queue.

This commit also ensures that the CLI commands are mixed version
compatible. In a mixed version 4.3 / 4.2 cluster, both a 4.3 CLI
and a 4.2 CLI should be able to execute for example
rabbitmq-queues quorum_status against either 4.3 or 4.2 nodes.

Making the following quorum queue specific HTTP API endpoints queue type generic
is out of scope in this commit:

/queues/quorum/:vhost/:queue/status
/queues/quorum/:vhost/:queue/replicas/add
/queues/quorum/:vhost/:queue/replicas/delete
/queues/quorum/replicas/on/:node/grow
/queues/quorum/replicas/on/:node/shrink

Unfortunately, they contain quorum in the HTTP path and also contain
quorum queue specific configuration variables, such as "restriction" quorum_queue_replica_operations.
It's up for discussion whether these same HTTP endpoints should be made
queue type generic or whether new HTTP endpoints should be introduced for new
queue types.

@ansd ansd force-pushed the da-queue-commands branch 5 times, most recently from ea977d5 to 987f288 Compare January 9, 2026 10:41
@ansd ansd added this to the 4.3.0 milestone Jan 9, 2026
@ansd ansd self-assigned this Jan 9, 2026
@ansd ansd force-pushed the da-queue-commands branch from 987f288 to 0ee6143 Compare January 9, 2026 10:58
@ansd ansd marked this pull request as ready for review January 9, 2026 12:41
@ansd ansd marked this pull request as draft January 9, 2026 13:30
@ansd ansd force-pushed the da-queue-commands branch 2 times, most recently from a21a85c to 3ea7761 Compare January 9, 2026 13:33
@ansd ansd marked this pull request as ready for review January 9, 2026 15:20
ansd added 3 commits January 19, 2026 10:25
 ## What?

This commit makes the following `rabbitmq-queues` CLI commands queue
type generic such that they do not only work against quorum queues, but
also against other (replicated or Ra based) queue types:
```
rabbitmq-queues add_member
rabbitmq-queues delete_member
rabbitmq-queues quorum_status
rabbitmq-queues grow
rabbitmq-queues shrink
```

 ## Why?

Plugins may introduce other Ra based queue types which should
also support above CLI commands. Instead of creating new queue type
specific CLI commands, it's more user friendly if above existing CLI
commands work with the new queue types.

 ## How?

The following queue based CLI commands already work against multiple
queue types:
```
rabbitmqctl list_queues
rabbitmqctl purge_queue
rabbitmqctl delete_queue
rabbitmqctl list_unresponsive_queues
rabbitmq-queues rebalance
rabbitmq-queues check_if_node_is_quorum_critical
```

The following CLI commands stay quorum queue specific:
```
rabbitmq-queues check_if_new_quorum_queue_replicas_have_finished_initial_sync
rabbitmq-queues peek
rabbitmq-queues reclaim_quorum_memory
rabbitmq-diagnostics check_for_quorum_queues_without_an_elected_leader_command
rabbitmq-queues force_checkpoint
```
Command `rabbitmq-queues force_checkpoint` will be a no-op starting in 4.3 thanks to Ra v3.

The following CLI commands are made queue type generic:
```
rabbitmq-queues add_member
rabbitmq-queues delete_member
rabbitmq-queues quorum_status
rabbitmq-queues grow
rabbitmq-queues shrink
```
Adding a member, deleting a member, and getting the status for a queue
are the most essential commands. Commands `grow` and `shrink` are only
wrappers for `add_member` and `delete_member`. Arguably, a simple bash
script is sufficient to call `add_member` or `delete_member` multiple
times. But for consistency and convenience this commit decides to make
`grow` and `shrink` also generic.

These CLI commands call from now on into `rabbit_queue_type` instead of
calling into `rabbit_quorum_queue`.

`rabbit_queue_type` is getting more and more bloated. Therefore, in
future, we should ideally split the `rabbbit_queue_type` module into two modules:
One for a message flow related API, e.g. enqueue, checkout, settle (for stateful interactions)
and one for queue topology management/observability API (for stateless interactions).

This commit also ensures that the CLI commands are mixed version
compatible. In a mixed version 4.3 / 4.2 cluster, both a 4.3 CLI
and a 4.2 CLI should be able to execute for example
`rabbitmq-queues quorum_status` against either 4.3 or 4.2 nodes.

Making the following quorum queue specific HTTP API endpoints queue type generic
is out of scope in this commit:
```
/queues/quorum/:vhost/:queue/status
/queues/quorum/:vhost/:queue/replicas/add
/queues/quorum/:vhost/:queue/replicas/delete
/queues/quorum/replicas/on/:node/grow
/queues/quorum/replicas/on/:node/shrink
```
Unfortunately, they contain `quorum` in the HTTP path and also contain
quorum queue specific configuration variables, such as "restriction" `quorum_queue_replica_operations`.
It's up for discussion whether these same HTTP endpoints should be made
queue type generic or whether new HTTP endpoints should be introduced for new
queue types.
This commit refactors the Ra-specific queue operations introduced in the
previous commit into a dedicated module.

This design is cleaner because:

- `rabbit_queue_type` stays generic for all queue types
- `rabbit_queue_type_ra` is specific to Ra-based queue types
- Clear semantics: `rabbitmq-streams` commands call `rabbit_stream_queue`
  directly (stream-specific), while `rabbitmq-queues` commands call
  `rabbit_queue_type_ra` (for all Ra-based queue types)
Apply PR feedback from #15226 (comment)
@ansd ansd force-pushed the da-queue-commands branch from fbc5c5f to e94beb8 Compare January 19, 2026 10:14
@ansd ansd merged commit 917a612 into main Jan 19, 2026
291 checks passed
@ansd ansd deleted the da-queue-commands branch January 19, 2026 12:18
ansd added a commit that referenced this pull request Jan 20, 2026
This CLI command applies to all Ra based queue types going forward, not
only to quorum queues (see
#15226)
ansd added a commit that referenced this pull request Jan 21, 2026
This commit makes `rabbit_queue_type_ra:add_member/5` and
`rabbit_queue_type_ra:delete_member/3` idempotent by returning `ok`
if the member is already added or already deleted.

`quorum_queue_SUITE` now uses `rabbit_queue_type_ra` like the CLI
commands.

This commit is a follow-up of #15226
ansd added a commit that referenced this pull request Jan 21, 2026
This commit makes `rabbit_queue_type_ra:add_member/5` and
`rabbit_queue_type_ra:delete_member/3` idempotent by returning `ok`
if the member is already added or already deleted.

`quorum_queue_SUITE` now uses `rabbit_queue_type_ra` like the CLI
commands.

This commit is a follow-up of #15226
michaelklishin pushed a commit that referenced this pull request Feb 24, 2026
* Make a minimal set of `rabbitmq-queues` CLI commands generic

 ## What?

This commit makes the following `rabbitmq-queues` CLI commands queue
type generic such that they do not only work against quorum queues, but
also against other (replicated or Ra based) queue types:
```
rabbitmq-queues add_member
rabbitmq-queues delete_member
rabbitmq-queues quorum_status
rabbitmq-queues grow
rabbitmq-queues shrink
```

 ## Why?

Plugins may introduce other Ra based queue types which should
also support above CLI commands. Instead of creating new queue type
specific CLI commands, it's more user friendly if above existing CLI
commands work with the new queue types.

 ## How?

The following queue based CLI commands already work against multiple
queue types:
```
rabbitmqctl list_queues
rabbitmqctl purge_queue
rabbitmqctl delete_queue
rabbitmqctl list_unresponsive_queues
rabbitmq-queues rebalance
rabbitmq-queues check_if_node_is_quorum_critical
```

The following CLI commands stay quorum queue specific:
```
rabbitmq-queues check_if_new_quorum_queue_replicas_have_finished_initial_sync
rabbitmq-queues peek
rabbitmq-queues reclaim_quorum_memory
rabbitmq-diagnostics check_for_quorum_queues_without_an_elected_leader_command
rabbitmq-queues force_checkpoint
```
Command `rabbitmq-queues force_checkpoint` will be a no-op starting in 4.3 thanks to Ra v3.

The following CLI commands are made queue type generic:
```
rabbitmq-queues add_member
rabbitmq-queues delete_member
rabbitmq-queues quorum_status
rabbitmq-queues grow
rabbitmq-queues shrink
```
Adding a member, deleting a member, and getting the status for a queue
are the most essential commands. Commands `grow` and `shrink` are only
wrappers for `add_member` and `delete_member`. Arguably, a simple bash
script is sufficient to call `add_member` or `delete_member` multiple
times. But for consistency and convenience this commit decides to make
`grow` and `shrink` also generic.

These CLI commands call from now on into `rabbit_queue_type` instead of
calling into `rabbit_quorum_queue`.

`rabbit_queue_type` is getting more and more bloated. Therefore, in
future, we should ideally split the `rabbbit_queue_type` module into two modules:
One for a message flow related API, e.g. enqueue, checkout, settle (for stateful interactions)
and one for queue topology management/observability API (for stateless interactions).

This commit also ensures that the CLI commands are mixed version
compatible. In a mixed version 4.3 / 4.2 cluster, both a 4.3 CLI
and a 4.2 CLI should be able to execute for example
`rabbitmq-queues quorum_status` against either 4.3 or 4.2 nodes.

Making the following quorum queue specific HTTP API endpoints queue type generic
is out of scope in this commit:
```
/queues/quorum/:vhost/:queue/status
/queues/quorum/:vhost/:queue/replicas/add
/queues/quorum/:vhost/:queue/replicas/delete
/queues/quorum/replicas/on/:node/grow
/queues/quorum/replicas/on/:node/shrink
```
Unfortunately, they contain `quorum` in the HTTP path and also contain
quorum queue specific configuration variables, such as "restriction" `quorum_queue_replica_operations`.
It's up for discussion whether these same HTTP endpoints should be made
queue type generic or whether new HTTP endpoints should be introduced for new
queue types.

* Introduce rabbit_queue_type_ra for Ra-based queue types

This commit refactors the Ra-specific queue operations introduced in the
previous commit into a dedicated module.

This design is cleaner because:

- `rabbit_queue_type` stays generic for all queue types
- `rabbit_queue_type_ra` is specific to Ra-based queue types
- Clear semantics: `rabbitmq-streams` commands call `rabbit_stream_queue`
  directly (stream-specific), while `rabbitmq-queues` commands call
  `rabbit_queue_type_ra` (for all Ra-based queue types)

* Remove duplicate code

Apply PR feedback from #15226 (comment)
michaelklishin pushed a commit that referenced this pull request Feb 24, 2026
This CLI command applies to all Ra based queue types going forward, not
only to quorum queues (see
#15226)
michaelklishin pushed a commit that referenced this pull request Feb 24, 2026
This commit makes `rabbit_queue_type_ra:add_member/5` and
`rabbit_queue_type_ra:delete_member/3` idempotent by returning `ok`
if the member is already added or already deleted.

`quorum_queue_SUITE` now uses `rabbit_queue_type_ra` like the CLI
commands.

This commit is a follow-up of #15226
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants