@Override
  public void run() {
    logger.info("Named Blobs Cleanup Runner is initiated");
    try {
      List<StaleNamedBlob> staleResultList = namedBlobDb.pullStaleBlobs().get();
      List<StaleNamedBlob> failedResults = new ArrayList<>();
      for (StaleNamedBlob staleResult : staleResultList) {
        try {
          router.deleteBlob(staleResult.getBlobId(), "ambry-named-blobs-cleanup-runner").get();
        } catch (Exception e) {
          if (!e.getMessage().contains(RouterErrorCode.BlobDoesNotExist.name())) {
            logger.error("Failed to cleanup named stale blob {}", staleResult, e);
            failedResults.add(staleResult);
          }
        }
      }
      staleResultList.removeAll(failedResults);
      namedBlobDb.cleanupStaleData(staleResultList);
      logger.info("Named Blobs Cleanup Runner is completed for {} stale cases (there are {} failed cases)",
          staleResultList.size(), failedResults.size());
      Set<String> cleanedBlobIds = staleResultList.stream().map(StaleNamedBlob::getBlobId).collect(Collectors.toSet());
      logger.info("The cleaned blobIds are: {}", cleanedBlobIds);
    } catch (Throwable t) {
      logger.error("Exception occurs when running Named Blobs Cleanup Runner", t);
    }
  }
Pull out stale named blob records, delete those blobs, and soft delete the MySQL db rows
ambry-frontend/src/main/java/com/github/ambry/frontend/NamedBlobsCleanupRunner.java