Skip to content

Commit

Permalink
[improve][meta] Simplify getting parent path in ZKMetadataStore witho…
Browse files Browse the repository at this point in the history
…ut using java.io.File (#23996)

(cherry picked from commit 4bfdcd8)
  • Loading branch information
lhotari committed Feb 19, 2025
1 parent 9ca1158 commit bcbbbd3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.pulsar.metadata.impl;

import com.google.common.annotations.VisibleForTesting;
import java.io.File;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
Expand Down Expand Up @@ -604,8 +603,10 @@ private static void asyncCreateFullPathOptimistic(final ZooKeeper zk, final Stri
if (rc != Code.NONODE.intValue()) {
callback.processResult(rc, path, ctx, name);
} else {
String parent = (new File(originalPath)).getParent().replace("\\", "/");

String parent = parent(originalPath);
if (parent == null) {
parent = "/";
}
// Create parent nodes as "CONTAINER" so that ZK will automatically delete them when they're empty
asyncCreateFullPathOptimistic(zk, parent, new byte[0], CreateMode.CONTAINER,
(rc1, path1, ctx1, name1) -> {
Expand Down

0 comments on commit bcbbbd3

Please sign in to comment.