You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "dragosvictor (via GitHub)" <gi...@apache.org> on 2023/12/13 05:05:45 UTC
Re: [PR] [improve][broker] PIP-307: Implement broker and client consumer changes when topic is unloading [pulsar]
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org