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/09/05 08:48:19 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #11925: Use ZK "container" types for intermediate z-nodes

eolivelli commented on a change in pull request #11925:
URL: https://github.com/apache/pulsar/pull/11925#discussion_r702390310



##########
File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java
##########
@@ -441,4 +439,41 @@ public long getZkSessionId() {
         }
         return CompletableFuture.completedFuture(null);
     }
+
+    private static void asyncCreateFullPathOptimistic(final ZooKeeper zk, final String originalPath, final byte[] data,
+                                                      final CreateMode createMode,
+                                                      final AsyncCallback.StringCallback callback) {
+        zk.create(originalPath, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, createMode, (rc, path, ctx, name) -> {
+            if (rc != Code.NONODE.intValue()) {
+                callback.processResult(rc, path, ctx, name);
+            } else {
+                String parent = (new File(originalPath)).getParent().replace("\\", "/");
+
+                // Create parent nodes as "CONTAINER" so that ZK will automatically delete them when they're empty

Review comment:
       Can we add here a nite that old clusters may still have the old type?




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