gaozhangmin commented on a change in pull request #11686:
URL: https://github.com/apache/pulsar/pull/11686#discussion_r690845106



##########
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:
       > There is a PR #11148 in progress in this same area. I'd suggest 
contributing to #11148 to fix this issue #11685. One form of contributing is 
making sure that this problem gets fixed with the refactored implementation for 
checking topic existence.
   
   it's full name `String prefix = partitionTopicName.getPartitionedTopicName() 
+ TopicName.PARTITIONED_TOPIC_SUFFIX`

##########
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:
       > There is a PR #11148 in progress in this same area. I'd suggest 
contributing to #11148 to fix this issue #11685. One form of contributing is 
making sure that this problem gets fixed with the refactored implementation for 
checking topic existence.
   
   it's full name `String prefix = partitionTopicName.getPartitionedTopicName() 
+ TopicName.PARTITIONED_TOPIC_SUFFIX`

##########
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:
       > same are
   
   I don't think it's the same area, `validatePartitionTopicUpdate` only used 
when updating partition of topic. it's not the same logic.




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


Reply via email to