-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store MQTT messages as non-durable if QoS 0 #11012
Merged
Merged
Conversation
This file contains 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
By default, when the 'durable' message container (mc) annotation is unset, messages are interpreted to be durable. Prior to this commit, MQTT messages that were sent with QoS 0 were stored durably in classic queues. This commit takes the same approach for mc_mqtt as for mc_amqpl and mc_amqp: If the message is durable, the durable mc annotation will not be set. If the message is non-durable, the durable mc annotation will be set to false.
kjnilsson
approved these changes
Apr 16, 2024
@ansd @kjnilsson is this something that we should mention in release notes or is it a matter of properly using the internal message container format? |
We should mention in the release notes that, in 3.13.0 and 3.13.1, MQTT QoS 0 messages that were sent to classic queues were always persisted to disk which is unnecessary and may result in poorer performance. This is fixed in 3.13.2. |
ansd
added a commit
that referenced
this pull request
Apr 22, 2024
This is a follow up to #11012 ## What? For incoming MQTT messages, always set the `durable` message container annotation. ## Why? Even though defaulting to `durable=true` when no durable annotation is set, as prior to this commit, is good enough, explicitly setting the durable annotation makes the code a bit more future proof and maintainable going forward in 4.0 where we will rely more on the durable annotation because AMQP 1.0 message headers will be omitted in classic and quorum queues (see #10964) For MQTT messages, it's important to know whether the message was published with QoS 0 or QoS 1 because it affects the QoS the MQTT message that will delivered to the MQTT subscriber. The performance impact of always setting the durable annotation is negligible.
ansd
added a commit
that referenced
this pull request
Apr 22, 2024
This is a follow up to #11012 ## What? For incoming MQTT messages, always set the `durable` message container annotation. ## Why? Even though defaulting to `durable=true` when no durable annotation is set, as prior to this commit, is good enough, explicitly setting the durable annotation makes the code a bit more future proof and maintainable going forward in 4.0 where we will rely more on the durable annotation because AMQP 1.0 message headers will be omitted in classic and quorum queues (see #10964) For MQTT messages, it's important to know whether the message was published with QoS 0 or QoS 1 because it affects the QoS for the MQTT message that will delivered to the MQTT subscriber. The performance impact of always setting the durable annotation is negligible.
ansd
added a commit
that referenced
this pull request
Apr 22, 2024
This is a follow up to #11012 ## What? For incoming MQTT messages, always set the `durable` message container annotation. ## Why? Even though defaulting to `durable=true` when no durable annotation is set, as prior to this commit, is good enough, explicitly setting the durable annotation makes the code a bit more future proof and maintainable going forward in 4.0 where we will rely more on the durable annotation because AMQP 1.0 message headers will be omitted in classic and quorum queues (see #10964) For MQTT messages, it's important to know whether the message was published with QoS 0 or QoS 1 because it affects the QoS for the MQTT message that will delivered to the MQTT subscriber. The performance impact of always setting the durable annotation is negligible.
mergify bot
pushed a commit
that referenced
this pull request
Apr 22, 2024
This is a follow up to #11012 ## What? For incoming MQTT messages, always set the `durable` message container annotation. ## Why? Even though defaulting to `durable=true` when no durable annotation is set, as prior to this commit, is good enough, explicitly setting the durable annotation makes the code a bit more future proof and maintainable going forward in 4.0 where we will rely more on the durable annotation because AMQP 1.0 message headers will be omitted in classic and quorum queues (see #10964) For MQTT messages, it's important to know whether the message was published with QoS 0 or QoS 1 because it affects the QoS for the MQTT message that will delivered to the MQTT subscriber. The performance impact of always setting the durable annotation is negligible. (cherry picked from commit e576dd7)
ansd
added a commit
that referenced
this pull request
Apr 22, 2024
This is a follow up to #11012 ## What? For incoming MQTT messages, always set the `durable` message container annotation. ## Why? Even though defaulting to `durable=true` when no durable annotation is set, as prior to this commit, is good enough, explicitly setting the durable annotation makes the code a bit more future proof and maintainable going forward in 4.0 where we will rely more on the durable annotation because AMQP 1.0 message headers will be omitted in classic and quorum queues (see #10964) For MQTT messages, it's important to know whether the message was published with QoS 0 or QoS 1 because it affects the QoS for the MQTT message that will delivered to the MQTT subscriber. The performance impact of always setting the durable annotation is negligible. (cherry picked from commit e576dd7)
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.
By default, when the 'durable' message container (mc) annotation is unset, messages are interpreted to be durable.
Prior to this commit, MQTT messages that were sent with QoS 0 were stored durably in classic queues.
This commit takes the same approach for mc_mqtt as for mc_amqpl and mc_amqp: If the message is durable, the durable mc annotation will not be set. If the message is non-durable, the durable mc annotation will be set to false.