mattisonchao commented on code in PR #21545:
URL: https://github.com/apache/pulsar/pull/21545#discussion_r1386572351
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1075,10 +1075,23 @@ public CompletableFuture<Optional<Topic>>
getTopic(final TopicName topicName, bo
return
loadOrCreatePersistentTopic(tpName, createIfMissing,
properties, topicPolicies);
}
- return
CompletableFuture.completedFuture(Optional.empty());
+ final String info =
+ String.format("Creating a
topic encountered an illegal partition name."
+ + "
topic_name=%s metadata_partition_number=%s",
+ topicName,
metadata.partitions);
+ log.warn(info);
+ return CompletableFuture
+ .failedFuture(new
BrokerServiceException.NamingException(info));
});
}
return loadOrCreatePersistentTopic(tpName,
createIfMissing, properties, topicPolicies);
+ }).thenCompose(optionalTopic -> {
+ if (!optionalTopic.isPresent() && createIfMissing) {
+ log.warn("Different topic automatic creation
strategies lead to race conditions. "
+ + "Try again to try to recover.
topic_name={}", topicName);
+ return getTopic(topicName, true, properties);
Review Comment:
Because we judged the `createIfMissing` condition, therefore, the value
should always be `true`
--
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]