Add rabbit_khepri:fence/1 when MQTT client connects#15557
Merged
Conversation
## What? When an MQTT client connects to a RabbitMQ node, block until this RabbitMQ node applied the latest Khepri changes locally. ## Why? The new MQTT connection process must be aware of the latest MQTT session state due to various requirements in the MQTT spec, for example: > If a CONNECT packet is received with Clean Start set to 0 and there is a Session associated with the Client Identifier, the Server MUST resume communications with the Client based on state from the existing Session If the local member hangs behind, the local member must first catch up to determine the latest session state. Imagine an MQTT client that re-connects from one RabbiMQ node A to another RabbitMQ node B that hangs behind. The connection on node B should be aware of the MQTT session state. ## How? We use a timeout of 30 seconds. If the local node can't apply the latest changes within 30 seconds, we mark it as unavailable and close the connection.
the-mikedavis
approved these changes
Feb 25, 2026
michaelklishin
approved these changes
Feb 25, 2026
michaelklishin
added a commit
that referenced
this pull request
Feb 26, 2026
Add `rabbit_khepri:fence/1` when MQTT client connects (backport #15557)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
When an MQTT client connects to a RabbitMQ node, block until this RabbitMQ node applied the latest Khepri changes locally.
Why?
The new MQTT connection process must be aware of the latest MQTT session state due to various requirements in the MQTT spec, for example:
If the local member hangs behind, the local member must first catch up to determine the latest session state.
Imagine an MQTT client that re-connects from one RabbiMQ node A to another RabbitMQ node B that hangs behind. The connection on node B should be aware of the MQTT session state.
How?
We use a timeout of 30 seconds. If the local node can't apply the latest changes within 30 seconds, we mark it as unavailable and close the connection.