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 2022/12/08 09:10:03 UTC
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18804: [fix][broker] Fix namespace deletion if __change_events topic has not been created yet
Technoboy- commented on code in PR #18804:
URL: https://github.com/apache/pulsar/pull/18804#discussion_r1043097511
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -106,6 +109,19 @@ private CompletableFuture<Void> sendTopicPolicyEvent(TopicName topicName, Action
new BrokerServiceException.NotAllowedException("Not allowed to send event to health check topic"));
}
CompletableFuture<Void> result = new CompletableFuture<>();
+ try {
+ final Optional<Policies> namespacePolicies = pulsarService.getPulsarResources().getNamespaceResources()
+ .getPolicies(topicName.getNamespaceObject());
+ if (namespacePolicies.isPresent() && namespacePolicies.get().deleted) {
+ log.debug("[{}] skip sending topic policy event since the namespace is deleted", topicName);
+ result.complete(null);
+ return result;
+ }
+ } catch (MetadataStoreException e) {
+ result.completeExceptionally(e);
+ return result;
+ }
+
Review Comment:
It's better to call the async method `getPoliciesAsync`
--
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