IndexConfiguration () { 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(); myRegisteredIndexes.setState(myState); // 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 myState; } finally { //CorruptionMarker.markIndexesAsDirty(); FileBasedIndexImpl.setupWritingIndexValuesSeparatedFromCounting(); myFileBasedIndex.addStaleIds(myStaleIds); myFileBasedIndex.addStaleIds(myDirtyFileIds); myFileBasedIndex.setUpFlusher(); myFileBasedIndex.setUpHealthCheck(); myRegisteredIndexes.ensureLoadedIndexesUpToDate(); myRegisteredIndexes.markInitialized(); // this will ensure that all changes to component's state will be visible to other threads saveRegisteredIndicesAndDropUnregisteredOnes(myState.getIndexIDs()); PersistentDirtyFilesQueue.removeCurrentFile(PersistentDirtyFilesQueue.getQueueFile()); } }