-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[fix][broker]fix Repeated messages of shared dispatcher #18227
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
base: master
Are you sure you want to change the base?
[fix][broker]fix Repeated messages of shared dispatcher #18227
Conversation
@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. |
if (readType == ReadType.Replay) { | ||
entries.removeIf(entry -> !redeliveryMessages.contains(entry.getLedgerId(), entry.getEntryId())); | ||
} |
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.
I have tried to remove these lines to check the newly added test concurrentlyReceiveDeliveriedMessages
It always gets passed with invocationCount = 100
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.
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. |
Fixes #16795
Motivation
In
Shard
mode:cursor.rewind
which 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 consumer
redeliver
3:1
) to redeliver queuereadMoreEntries
)3:1
) from the redeliver queue3:0
)3:0~3:10
3:0
) to the new consumer3:0~3:10
to the new consumer B3:0
) to the new consumer AHow to reproduce the problem
Run
SimpleProducerConsumerTest.concurrentlyRedeliverAndCloseLastConsumer
twice.Modifications
Before step 7 of the flow
redeliver
, check that the messages are still in queuemessagesToRedeliver
.Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: