poorbarcode opened a new pull request, #20567:
URL: https://github.com/apache/pulsar/pull/20567

   ### 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. You can reproduce by the test 
`testRetryStartProducerStoppedByTopicRemove `
   
   | time | `restart producer of a replicator` | `topic.close` |
   | --- | --- | --- |
   | 1 | Compare and set state: `Starting -> Stopped` | 
   | 2 | Add a delay task to try to start the producer again |
   | 3 | | Close topic |
   | 4 | The delayed task executed |
   | 5 | If fail, retry again and loop |
   
   **[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
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: x
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to