poorbarcode commented on code in PR #18283:
URL: https://github.com/apache/pulsar/pull/18283#discussion_r1011236672


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1170,6 +1179,9 @@ private CompletableFuture<Void> delete(boolean 
failIfHasSubscriptions,
                                 .map(PersistentSubscription::getName).toList();
                 return FutureUtil.failedFuture(
                         new TopicBusyException("Topic has subscriptions did 
not catch up: " + backlogSubs));
+            } else if (!closeIfClientsConnected && currentUsageCount() != 0 && 
!failIfHasBacklogs) {
+                return FutureUtil.failedFuture(new TopicBusyException(
+                        "Topic has " + currentUsageCount() + " connected 
producers/consumers"));

Review Comment:
   Hi @codelipenghui 
   
   When failIfHasBacklogs is true, the expected behavior is that: 
   
   - failure of any producer exists 
   - if any consumer exists, close connections
   
   Actually, the code should be like this:
   
   ```java
   if ( !closeIfClientsConnected && currentUsageCount() ){
      fail...
   } else if ( !closeIfClientsConnected !failIfHasBacklogs && 
anyProducerExists() ){
      fail...
   }
   ```
   
   This code may not be easy to understand from the context, but the logic is 
correct



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