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


##########
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:
   @poorbarcode 
   
   > The motivation of this PR is to create missed partitioned metadata if only 
partitions exist.
   
   This is correct.
   
   > but the purpose of the current modification is that it continuously 
creates the topic even though the partitioned metadata exists, right?
   
   - When `createLocalTopicOnly = false` (the default), and the partitioned 
metadata already exists, the broker rejects the creation request — this is 
expected and correct behavior.
   - When `createLocalTopicOnly = true`, the creation logic runs on the remote 
cluster as part of GEO replication. In this case, if the metadata already 
exists, we continue to create the partition on the remote cluster.



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