private void cleanupUnusedTempSegments() throws StoreException {
    File[] files = dataDir.listFiles(TEMP_LOG_SEGMENTS_FILTER);
    if (files != null) {
      logger.debug("Cleaning up {}", files);
      for (File file : files) {
        // TODO (DiskManager changes): This will actually return the segment to the DiskManager pool.
        if (!file.delete()) {
          throw new StoreException("Could not delete segment file: " + file.getAbsolutePath(),
              StoreErrorCodes.UnknownError);
        }
      }
    } else {
      throw new StoreException("Could not list temp files in directory: " + dataDir, StoreErrorCodes.UnknownError);
    }
  }
Cleans up any unused temporary segments. Can happen only if there were no entries to be copied and all the segments
under compaction can be just dropped.
@throws StoreException if the directory listing did not succeed or if any of the files could not be deleted.
ambry-store/src/main/java/com/github/ambry/store/BlobStoreCompactor.java