@Override
  protected @NotNull FileBasedIndexDataInitializationResult finish() {
    try {
      myState.finalizeFileTypeMappingForIndices();

      showChangedIndexesNotification();

      myRegistrationResultSink.logChangedAndFullyBuiltIndices(
        FileBasedIndexImpl.LOG,
        "Indexes to be rebuilt after version change:",
        myCurrentVersionCorrupted ? "Indexes to be rebuilt after corruption:" : "Indices to be built:"
      );

      myState.freeze();
      FileBasedIndexDataInitializationResult result = new FileBasedIndexDataInitializationResult(myState, myCurrentVersionCorrupted, myOrphanDirtyFilesQueue);
      myRegisteredIndexes.setInitializationResult(result); // memory barrier
      // check if rebuild was requested for any index during registration
      for (ID<?, ?> indexId : myState.getIndexIDs()) {
        try {
          RebuildStatus.clearIndexIfNecessary(indexId, () -> myFileBasedIndex.clearIndex(indexId));
        }
        catch (StorageException e) {
          myFileBasedIndex.requestRebuild(indexId, e);
          FileBasedIndexImpl.LOG.error(e);
        }
      }

      return result;
    }
    finally {
      //CorruptionMarker.markIndexesAsDirty();
      FileBasedIndexImpl.setupWritingIndexValuesSeparatedFromCounting();
      myFileBasedIndex.addStaleIds(myStaleIds);
      myFileBasedIndex.setUpFlusher();
      myRegisteredIndexes.ensureLoadedIndexesUpToDate();
      myRegisteredIndexes.markInitialized();  // this will ensure that all changes to component's state will be visible to other threads
      saveRegisteredIndicesAndDropUnregisteredOnes(myState.getIndexIDs());
    }
  }
@Override
  protected @NotNull FileBasedIndexDataInitializationResult finish()