private void tryInit(@NotNull Path storageFilePath, StorageLockContext context, int retryCount) throws IOException {
    Path parentDir = storageFilePath.getParent();
    Path recordsFile = parentDir.resolve(storageFilePath.getFileName() + INDEX_EXTENSION);
    Path dataFile = parentDir.resolve(storageFilePath.getFileName() + DATA_EXTENSION);

    boolean rFExists = Files.exists(recordsFile);
    boolean dFExists = Files.exists(dataFile);
    if (rFExists != dFExists) {
      // ensure both files deleted
      rFExists = false;
      dFExists = false;
    }

    if (!rFExists) {
      Files.createDirectories(parentDir);
    }

    if (!rFExists) {
      createOrTruncateFile(recordsFile);
    }
    if (!dFExists) {
      createOrTruncateFile(dataFile);
    }

    IRecordsTable recordsTable = null;
    IDataTable dataTable;
    try {
      recordsTable = createRecordsTable(context, recordsFile);
      dataTable = createDataTable(context, dataFile);
    }
    catch (IOException e) {
      LOG.info(e.getMessage());
      if (recordsTable != null) {
        IOUtil.closeSafe(LOG, recordsTable);
      }

      boolean deleted = deleteFiles(storageFilePath);
      if (!deleted) {
        throw new IOException("Can't delete caches at: " + storageFilePath);
      }
      if (retryCount >= 5) {
        throw new IOException("Can't create storage at: " + storageFilePath);
      }

      tryInit(storageFilePath, context, retryCount + 1);
      return;
    }

    this.recordsTable = recordsTable;
    this.dataTable = dataTable;
    this.context = context;

    if (this.dataTable.isCompactNecessary()) {
      compact(storageFilePath);
    }
  }
private void tryInit(@NotNull Path storageFilePath, StorageLockContext context, int retryCount)