code: private void createZkMetadataIfNotExists(StorageInfo si) throws IOException {
      try {
        if (!hasSomeJournalData()) {
          try {
            // First create the parent path
            zk.create(zkParentPath, new byte[] { '0' },
                Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
  
            // Write format/namespace information to ZooKeeper
            FormatInfoWritable writable = localFormatInfoWritable.get();
            writable.set(PROTO_VERSION, si);
            byte[] data = WritableUtil.writableToByteArray(writable);
            zk.create(formatInfoPath, data, Ids.OPEN_ACL_UNSAFE,
                CreateMode.PERSISTENT);
          } catch (KeeperException e) {
            keeperException("Unrecoverable ZooKeeper error initializing " +
                zkParentPath, e);
          } catch (InterruptedException e) {
            interruptedException("Interrupted initializing " + zkParentPath +
                " in ZooKeeper", e);
          }
        }
      } catch (IOException e) {
        LOG.error("Unable to initialize metadata", e);
        throw e;
      }
    }
docs: If there is no metadata present in ZooKeeper, create and populate the
  metadata with the right format information
  @param si The format information to set
  @throws IOException If there is an error writing to ZooKeeper