Skip to content

Commit

Permalink
Don't create /ledgers in ZK if it already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Feb 6, 2024
1 parent 26eeb77 commit ea4ece7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ public static boolean zookeeperRunning(DockerClient docker, String containerId)
public static void legacyMetadataFormat(DockerClient docker) throws Exception {
@Cleanup
ZooKeeper zk = BookKeeperClusterUtils.zookeeperClient(docker);
zk.create("/ledgers", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/ledgers/available", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
if (zk.exists("/ledgers", false) == null) {
zk.create("/ledgers", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
if (zk.exists("/ledgers/available", false) == null) {
zk.create("/ledgers/available", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
}

public static boolean metadataFormatIfNeeded(DockerClient docker, String version) throws Exception {
Expand Down

0 comments on commit ea4ece7

Please sign in to comment.