private List<StoreKey> checkConsistency(Map<StoreKey, ReplicationStatus> blobIdToStatusMap, int replicaCount) {
    List<StoreKey> realInconsistentBlobs = new ArrayList<>();
    logger.info("Total Blobs Found {}", blobIdToStatusMap.size());
    long totalInconsistentBlobs = 0;
    long totalDeprecatedBlobs = 0;
    long inconsistentDueToReplicationCount = 0;
    long acceptableInconsistentBlobs = 0;
    for (StoreKey blobId : blobIdToStatusMap.keySet()) {
      ReplicationStatus consistencyBlobResult = blobIdToStatusMap.get(blobId);
      // valid blobs : count of available replicas = total replica count or count of deleted replicas = total replica count
      boolean allAgreeOnPermanency =
          consistencyBlobResult.permanentOn.size() == 0 || consistencyBlobResult.permanentOn.containsAll(
              consistencyBlobResult.available);
      boolean isValid = (consistencyBlobResult.available.size() == replicaCount
          || consistencyBlobResult.deletedOrExpiredOrDeprecated.size() == replicaCount) && allAgreeOnPermanency;
      if (!isValid) {
        totalInconsistentBlobs++;
        if (consistencyBlobResult.isDeprecated) {
          totalDeprecatedBlobs++;
        }
        if (consistencyBlobResult.deletedOrExpiredOrDeprecated.size() + consistencyBlobResult.unavailable.size()
            == replicaCount) {
          // acceptable inconsistent blobs : count of deleted + count of unavailable = total replica count
          logger.debug("Partially deleted (acceptable inconsistency) blob {} isDeletedOrExpired {}. Blob status - {}",
              blobId, consistencyBlobResult.isDeletedOrExpired, consistencyBlobResult);
          acceptableInconsistentBlobs++;
        } else {
          if (consistencyBlobResult.belongsToRecentIndexSegment) {
            logger.debug("Inconsistent blob found possibly due to replication {} Status map {} ", blobId,
                consistencyBlobResult);
            inconsistentDueToReplicationCount++;
          } else {
            logger.error("Inconsistent blob found {} Status map {}", blobId, consistencyBlobResult);
            realInconsistentBlobs.add(blobId);
          }
        }
      }
    }
    // Inconsistent blobs = real inconsistent + acceptable inconsistent + inconsistent due to replication Lag
    // Deprecated blobs = blobs determined to be deprecated
    // Acceptable inconsistent = due to deletion, some replicas reports as deleted, whereas some reports as unavailable
    // Inconsistent due to replication lag = Inconsistency due to replication lag.
    // Anything else is considered to be real inconsistent blobs
    logger.info("Total Inconsistent blobs count : {}", totalInconsistentBlobs);
    logger.info("Total Deprecated blobs count : {}", totalDeprecatedBlobs);
    logger.info("Acceptable Inconsistent blobs count : {}", acceptableInconsistentBlobs);
    logger.info("Inconsistent blobs count due to replication lag : {}", inconsistentDueToReplicationCount);
    logger.info("Real Inconsistent blobs count : {} ", realInconsistentBlobs.size());
    return realInconsistentBlobs;
  }
Walks through blobs and its status in all replicas and collects inconsistent blobs information
@param blobIdToStatusMap {@link Map} of BlobId to {@link ReplicationStatus} that needs to be updated with the
                                        status of every blob in the index
@param replicaCount total replica count
@return {@link List} of real inconsistent blobIds
ambry-tools/src/main/java/com/github/ambry/store/ConsistencyCheckerTool.java