[fix][broker]fix Repeated messages of shared dispatcher#18227
Open
poorbarcode wants to merge 1 commit intoapache:masterfrom
Open
[fix][broker]fix Repeated messages of shared dispatcher#18227poorbarcode wants to merge 1 commit intoapache:masterfrom
poorbarcode wants to merge 1 commit intoapache:masterfrom
Conversation
This was referenced Oct 28, 2022
Contributor
|
@poorbarcode Interesting. I think the expected behavior is no matter how many consumers are under a subscription. The subscription should only perform the entry read operation one by one. |
Comment on lines
+586
to
+592
| if (readType == ReadType.Replay) { | ||
| entries.removeIf(entry -> !redeliveryMessages.contains(entry.getLedgerId(), entry.getEntryId())); | ||
| } |
Contributor
There was a problem hiding this comment.
I have tried to remove these lines to check the newly added test concurrentlyReceiveDeliveriedMessages
It always gets passed with invocationCount = 100
Contributor
Author
There was a problem hiding this comment.
I have modified the test concurrentlyRedeliverAndCloseLastConsumer to make that the probability of the problem occurring is greater than 50%.
181efdf to
bd153aa
Compare
bd153aa to
4302dc4
Compare
4302dc4 to
d376c9a
Compare
|
The pr had no activity for 30 days, mark with Stale label. |
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.
Fixes #16795
Motivation
In
Shardmode:cursor.rewindwhich moves the read position to the earliest.When the above two events are executed concurrently, the resulting redelivered message will be consumed twice.
E.g:
close the last consumer & create 2 consumerredeliver3:1) to redeliver queuereadMoreEntries)3:1) from the redeliver queue3:0)3:0~3:103:0) to the new consumer3:0~3:10to the new consumer B3:0) to the new consumer AHow to reproduce the problem
Run
SimpleProducerConsumerTest.concurrentlyRedeliverAndCloseLastConsumertwice.Modifications
Before step 7 of the flow
redeliver, check that the messages are still in queuemessagesToRedeliver.Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: