This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new 85bd12a  Fix SystemTopicBasedTopicPoliciesService NPE issue. (#13840)
85bd12a is described below

commit 85bd12acbf740db62aad078ec3ccf5f9f803b2ea
Author: Jiwei Guo <techno...@apache.org>
AuthorDate: Thu Jan 20 15:34:56 2022 +0800

    Fix SystemTopicBasedTopicPoliciesService NPE issue. (#13840)
---
 .../pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
index a6c786b..44b866f 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
@@ -222,7 +222,6 @@ public class SystemTopicBasedTopicPoliciesService 
implements TopicPoliciesServic
                 ownedBundlesCountPerNamespace.get(namespace).incrementAndGet();
                 result.complete(null);
             } else {
-                ownedBundlesCountPerNamespace.putIfAbsent(namespace, new 
AtomicInteger(1));
                 prepareInitPoliciesCache(namespace, result);
             }
         }
@@ -234,6 +233,7 @@ public class SystemTopicBasedTopicPoliciesService 
implements TopicPoliciesServic
             CompletableFuture<SystemTopicClient.Reader<PulsarEvent>> 
readerCompletableFuture =
                     creatSystemTopicClientWithRetry(namespace);
             readerCaches.put(namespace, readerCompletableFuture);
+            ownedBundlesCountPerNamespace.putIfAbsent(namespace, new 
AtomicInteger(1));
             readerCompletableFuture.whenComplete((reader, ex) -> {
                 if (ex != null) {
                     log.error("[{}] Failed to create reader on __change_events 
topic", namespace, ex);

Reply via email to