@Override
  public @NotNull AppendOnlyLogOverMMappedFile open(@NotNull Path storagePath) throws IOException {
    if (eagerlyCheckFileCompatibility) {
      //Check the crucial file params (file type, impl version, page size...) _before_ open mmapped storage over it.
      // It could be troubling to unmap & delete file already mapped into memory (especially on Windows), so it
      // pays off to check crucial file parameters eagerly, before the mapping, and either fail or clean the file
      // while it is not mapped yet:
      long size = Files.exists(storagePath) ? Files.size(storagePath) : 0L;
      if (size > 0) {
        ByteBuffer buffer = ByteBuffer.allocate(AppendOnlyLogOverMMappedFile.HeaderLayout.HEADER_SIZE)
          .order(nativeOrder())
          .clear();

        try (FileChannel channel = FileChannel.open(storagePath, READ)) {
          int actuallyRead = channel.read(buffer);
          if (actuallyRead != AppendOnlyLogOverMMappedFile.HeaderLayout.HEADER_SIZE) {
            throw new CorruptedException("[" + storagePath + "]: file is not empty, but < HEADER_SIZE(=" + AppendOnlyLogOverMMappedFile.HeaderLayout.HEADER_SIZE + ")");
          }
          AppendOnlyLogOverMMappedFile.checkFileParamsCompatible(storagePath, buffer, pageSize);
          //TODO RC: maybe .expectedDataVersion check also better be here?
        }
        catch (IOException ex) {
          if (cleanFileIfIncompatible) {
            LOG.warn("[" + storagePath + "] is incompatible with current format " +
                     "-> delete it, and pretend never seen it incompatible " +
                     "(incompatibility: " + ex.getMessage() + ")"
            );
            FileUtil.delete(storagePath);
          }
          else {
            throw ex;
          }
        }
      }
    }

    MMappedFileStorageFactory mappedFileStorageFactory = MMappedFileStorageFactory.withDefaults()
      .pageSize(pageSize);
    return mappedFileStorageFactory.wrapStorageSafely(
      storagePath,
      storage -> {
        AppendOnlyLogOverMMappedFile appendOnlyLog = new AppendOnlyLogOverMMappedFile(storage);

        if (failInsteadOfRecovery) {
          if (appendOnlyLog.wasRecoveryNeeded()) {
            throw new CorruptedException("[" + storagePath.toAbsolutePath() + "] wasn't properly closed, " +
                                         "and recovery is prohibited -> fail");
          }
        }

        if (ensureDataVersion) {
          int dataFormatVersion = appendOnlyLog.getDataVersion();
          if (dataFormatVersion == 0 && appendOnlyLog.isEmpty()) {
            appendOnlyLog.setDataVersion(expectedDataVersion);
          }
          else if (dataFormatVersion != expectedDataVersion) {
            throw new VersionUpdatedException(storagePath, expectedDataVersion, dataFormatVersion);
          }
        }

        return appendOnlyLog;
      }
    );
  }
@Override
  public @NotNull AppendOnlyLogOverMMappedFile open(@NotNull Path storagePath)