Skip to content

Conversation

dumbbell
Copy link
Collaborator

Why

With Mnesia, when the network partition strategy is set to pause_minority, nodes on the "minority side" are stopped.

Thus, the exclusive queues that were hosted by nodes on that minority side are lost:

  • Consumers connected on these nodes are disconnected because the nodes are stopped.
  • Queue records on the majority side are deleted from the metadata store.

This was ok with Mnesia and how this network partition handling strategy is implemented. However, it does not work with Khepri because the nodes on the "minority side" continue to run and serve clients. Therefore the cluster ends up in a weird situation:

  1. The "majority side" deleted the queue records.
  2. When the network partition is solved, the "minority side" gets the record deletion, but the queue processes continue to run.

How

With Khepri, we stop to delete transient queue records in general, just because there is a node going down. Thanks to this, an exclusive queue and its consumer are not affected by a network partition: they continue to work.

However, if a node is really lost, we need to clean up dead queue records. This was already done for durable queues with both Mnesia and Khepri. But with Khepri, transient queue records persist in the store like durable queue records (unlike with Mnesia).

That's why this commit changes the clean-up function, rabbit_amqqueue:forget_all_durable/1 into
rabbit_amqqueue:forget_all/1 which deletes all queue records of queues that were hosted on the given node, regardless if they are transient or durable.

Fixes #12949, #12597.

@dumbbell dumbbell self-assigned this Sep 19, 2025
@dumbbell dumbbell force-pushed the fix-exclusive-queues-with-khepri branch from dd66a56 to 2b31b23 Compare September 19, 2025 11:57
[Why]
With Mnesia, when the network partition strategy is set to
`pause_minority`, nodes on the "minority side" are stopped.

Thus, the exclusive queues that were hosted by nodes on that minority
side are lost:
* Consumers connected on these nodes are disconnected because the nodes
  are stopped.
* Queue records on the majority side are deleted from the metadata
  store.

This was ok with Mnesia and how this network partition handling strategy
is implemented. However, it does not work with Khepri because the nodes
on the "minority side" continue to run and serve clients. Therefore the
cluster ends up in a weird situation:
1. The "majority side" deleted the queue records.
2. When the network partition is solved, the "minority side" gets the
   record deletion, but the queue processes continue to run.

[How]
With Khepri, we stop to delete transient queue records in general, just
because there is a node going down. Thanks to this, an exclusive queue
and its consumer are not affected by a network partition: they continue
to work.

However, if a node is really lost, we need to clean up dead queue
records. This was already done for durable queues with both Mnesia and
Khepri. But with Khepri, transient queue records persist in the store
like durable queue records (unlike with Mnesia).

That's why this commit changes the clean-up function,
`rabbit_amqqueue:forget_all_durable/1` into
`rabbit_amqqueue:forget_all/1` which deletes all queue records of queues
that were hosted on the given node, regardless if they are transient or
durable.

Fixes #12949, #12597.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exclusive queues can be deleted without the consumers being notified With Khepri, transient exclusive queues are not deleted in case of a partition
2 participants