-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] Key_Shared subscription doesn't always deliver messages from the replay queue after a consumer disconnects and leaves a backlog #24736
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
…deliver messages from the replay queue after a consumer disconnects and leaves a backlog unless new messages are produced
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.
LGTM 🎯 perfect job, @nborisov
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #24736 +/- ##
============================================
- Coverage 74.25% 74.14% -0.11%
- Complexity 33174 33595 +421
============================================
Files 1884 1900 +16
Lines 146943 148396 +1453
Branches 16882 17208 +326
============================================
+ Hits 109110 110029 +919
- Misses 29163 29574 +411
- Partials 8670 8793 +123
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@lhotari Could you please clarify if I need to add more coverage for changed files? Not sure how to deal with the report: it shows lines from |
The coverage report isn't very accurate. Coverage reports get merged from a large amount of build jobs and there seems to be gaps. We currently use it as a tool to get some level of visibility in code coverage. |
… from the replay queue after a consumer disconnects and leaves a backlog (apache#24736) Co-authored-by: Nikolai Borisov <nikolai.borisov@onde.app> (cherry picked from commit 80beab6) (cherry picked from commit 63c25e6)
… from the replay queue after a consumer disconnects and leaves a backlog (apache#24736) Co-authored-by: Nikolai Borisov <nikolai.borisov@onde.app> (cherry picked from commit 80beab6) (cherry picked from commit 63c25e6)
… from the replay queue after a consumer disconnects and leaves a backlog (apache#24736) Co-authored-by: Nikolai Borisov <nikolai.borisov@onde.app>
… from the replay queue after a consumer disconnects and leaves a backlog (apache#24736) Co-authored-by: Nikolai Borisov <nikolai.borisov@onde.app>
Fixes #23845
Motivation
There is a not covered scenario for draining hashes and key shared subscriptions at
PersistentStickyKeyDispatcherMultipleConsumers. The detailed scenario described at #23845 (comment)As a result draining hashes could contain entries with consumer which was stopped. This leads consuming to get stuck.
Modifications
Decrease draining hash entry
refCountin case its hash range returned to the initial owner which holds the entry in pending acks.Verifying this change
This change added tests and can be verified as follows:
org.apache.pulsar.client.api.KeySharedSubscriptionTest#testMessageDeliveredFromDrainingHashesto verify the scenarioorg.apache.pulsar.broker.service.ConsistentHashingStickyKeyConsumerSelectorTest#testShouldNotSwapExistingConsumers,org.apache.pulsar.broker.service.ConsumerHashAssignmentsSnapshotTest#testResolveConsumerRemovedHashRanges_NoChanges,org.apache.pulsar.broker.service.ConsumerHashAssignmentsSnapshotTest#testResolveConsumerUpdatedHashRanges_RangeAdded,org.apache.pulsar.broker.service.ConsumerHashAssignmentsSnapshotTest#testResolveConsumerRemovedHashRanges_RangeUpdated,org.apache.pulsar.broker.service.ConsumerHashAssignmentsSnapshotTest#testResolveConsumerUpdatedHashRanges_OverlappingRangesDoes this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: nborisov#6