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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]