code: private void deleteMetadataAndLedgers() throws IOException {
      try {
        if (hasSomeJournalData()) {
          if (zkPathExists(metadataManager.getLedgerParentPath())) {
            for (EditLogLedgerMetadata ledger : metadataManager.listLedgers(true)) {
              try {
                // Try to delete the individual ledger from BookKeeper
                bookKeeperClient.deleteLedger(ledger.getLedgerId());
              } catch (BKException e) {
                // It is fine if we are unable to delete the ledger, as it will
                // not be read and can then be deleted manually.
                LOG.warn("Unable to delete ledger " + ledger + " from BookKeeper",
                    e);
              } catch (InterruptedException e) {
                interruptedException("Interrupted deleting ledger " + ledger, e);
              }
            }
          }
          deleteRecursively(zk, zkParentPath);
        }
      } catch (IOException e) {
        LOG.error("Error clearing out metadata under " + zkParentPath, e);
        throw e;
      }
    }
docs: If ZooKeeper metadata is not empty, forcefully delete the metadata
  and make a best effort attempt at deleting the ledgers. Used by
  {@link #formatJournal(StorageInfo)}
  @throws IOException If there is an error talking to BookKeeper or
  ZooKeeper