mattisonchao commented on code in PR #17562:
URL: https://github.com/apache/pulsar/pull/17562#discussion_r966658816


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -252,20 +253,19 @@ public CompletableFuture<Void> 
addOwnedNamespaceBundleAsync(NamespaceBundle name
         return result;
     }
 
-    private void prepareInitPoliciesCache(NamespaceName namespace, 
CompletableFuture<Void> result) {
+    private void prepareInitPoliciesCache(@Nonnull NamespaceName namespace, 
CompletableFuture<Void> result) {
         if (policyCacheInitMap.putIfAbsent(namespace, false) == null) {
             CompletableFuture<SystemTopicClient.Reader<PulsarEvent>> 
readerCompletableFuture =
                     createSystemTopicClientWithRetry(namespace);
             readerCaches.put(namespace, readerCompletableFuture);
-            readerCompletableFuture.whenComplete((reader, ex) -> {
-                if (ex != null) {
-                    log.error("[{}] Failed to create reader on __change_events 
topic", namespace, ex);
-                    result.completeExceptionally(ex);
-                    
cleanCacheAndCloseReader(reader.getSystemTopic().getTopicName().getNamespaceObject(),
 false);

Review Comment:
   **In the current time, the reader is null, because we got an exception. So, 
we can't clean the cache and close the reader.**



-- 
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