-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] release orphan replicator after topic closed #20567
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
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractReplicator.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractReplicator.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractReplicator.java
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20567 +/- ##
=============================================
+ Coverage 33.50% 72.96% +39.46%
- Complexity 12053 31956 +19903
=============================================
Files 1613 1867 +254
Lines 126120 138653 +12533
Branches 13749 15233 +1484
=============================================
+ Hits 42254 101172 +58918
+ Misses 78332 29444 -48888
- Partials 5534 8037 +2503
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Motivation: When the `replicator.producer` retries to start<sup>[1]</sup> the topic close<sup>[2]</sup> executed concurrently, there is an orphan replicator after this topic is closed. Modifications: If the topic was already closed, stop to retry.
Motivation: When the `replicator.producer` retries to start<sup>[1]</sup> the topic close<sup>[2]</sup> executed concurrently, there is an orphan replicator after this topic is closed. Modifications: If the topic was already closed, stop to retry. (cherry picked from commit d85736c)
| if (optional.isEmpty()) { | ||
| return false; | ||
| } | ||
| return optional.get() == localTopic; |
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.
I am not sure that we want to use reference equality here. I would think we always want to shut down the AbastractReplicator class and let it get recreated when a topic is closed.
@poorbarcode - if the topic is closed, I think we should close the replicator to prevent any kind of race conditions in the event the topic is re-loaded to the same broker. |
) Motivation: When the `replicator.producer` retries to start<sup>[1]</sup> the topic close<sup>[2]</sup> executed concurrently, there is an orphan replicator after this topic is closed. Modifications: If the topic was already closed, stop to retry. (cherry picked from commit d85736c) (cherry picked from commit db7832b)
…ethod for fixing the race condition. (apache#20567)
Motivation
When the
replicator.producerretries to start[1] the topic close[2] executed concurrently, there is an orphan replicator after this topic is closed. You can reproduce by the testtestRetryStartProducerStoppedByTopicRemoverestart producer of a replicatortopic.closeStarting -> Stopped[1]: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractReplicator.java#L151
[2]: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractReplicator.java#L163
Modifications
If the topic was already closed, stop to retry.
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x