Nicklee007 commented on a change in pull request #11686: URL: https://github.com/apache/pulsar/pull/11686#discussion_r690830592
########## File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java ########## @@ -3773,9 +3773,9 @@ private void validatePartitionTopicUpdate(String topicName, int numberOfPartitio TopicName partitionTopicName = TopicName.get(domain(), namespaceName, topicName); PartitionedTopicMetadata metadata = getPartitionedTopicMetadata(partitionTopicName, false, false); int oldPartition = metadata.partitions; - String prefix = topicName + TopicName.PARTITIONED_TOPIC_SUFFIX; + String prefix = partitionTopicName.getPartitionedTopicName() + TopicName.PARTITIONED_TOPIC_SUFFIX; for (String exsitingTopicName : existingTopicList) { - if (exsitingTopicName.contains(prefix)) { + if (exsitingTopicName.startsWith(prefix)) { Review comment: > This change won't work properly. The topic name will be in format `persistent://tenant/cluster/namespace/topicName` . yes I have considered that. in this PR,I changed to the prefix = topicName + TopicName.PARTITIONED_TOPIC_SUFFIX, it's the full topicName contain 'persistent://tenant/cluster/namespace/topicName'; ########## File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java ########## @@ -3773,9 +3773,9 @@ private void validatePartitionTopicUpdate(String topicName, int numberOfPartitio TopicName partitionTopicName = TopicName.get(domain(), namespaceName, topicName); PartitionedTopicMetadata metadata = getPartitionedTopicMetadata(partitionTopicName, false, false); int oldPartition = metadata.partitions; - String prefix = topicName + TopicName.PARTITIONED_TOPIC_SUFFIX; + String prefix = partitionTopicName.getPartitionedTopicName() + TopicName.PARTITIONED_TOPIC_SUFFIX; for (String exsitingTopicName : existingTopicList) { - if (exsitingTopicName.contains(prefix)) { + if (exsitingTopicName.startsWith(prefix)) { Review comment: > This change won't work properly. The topic name will be in format `persistent://tenant/cluster/namespace/topicName` . changed to the prefix = partitionTopicName.getPartitionedTopicName() + TopicName.PARTITIONED_TOPIC_SUFFIX , it's the full topicName contain 'persistent://tenant/cluster/namespace/topicName'; -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org