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


##########
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:
   ```suggestion
                           subscriptions.forEach((s, sub) -> 
futures.add(sub.disconnect(lookupData)));
                       } else {
                           subscriptions.forEach((s, sub) -> 
futures.add(sub.close(true, lookupData)));
   ```
   nit: This indentation is wrong, I wonder why the check style did not find 
this issue.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1842,6 +1843,15 @@ protected void handleAck(CommandAck ack) {
 
         if (consumerFuture != null && consumerFuture.isDone() && 
!consumerFuture.isCompletedExceptionally()) {
             Consumer consumer = consumerFuture.getNow(null);
+            Subscription subscription = consumer.getSubscription();
+            if (subscription.getTopic().isTransferring()) {

Review Comment:
   Do we have a test to cover in transferring acks?



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