mattisonchao commented on code in PR #19086:
URL: https://github.com/apache/pulsar/pull/19086#discussion_r1059214185


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1016,27 +1016,27 @@ public CompletableFuture<Optional<Topic>> 
getTopic(final TopicName topicName, bo
                 }
             }
             final boolean isPersistentTopic = 
topicName.getDomain().equals(TopicDomain.persistent);
-            if (isPersistentTopic) {
-                return topics.computeIfAbsent(topicName.toString(), (k) -> {
-                    return this.loadOrCreatePersistentTopic(k, 
createIfMissing, properties);
-                });
-            } else {
-                return topics.computeIfAbsent(topicName.toString(), (name) -> {
+            return topics.computeIfAbsent(topicName.toString(), (name) -> {
+                    // partitioned topic
                     if (topicName.isPartitioned()) {
                         final TopicName partitionedTopicName = 
TopicName.get(topicName.getPartitionedTopicName());
-                        return 
this.fetchPartitionedTopicMetadataAsync(partitionedTopicName).thenCompose((metadata)
 -> {
+                        return 
fetchPartitionedTopicMetadataAsync(partitionedTopicName).thenCompose((metadata) 
-> {
                             if (topicName.getPartitionIndex() < 
metadata.partitions) {
-                                return createNonPersistentTopic(name);
+                                return isPersistentTopic ?
+                                        loadOrCreatePersistentTopic(name, 
createIfMissing, properties) :

Review Comment:
   @liangyepianzhou  
   
   Currently, pulsar already supports create non-partitioned persistent topic 
that name with `-partition-`, So, I will keep the logic in this PR, and start 
discussion in the future.



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