nodece commented on code in PR #21679: URL: https://github.com/apache/pulsar/pull/21679#discussion_r1429437210
########## pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java: ########## @@ -1419,4 +1424,40 @@ public static Optional<ClusterUrl> getMigratedClusterUrl(PulsarService pulsar, S } return Optional.empty(); } + + private CompletableFuture<Void> catchCreateTopicForRemoteCluster(CompletableFuture<Void> createTopicFuture) { + return createTopicFuture.exceptionally(ex -> { + Throwable throwable = FutureUtil.unwrapCompletionException(ex); + if (throwable instanceof ConflictException) { + int code = ((ConflictException) throwable).getStatusCode(); + if (code == Status.CONFLICT.getStatusCode()) { Review Comment: > Since load topic could try to create the topic in the remote cluster, the `create` operation and the error log may confuse the user. So it's better to `query` before `create`. The current implementation prints many logs if the topic has existed in the remote cluster. If we use the `query` before `create`, there are twice HTTP requests. > Another case is: if the user updates the partition in the local cluster(like updating partition from 3~5), the remote can't update. If the user enables the geo-replication, we also need to update this topic for the remote cluster when updating the partition in the local 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