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


##########
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()) {
+                          subscriptions.forEach((s, sub) -> 
futures.add(sub.disconnect(lookupData)));
+                    } else {
+                          subscriptions.forEach((s, sub) -> 
futures.add(sub.close(true, lookupData)));

Review Comment:
   Good catch, fixed!



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