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/05/11 21:53:25 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #10532: PIP-45: Migrate NamespaceService to use MetadataStore

merlimat commented on a change in pull request #10532:
URL: https://github.com/apache/pulsar/pull/10532#discussion_r630565187



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java
##########
@@ -916,44 +885,23 @@ void splitAndOwnBundleOnceAndRetry(NamespaceBundle bundle,
      *
      * @param nsname
      * @param nsBundles
-     * @param callback
      * @throws Exception
      */
-    private void updateNamespaceBundles(NamespaceName nsname, NamespaceBundles nsBundles, StatCallback callback)
-            throws Exception {
+    private CompletableFuture<Void> updateNamespaceBundles(NamespaceName nsname, NamespaceBundles nsBundles) {
         checkNotNull(nsname);
         checkNotNull(nsBundles);
         String path = joinPath(LOCAL_POLICIES_ROOT, nsname.toString());
-        Optional<LocalPolicies> policies = pulsar.getLocalZkCacheService().policiesCache().get(path);
 
-        if (!policies.isPresent()) {
-            // if policies is not present into localZk then create new policies
-            policies = this.pulsar.getLocalZkCacheService().createPolicies(path, false)
-                    .get(pulsar.getConfiguration().getZooKeeperOperationTimeoutSeconds(), SECONDS);
+        LocalPolicies localPolicies = nsBundles.toLocalPolicies();
+        byte[] data;
+        try {
+            data = ObjectMapperFactory.getThreadLocal().writeValueAsBytes(localPolicies);
+        } catch (Exception e) {

Review comment:
       Yes, fixed




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

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