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 2019/12/18 02:12:26 UTC

[GitHub] [pulsar] jiazhai commented on a change in pull request #5879: Fix #5825: make PulsarClusterMetadataSetup idempotent

jiazhai commented on a change in pull request #5879: Fix #5825: make PulsarClusterMetadataSetup idempotent
URL: https://github.com/apache/pulsar/pull/5879#discussion_r359122401
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
 ##########
 @@ -113,6 +114,20 @@
         private boolean help = false;
     }
 
+    /**
+     * a wrapper for ZkUtils.createFullPathOptimistic but ignore exception of node exists
+     */
+    private static void createZkNode(ZooKeeper zkc, String path,
+                                     byte[] data, final List<ACL> acl, final CreateMode createMode)
+        throws KeeperException, InterruptedException {
+
+        try {
+            ZkUtils.createFullPathOptimistic(zkc, path, data, acl, createMode);
+        } catch (NodeExistsException e) {
+            // Ignore
+        }
+    }
+
 
 Review comment:
   > For example the znode /namespace with old data may not be not consistent with the other new created znodes
   
   @murong00 In this handling all the zk path is hard coded. and in this setup process, we only check if the path exists or not. if old data exists, this will trigger the node exists exception, and will not touch old data.

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


With regards,
Apache Git Services