BewareMyPower commented on a change in pull request #9342:
URL: https://github.com/apache/pulsar/pull/9342#discussion_r565275162



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -460,6 +460,16 @@ protected void internalCreateNonPartitionedTopic(boolean 
authoritative) {
         if (partitionMetadata.partitions > 0) {
             log.warn("[{}] Partitioned topic with the same name already exists 
{}", clientAppId(), topicName);
             throw new RestException(Status.CONFLICT, "This topic already 
exists");
+        } else {
+            if (topicName.isPartitioned()) {
+                final TopicName partitionedTopicName = 
TopicName.get(topicName.getPartitionedTopicName());
+                partitionMetadata = fetchPartitionedTopicMetadata(pulsar(), 
partitionedTopicName);

Review comment:
       After rethinking for a while, I think a better way is to check if 
`/managed-ledgers/<tenant>/<namespace>/<topic>` exists.
   
   No matter if disallow creating `xxx-partition-i` or the way I adopted, the 
compatibility will be broken. Because if users upgrade their pulsar from a low 
version, they may rely on creating a `xxx-partition-0` to create missing 
partitions instead of the REST API, as well as some old code of other clients.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to