private @NotNull Pair<VcsLogStorage, VcsLogModifiableIndex> createStorageAndIndex(@NotNull VcsLogProgress progress, boolean isIndexEnabled) {
    if (!VcsLogCachesInvalidator.getInstance().isValid()) {
      // this is not recoverable
      // restart won't help here
      // and cannot shut down ide because of this
      // so use memory storage (probably leading to out of memory at some point) + no index

      LOG.error("Could not delete caches at " + PersistentUtil.LOG_CACHE);
      myErrorHandler.displayMessage(VcsLogBundle.message("vcs.log.fatal.error.message", PersistentUtil.LOG_CACHE,
                                                         ApplicationNamesInfo.getInstance().getFullProductName()));
      return new Pair<>(new InMemoryStorage(), new EmptyIndex());
    }

    String logId = PersistentUtil.calcLogId(myProject, myLogProviders);
    Map<VirtualFile, VcsLogIndexer> indexers = VcsLogPersistentIndex.getAvailableIndexers(myLogProviders);
    boolean isIndexSwitchedOnInRegistry = isIndexSwitchedOnInRegistry();
    boolean isIndexSwitchedOn = isIndexEnabled && isIndexSwitchedOnInRegistry;

    VcsLogStorage storage;
    VcsLogStorageBackend indexBackend;
    try {
      if (Registry.is("vcs.log.index.sqlite.storage", false)) {
        SqliteVcsLogStorageBackend sqliteBackend = new SqliteVcsLogStorageBackend(myProject, logId, myLogProviders, myErrorHandler, this);
        storage = sqliteBackend;
        indexBackend = sqliteBackend;
      }
      else {
        Set<VirtualFile> indexingRoots = isIndexSwitchedOn ? new LinkedHashSet<>(indexers.keySet()) : Collections.emptySet();
        Pair<VcsLogStorage, VcsLogStorageBackend> storageAndIndexBackend = VcsLogStorageImpl.createStorageAndIndexBackend(myProject, logId,
                                                                                                                          myLogProviders,
                                                                                                                          indexingRoots,
                                                                                                                          myErrorHandler,
                                                                                                                          this);
        storage = storageAndIndexBackend.first;
        indexBackend = storageAndIndexBackend.second;
      }
    }
    catch (IOException e) {
      LOG.error("Falling back to in-memory hashes", e);
      return new Pair<>(new InMemoryStorage(), new EmptyIndex());
    }

    if (indexBackend == null || !isIndexSwitchedOn || indexers.isEmpty()) {
      if (!isIndexSwitchedOnInRegistry) LOG.info("Vcs log index is turned off in the registry");
      if (!isIndexEnabled) LOG.info("Vcs log index is turned off for " + VcsLogUtil.getProvidersMapText(myLogProviders));
      if (indexers.isEmpty()) LOG.info("No indexers found for project " + myProject.getName());
      return new Pair<>(storage, new EmptyIndex());
    }

    VcsLogPersistentIndex index = new VcsLogPersistentIndex(myProject, myLogProviders, indexers, storage, indexBackend, progress,
                                                            myErrorHandler, this);
    return new Pair<>(storage, index);
  }
private @NotNull Pair<VcsLogStorage, VcsLogModifiableIndex> createStorageAndIndex(@NotNull VcsLogProgress progress, boolean isIndexEnabled)