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


##########
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:
   @nodece 
   
   > When a partitioned topic will be synchronized to the remote cluster, we 
allow the remote cluster includes this metadata. The local and remote clusters 
may be shared a global zk.
   > createLocalTopicOnly=true means this creation request comes from a 
cluster, not user client, we can continue to create the partitioned topic if 
the metadata is existing on the remote cluster.
   > The pulsar has been covered this changed by existing test.
   
   Could you explain the flow of the issue that you solved? Just like follows
   - There are two clusters `[c1, c2]` enabled Geo-Replication `c1 -> c2`.
   - `c2` has partitioned metadata, `c1` has not
   - I failed to take the next step.....
   
   > The previous code only checked whether the topic was a partition, without 
verifying its partitioned metadata. The updated logic now checks the partition 
status and its associated metadata, which is why you are seeing this additional 
check.
   
   The original code was based on such an assumption: if a partition exists, 
the partitioned metadata should exist. I really do not know what issue you want 
to solve 😂 
   



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