private void cleanupLogAndIndexSegments(boolean recovering) throws StoreException {
    CompactionDetails details = compactionLog.getCompactionDetails();
    List<LogSegmentName> segmentsUnderCompaction = details.getLogSegmentsUnderCompaction();
    logger.debug("Cleaning up {} (and related index segments) in {}", segmentsUnderCompaction, storeId);
    for (int i = 0; i < segmentsUnderCompaction.size(); i++) {
      LogSegmentName segmentName = segmentsUnderCompaction.get(i);
      if (srcLog.getSegment(segmentName) != null) {
        PersistentIndex.cleanupIndexSegmentFilesForLogSegment(dataDir.getAbsolutePath(), segmentName);
        srcLog.dropSegment(segmentName, recovering || i >= numSwapsUsed);
      }
    }
  }
Cleans up all the log and index segments. This involves:
1. Dropping the log segments that are no longer relevant.
2. Deleting all associated index segment and bloom files.
@param recovering {@code true} if this function was called in the context of recovery. {@code false} otherwise.
@throws IOException
ambry-store/src/main/java/com/github/ambry/store/BlobStoreCompactor.java