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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1068,23 +1061,32 @@ public CompletableFuture<Optional<Topic>> 
getTopic(final TopicName topicName, bo
                                         });
                             }
                             return loadOrCreatePersistentTopic(tpName, 
createIfMissing, properties, topicPolicies);
-                        }).thenCompose(optionalTopic -> {
-                            if (!optionalTopic.isPresent() && createIfMissing) 
{
-                                log.warn("[{}] Try to recreate the topic with 
createIfMissing=true "
-                                        + "but the returned topic is empty", 
topicName);
-                                return getTopic(topicName, createIfMissing, 
properties);
+                        });
+                        topicFuture.whenComplete((__, ex) -> {

Review Comment:
   If the topic's loading is slow enough, this line may cause an OOM error 
because too many `when complete` were appended.



-- 
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-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to