codelipenghui commented on code in PR #23169:
URL: https://github.com/apache/pulsar/pull/23169#discussion_r1722698834


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/OneWayReplicatorTest.java:
##########
@@ -1160,4 +1160,77 @@ public void 
testDifferentTopicCreationRule(ReplicationMode replicationMode) thro
         admin1.namespaces().deleteNamespace(ns);
         admin2.namespaces().deleteNamespace(ns);
     }
+
+    @Test(dataProvider = "replicationModes")
+    public void 
testDisabledCreateTopicToRemoteClusterForReplication(ReplicationMode 
replicationMode) throws Exception {

Review Comment:
   Could you point out where disabled 
`createTopicToRemoteClusterForReplication` ?



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java:
##########
@@ -609,11 +609,15 @@ protected void 
internalCreatePartitionedTopic(AsyncResponse asyncResponse, int n
                 .thenCompose(__ -> 
provisionPartitionedTopicPath(numPartitions, createLocalTopicOnly, properties))
                 .thenCompose(__ -> tryCreatePartitionsAsync(numPartitions))
                 .thenRun(() -> {
-                    if (!createLocalTopicOnly && topicName.isGlobal()) {
+                    if (!createLocalTopicOnly && topicName.isGlobal()
+                            && 
pulsar().getConfig().isCreateTopicToRemoteClusterForReplication()) {
                         
internalCreatePartitionedTopicToReplicatedClustersInBackground(numPartitions);
+                        log.info("[{}] Successfully created partitions for 
topic {} for the remote clusters {}",

Review Comment:
   ```suggestion
                           log.info("[{}] Successfully created partitioned 
topic {} to remote clusters {}",
   ```
   
   Can we list the remote clusters in the log? It will be better than log the 
current cluster.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -3332,6 +3332,11 @@ protected CompletableFuture<Void> 
internalSetReplicationClusters(List<String> cl
                     }
                     return FutureUtil.waitForAll(futures);
                 }).thenCompose(__ -> {
+                    if 
(!pulsar().getConfig().isCreateTopicToRemoteClusterForReplication()) {
+                        log.info("[{}] Skip creating partitions for topic {} 
for the remote clusters {}",
+                                clientAppId(), topicName, 
pulsar().getConfiguration().getClusterName());

Review Comment:
   Same as the above comment.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java:
##########
@@ -609,11 +609,15 @@ protected void 
internalCreatePartitionedTopic(AsyncResponse asyncResponse, int n
                 .thenCompose(__ -> 
provisionPartitionedTopicPath(numPartitions, createLocalTopicOnly, properties))
                 .thenCompose(__ -> tryCreatePartitionsAsync(numPartitions))
                 .thenRun(() -> {
-                    if (!createLocalTopicOnly && topicName.isGlobal()) {
+                    if (!createLocalTopicOnly && topicName.isGlobal()
+                            && 
pulsar().getConfig().isCreateTopicToRemoteClusterForReplication()) {
                         
internalCreatePartitionedTopicToReplicatedClustersInBackground(numPartitions);
+                        log.info("[{}] Successfully created partitions for 
topic {} for the remote clusters {}",
+                                clientAppId(), topicName, 
pulsar().getConfiguration().getClusterName());
+                    } else {
+                        log.info("[{}] Skip creating partitions for topic {} 
for the remote clusters {}",

Review Comment:
   ```suggestion
                           log.info("[{}] Skip creating partitioned topic {} to 
remote clusters {}",
   ```
   
   Can we list the remote clusters in the log? It will be better than log the 
current 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to