codelipenghui commented on code in PR #16622:
URL: https://github.com/apache/pulsar/pull/16622#discussion_r957930498


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -2195,6 +2195,15 @@ public void checkGC() {
             CompletableFuture<Void> replCloseFuture = new 
CompletableFuture<>();
 
             if (TopicName.get(topic).isGlobal()) {
+                // topics with remote (replication) producer should be skipped
+                if (hasRemoteProducers()) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("[{}] Global topic has connected remote 
producers. Not a candidate for GC",
+                                topic);
+                    }
+                    return;
+                }
+
                 // For global namespace, close repl producers first.
                 // Once all repl producers are closed, we can delete the topic,
                 // provided no remote producers connected to the broker.

Review Comment:
   > I can add the test to cover this behaviour If we need it.
   
   +1



-- 
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