public int compactPartitions() {
    try {
      /*
        Create an exclusive local copy of partition set to minimize concurrent accesses.
        Submit jobs and rely on the executor service for assignment and scheduling.
      */
      numBlobsErased.set(0); // Reset counter
      return executorService.invokeAll(
          new HashSet<>(partitions)
              .stream()
              .map(partitionId -> new CompactionTask(partitionId, this))
              .collect(Collectors.toSet()))
          .stream()
          .map(future -> getResult(future))
          .max(Integer::compare)
          .orElse(0);
    } catch (Throwable throwable) {
      azureMetrics.compactionTaskErrorCount.inc();
      logger.error("[COMPACT] Failed to execute cloud-compaction tasks due to",
          throwable);
    }
    return 0;
  }
Purge the inactive blobs in all managed partitions.
@return the total number of blobs purged.
ambry-cloud/src/main/java/com/github/ambry/cloud/CloudStorageCompactor.java