-
Notifications
You must be signed in to change notification settings - Fork 3.9k
DO NOT MERGE Reply reject_publish
when queue marks a message as duplicate
#1741
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
Conversation
The `rabbit_backing_queue` behaviour defines a `is_duplicate` callback to signal the message about to be published is a duplicate. Nevertheless, the broker logic does not take any action if so. This becomes problematic if the client enables publisher confirmation as neither a confirm nor a reject is provided as response if a message gets dropped as duplicate. This patch ensures the client receives a rejection if a queue marks the delivered message as duplicate. Signed-off-by: Matteo Cafasso <[email protected]>
@noxdafox Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
Can we take a step back and explain why the current behavior has to change? |
Uhm... there seems to be some issue with GitHub and this issue ticket as @michaelklishin comment seems to appear/disappear? @michaelklishin I explain what the issue is in both the commit message and in the "further comments". More information is also available at the linked issue. Can you please help me understanding what shall I clarify more? |
@noxdafox under what circumstances did the client not receive a nack? The commit message doesn't explain that. Why is this a good idea to nack such messages? What kind of applications can be affected? |
So the context is in noxdafox/rabbitmq-message-deduplication#21. I'm not convinced this is what RabbitMQ users who don't use that plugin want. |
reject_publish
when queue marks a message as duplicatereject_publish
when queue marks a message as duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should carefully assess how this affects the users who do not use the message deduplication plugin.
The backing queue behavior docs do not suggest if duplicates should be rejected but it does mention that the caller might consider treating the message as "dropped". rabbit_variable_queue:is_duplicate/2 always returns It gets a lot more interesting in the classic mirrored queue implementation. Mirrors can see a message more than once due to how the So this would be a breaking and surprising change to those who use classic mirrored queues: they would get false negatives. |
According to the Nevertheless, the logic does not take this scenario into account when replying to the client. This becomes problematic if a client enables publish confirmation as the client is left hanging indefinitely. I did not take into account the mirrored queues implementation actually. I see how the raised concern is valid. |
We'd welcome a different PR for 3.8 (master) that would make it possible to address noxdafox/rabbitmq-message-deduplication#21 without breaking changes. |
@noxdafox I can see why the current behavior in As @kjnilsson and I concluded in a 1-on-1 conversation, the callback was originally added to introduce some of the idiosyncrasies and flaws in the |
Sadly the dynamic nature of RabbitMQ queues mean that many of the abstractions aren't as intuitive as they should be. Could we extend the |
I see, the behaviour documentation did not mention the callback was for internal use only. May I suggest to change the callback interface or add a new one? This would still enable the Use Case without the need of affecting mirrored queues implementation. For example, the The change would be minimal within the broker logic but I am not sure how flexible we can be when it comes to change behaviour APIs. EDIT: @kjnilsson was faster :) |
@noxdafox we can make any internal interface changes for 3.8.0. As long as on disk data and client protocol are not affected, we'd consider it ;) |
I will start by providing a RFC PR changing the We can later discuss whether to introduce |
The
rabbit_backing_queue
behaviour defines ais_duplicate
callbackto signal if the message about to be published is a
duplicate. Nevertheless, the broker logic does not take any action if
so.
This becomes problematic if the client enables publisher confirmation
as neither a confirm nor a reject is provided as response in case
a message gets dropped as duplicate.
This patch ensures the client receives a rejection if a queue marks
the delivered message as duplicate.
Signed-off-by: Matteo Cafasso [email protected]
Types of Changes
Checklist
CONTRIBUTING.md
documentFurther Comments
Few users reported issues when using the message deduplication plugin together with publisher confirmation.
It appears the broker does not deliver any notification to the publisher when a backing queue
is_duplicate
callback returnstrue
. This causes clients to hang indefinitely waiting for a confirmation/rejection to come.This patch tackles the issue making sure a
nack
is delivered in case arabbit_backing_queue
implementation provides message deduplication.To reproduce the issue, you can install the deduplication plugin from the releases tab and follow the instruction provided in this issue.