-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] Key_Shared subscription: Reject consumers with incompatible policy #23449
[fix][broker] Key_Shared subscription: Reject consumers with incompatible policy #23449
Conversation
@pdolif Please add the following content to your PR description and select a checkbox:
|
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. Great work, @pdolif!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #23449 +/- ##
============================================
+ Coverage 73.57% 74.29% +0.71%
- Complexity 32624 34904 +2280
============================================
Files 1877 1943 +66
Lines 139502 146995 +7493
Branches 15299 16195 +896
============================================
+ Hits 102638 109206 +6568
- Misses 28908 29345 +437
- Partials 7956 8444 +488
Flags with carried forward coverage won't be shown. Click here to find out more.
|
...broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
Outdated
Show resolved
Hide resolved
Dismissing review since improving the error messages could be useful.
…patible subscription type or key_shared policy
.../src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentSubscription.java
Outdated
Show resolved
Hide resolved
...broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java
Outdated
Show resolved
Hide resolved
…rror check to AbstractSubscription
…tion-reject-incompatible-consumer
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, Good work!
there's some unrelated test flakiness such as #23486 which caused the first attempt to fail. |
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/SubscriptionTestBase.java
Outdated
Show resolved
Hide resolved
.../test/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentSubscriptionTest.java
Outdated
Show resolved
Hide resolved
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.
Great work @pdolif, thanks for contributing!
…tion-reject-incompatible-consumer
Fixes #23272
Motivation
When a consumer with a different Key_Shared policy connects, the current behavior is that the existing consumer will be closed and replaced with the consumer with the different policy. Since the replaced consumer gets disconnected, it will connect again and swap with the other consumer, and this replacement loop keeps going on.
Taken from #23272 by @lhotari:
When multiple consumers are using different policies, this should be properly handled.
One possibility is to keep the policy of the connected consumers and reject any other consumers and return a proper error message.
Modifications
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: pdolif#4