-
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] Fix ProducerBusy issue due to incorrect userCreatedProducerCount on non-persistent topic #22685
Conversation
…ucerCount on non-persistent topic
/pulsarbot rerun-failure-checks |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #22685 +/- ##
============================================
- Coverage 73.57% 73.09% -0.48%
+ Complexity 32624 32465 -159
============================================
Files 1877 1888 +11
Lines 139502 141103 +1601
Branches 15299 15484 +185
============================================
+ Hits 102638 103145 +507
- Misses 28908 29971 +1063
- Partials 7956 7987 +31
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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
…ucerCount on non-persistent topic (apache#22685) Co-authored-by: ruihongzhou <ruihongzhou@tencent.com> (cherry picked from commit 253e650) (cherry picked from commit 89b545e)
…ucerCount on non-persistent topic (apache#22685) Co-authored-by: ruihongzhou <ruihongzhou@tencent.com> (cherry picked from commit 253e650) (cherry picked from commit 89b545e)
Motivation
#20607 introduced the variable
userCreatedProducerCount
to track the number of producers created by users. Concurrently, theremoveProducer
method inAbstractTopic
decreases the count ofuserCreatedProducerCount
usingUSER_CREATED_PRODUCER_COUNTER_UPDATER.decrementAndGet(this)
when a producer is removed. However,NonPersistentTopic
overrides theremoveProducer
method ofAbstractTopic
, and the overriddenremoveProducer
method inNonPersistentTopic
does not decrease the count ofuserCreatedProducerCount
. As a result, whenmaxProducersPerTopic
is set, this incorrect value ofuserCreatedProducerCount
can lead to aProducerBusy
error when creating a producer.Modifications
Since the
NonPersistentTopic
class extends theAbstractTopic
class and the implementation of theremoveProducer
method inNonPersistentTopic
is identical to that inAbstractTopic
, theremoveProducer
method inNonPersistentTopic
can be safely removed.Verifying this change
Added test in
org.apache.pulsar.broker.service.nonpersistent.NonPersistentTopicTest#testRemoveProducerOnNonPersistentTopic
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: hrzzzz#5