zymap commented on a change in pull request #9342:
URL: https://github.com/apache/pulsar/pull/9342#discussion_r565256339
##########
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:
I think we shouldn't allow creating a topic with the partitioned topic
name style even if the partition is not existing. That would be weird there has
a non-partitioned topic with a partitioned topic name when you listing topics.
We can improve this check in the `validateNonPartitionTopicName`. What do you
think?
----------------------------------------------------------------
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]