protected static <T, D> @NotNull MapReduceIndex<Integer, T, D> createMapReduceIndex(@NotNull String name,
                                                                                      @NotNull StorageId.Directory storageId,
                                                                                      @NotNull DataIndexer<Integer, T, D> indexer,
                                                                                      @NotNull DataExternalizer<T> externalizer,
                                                                                      @Nullable StorageLockContext storageLockContext,
                                                                                      @Nullable ForwardIndex forwardIndex,
                                                                                      @Nullable ForwardIndexAccessor<Integer, T> forwardIndexAccessor,
                                                                                      @NotNull VcsLogErrorHandler errorHandler)
    throws IOException {
    MyIndexExtension<T, D> extension = new MyIndexExtension<>(name, indexer, externalizer, storageId.getVersion());
    PagedFileStorage.THREAD_LOCAL_STORAGE_LOCK_CONTEXT.set(storageLockContext);
    try {
      return new MyMapReduceIndex<>(extension, new MyMapIndexStorage<>(name, storageId, externalizer), forwardIndex,
                                    forwardIndexAccessor, errorHandler);
    }
    finally {
      PagedFileStorage.THREAD_LOCAL_STORAGE_LOCK_CONTEXT.remove();
    }
  }
protected static <T, D> @NotNull MapReduceIndex<Integer, T, D> createMapReduceIndex(@NotNull String name,
                                                                                      @NotNull StorageId.Directory storageId,
                                                                                      @NotNull DataIndexer<Integer, T, D> indexer,
                                                                                      @NotNull DataExternalizer<T> externalizer,
                                                                                      @Nullable StorageLockContext storageLockContext,
                                                                                      @Nullable ForwardIndex forwardIndex,
                                                                                      @Nullable ForwardIndexAccessor<Integer, T> forwardIndexAccessor,
                                                                                      @NotNull VcsLogErrorHandler errorHandler)