aloyszhang commented on a change in pull request #8818:
URL: https://github.com/apache/pulsar/pull/8818#discussion_r551081111



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
##########
@@ -376,6 +377,25 @@ protected void validatePartitionedTopicMetadata(String 
tenant, String namespace,
         }
     }
 
+    protected void validateTopicExistedAndCheckAllowAutoCreation(String 
tenant, String namespace,
+                                                                 String 
encodedTopic, boolean checkAllowAutoCreation) {
+        try {
+            PartitionedTopicMetadata partitionedTopicMetadata =
+                    
pulsar().getBrokerService().fetchPartitionedTopicMetadataAsync(topicName).get();
+            if (partitionedTopicMetadata.partitions < 1) {
+                if 
(!pulsar().getNamespaceService().checkTopicExists(topicName).get()
+                        && checkAllowAutoCreation

Review comment:
       I'll add test case to protect this part of code.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to