poorbarcode commented on code in PR #24225:
URL: https://github.com/apache/pulsar/pull/24225#discussion_r2072252144


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java:
##########
@@ -596,12 +598,32 @@ protected void 
internalCreatePartitionedTopic(AsyncResponse asyncResponse, int n
                     }
                 })
                 .thenCompose(__ -> checkTopicExistsAsync(topicName))
-                .thenAccept(exists -> {
-                    if (exists) {
-                        log.warn("[{}] Failed to create already existing topic 
{}", clientAppId(), topicName);
-                        throw new RestException(Status.CONFLICT, "This topic 
already exists");
+                .thenAccept(topicExistsInfo -> {
+                    try {
+                        if (topicExistsInfo.isExists()) {
+                            if 
(topicExistsInfo.getTopicType().equals(TopicType.NON_PARTITIONED)
+                                    || 
(topicExistsInfo.getTopicType().equals(TopicType.PARTITIONED)
+                                    && !createLocalTopicOnly)) {

Review Comment:
   I think I did not explain my question clearly. What I want to ask is as 
follows
   
   > Could you explain what partitioned topic exists && !createLocalTopicOnly 
mean?
   
   The original behavior is that users will get a Conflict error if the topic 
already exists when calling a topic creation, see 
https://github.com/apache/pulsar/blob/v4.0.4/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java#L598-L604
   
   But you changed the behavior in the current PR, the check will pass when 
"partitioned topic exists && !createLocalTopicOnly", I want to know why



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