You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/23 12:07:26 UTC

[GitHub] [pulsar] hangc0276 commented on a change in pull request #12136: Support for setting geo-replication clusters on topic level

hangc0276 commented on a change in pull request #12136:
URL: https://github.com/apache/pulsar/pull/12136#discussion_r714724548



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -1334,33 +1335,36 @@ public void closeFailed(ManagedLedgerException exception, Object ctx) {
             log.debug("[{}] Checking replication status", name);
         }
 
-        CompletableFuture<Policies> policiesFuture = brokerService.pulsar().getPulsarResources()
-                .getNamespaceResources()
-                .getPoliciesAsync(TopicName.get(topic).getNamespaceObject())
-                .thenCompose(optPolicies -> {
-                            if (!optPolicies.isPresent()) {
-                                return FutureUtil.failedFuture(
-                                        new ServerMetadataException(
-                                                new MetadataStoreException.NotFoundException()));
-                            }
+        CompletableFuture<Set<String>> replicationClustersFuture = brokerService.pulsar()

Review comment:
       The checkReplication is call by `onPoliciesUpdate`, which is listen namespace level policy update. For topic level policy update listener, we should deal with the topic policy in `onUpdate()` method.

##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
##########
@@ -2641,4 +2642,23 @@ public void testDoNotCreateSystemTopicForHeartbeatNamespace() {
         });
     }
 
+    @Test(timeOut = 30000)

Review comment:
       We'd better setup multi individual pulsar clusters, and turn on topic level replication policy for specific topic to test topic replicate policy. 
   For example, we setup cluster-A and cluster-B, and configure `persistent://public/default/topic-test` to replicate from cluster-A to cluster-B,  and then write message-1 to topic `persistent://public/default/topic-test` in cluster-A, we can check whether message-1 can be read from topic `persistent://public/default/topic-test` in cluster-B. Furthermore, we and update, remove topic replication policy, check the messages in two clusters.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
##########
@@ -495,23 +495,28 @@ public void removeProducer(Producer producer) {
             log.debug("[{}] Checking replication status", name);
         }
 
-        return brokerService.pulsar().getPulsarResources().getNamespaceResources()
-                .getPoliciesAsync(TopicName.get(topic).getNamespaceObject())
-                .thenCompose(optPolicies -> {
-                    if (!optPolicies.isPresent()) {
-                        return FutureUtil.failedFuture(
-                                new ServerMetadataException(
-                                        new MetadataStoreException.NotFoundException()));
-                    }
+        return brokerService.pulsar()

Review comment:
       In current implementation, non-persistent topic doesn't configure topic policy, so it doesn't need to check replication policy in `checkReplication`




-- 
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-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org