[fix][broker]Fix repeated messages of shared streaming dispatcher - #18289
Merged
nodece merged 2 commits intoNov 2, 2022
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") |
Contributor
There was a problem hiding this comment.
Why we need to remove the consumer name here?
poorbarcode
force-pushed
the
flaky/testSharedSamePriorityConsumer
branch
from
November 2, 2022 03:23
293af82 to
11f101a
Compare
codelipenghui
approved these changes
Nov 2, 2022
coderzc
approved these changes
Nov 2, 2022
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.
|
4 tasks
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 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: