@Override
  public CompactionDetails getCompactionDetails(long totalCapacity, long usedCapacity, long segmentCapacity,
      long segmentHeaderSize, List<LogSegmentName> logSegmentsNotInJournal, BlobStoreStats blobStoreStats,
      String dataDir) throws StoreException {
    CompactionDetails details = null;
    logger.trace("UsedCapacity {} vs TotalCapacity {}", usedCapacity, totalCapacity);
    if (usedCapacity >= (storeConfig.storeMinUsedCapacityToTriggerCompactionInPercentage / 100.0) * totalCapacity) {
      if (logSegmentsNotInJournal != null) {
        Pair<Long, NavigableMap<LogSegmentName, Long>> validDataSizeByLogSegment =
            blobStoreStats.getValidDataSizeByLogSegment(
                new TimeRange(time.milliseconds() - messageRetentionTimeInMs - ERROR_MARGIN_MS, ERROR_MARGIN_MS));
        String sizeLog = "";
        if (validDataSizeByLogSegment != null) {
          sizeLog = blobStoreStats.dumpLogSegmentSize(validDataSizeByLogSegment.getSecond(), segmentCapacity, dataDir);
        }
        //@formatter:off
        List<LogSegmentName> finalLogSegmentNames =
            storeConfig.storeCompactAllPolicyFilterOutAllValidSegment && validDataSizeByLogSegment != null
            ?filterOutAllValidLogSegment(logSegmentsNotInJournal, blobStoreStats.getLogSegmentSizeProvider(), validDataSizeByLogSegment.getSecond())
            :logSegmentsNotInJournal;
        //@formatter:on
        if (finalLogSegmentNames == null || finalLogSegmentNames.isEmpty()) {
          return null;
        }
        details =
            new CompactionDetails(time.milliseconds() - messageRetentionTimeInMs, finalLogSegmentNames, null, true);

        logger.info("[CAPACITY] Generating CompactionDetails {} using CompactAllPolicy for {}. Stats {}", details,
            dataDir, sizeLog);
      }
    }
    return details;
  }
CompactAllPolicy returns the entire list of all log segments non overlapping with {@link Journal} as a candidate
to be compacted for {@link CompactionPolicy#getCompactionDetails(long, long, long, long, List, BlobStoreStats, String)}
ambry-store/src/main/java/com/github/ambry/store/CompactAllPolicyFactory.java