-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker]Fix repeated messages of shared streaming dispatcher #18289
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
[fix][broker]Fix repeated messages of shared streaming dispatcher #18289
Conversation
…erTest.testSharedSamePriorityConsumer
| PulsarClient newPulsarClient4 = newPulsarClient(lookupUrl.toString(), 0);// Creates new client connection | ||
| Consumer<byte[]> c5 = newPulsarClient4.newConsumer() | ||
| .topic("persistent://my-property/my-ns/my-topic2").subscriptionName("my-subscriber-name") | ||
| .consumerName("c5") |
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.
Why we need to remove the consumer name here?
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.
Already fixed
293af82 to
11f101a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18289 +/- ##
============================================
+ Coverage 38.97% 41.47% +2.50%
- Complexity 8311 8864 +553
============================================
Files 683 687 +4
Lines 67325 67384 +59
Branches 7217 7218 +1
============================================
+ Hits 26239 27949 +1710
+ Misses 38079 36344 -1735
- Partials 3007 3091 +84
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Fixes #16795
Motivation
In class
PersistentDispatcherMultipleConsumers, there is a variablesendInProgressthat is set totruebefore thesendMessagesToConsumersmethod is executed and tofalseafter thesendMessagesToConsumersmethod is executed, thus making thereadMoreEntiesinaccessible during thesendMessagesToConsumersmethod's execution. see: #16812In subclass
PersistentStreamingDispatcherMultipleConsumers, when reading batch entries,sendMessagesToConsumeris called each entry is read, which causes the variablesendInProgressto be set totrueandfalsemultiple times. This results in the methodreadMoreEntiescan be accessed when the variablesendInProgressis set to false when a batch of entries is reading. This makes repeat delivery of the message, the error process is as follows:consumer-1consumer-2messagesToRedelivermessagesToRedeliverconsumer-1consumer-2Modifications
Set
sendInProgresstofalseonly after the last entry in a batch of messages has been delivered.Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: