dragosvictor commented on code in PR #21682:
URL: https://github.com/apache/pulsar/pull/21682#discussion_r1424384856


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1509,14 +1508,25 @@ public CompletableFuture<Void> close(
         shadowReplicators.forEach((__, replicator) -> 
futures.add(replicator.disconnect()));
         if (disconnectClients) {
             futures.add(ExtensibleLoadManagerImpl.getAssignedBrokerLookupData(
-                    brokerService.getPulsar(), topic).thenAccept(lookupData ->
-                    producers.values().forEach(producer -> 
futures.add(producer.disconnect(lookupData)))
+                brokerService.getPulsar(), topic).thenAccept(lookupData -> {
+                    producers.values().forEach(producer -> 
futures.add(producer.disconnect(lookupData)));
+                    // Topics unloaded due to the ExtensibleLoadManager 
undergo closing twice: first with
+                    // disconnectClients = false, second with 
disconnectClients = true. The check below identifies the
+                    // cases when Topic.close is called outside the scope of 
the ExtensibleLoadManager. In these
+                    // situations, we must pursue the regular 
Subscription.close, as Topic.close is invoked just once.
+                    if (isTransferring()) {

Review Comment:
   Good observation. Unfortunately, I cannot use `disconnectClients`, since it 
changes values between invocations. This code is specifically called when 
`disconnectClients == true`, but I need to know if the method was previously 
invoked with `disconnectClients == false`. Using the transferring flag helps 
maintain that state.



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