@Override
  public void run() {
    logger.debug("Participant consistency checker is initiated. Participants count = {}", participants.size());
    try {
      // when code reaches here, it means there are at least two participants.
      ClusterParticipant clusterParticipant = participants.get(0);
      Set<String> sealedReplicas1 = new HashSet<>(clusterParticipant.getSealedReplicas());
      Set<String> stoppedReplicas1 = new HashSet<>(clusterParticipant.getStoppedReplicas());
      Set<String> partiallySealedReplicas1 = new HashSet<>(clusterParticipant.getPartiallySealedReplicas());
      for (int i = 1; i < participants.size(); ++i) {
        logger.debug("Checking sealed replica list");
        Set<String> sealedReplicas2 = new HashSet<>(participants.get(i).getSealedReplicas());
        if (!sealedReplicas1.equals(sealedReplicas2)) {
          logger.warn("Mismatch in sealed replicas. Set {} is different from set {}", sealedReplicas1, sealedReplicas2);
          metrics.sealedReplicasMismatchCount.inc();
        }
        logger.debug("Checking stopped replica list");
        Set<String> stoppedReplicas2 = new HashSet<>(participants.get(i).getStoppedReplicas());
        if (!stoppedReplicas1.equals(stoppedReplicas2)) {
          logger.warn("Mismatch in stopped replicas. Set {} is different from set {}", stoppedReplicas1,
              stoppedReplicas2);
          metrics.stoppedReplicasMismatchCount.inc();
        }
        logger.debug("Checking partially sealed replica list");
        Set<String> partiallySealedReplicas2 = new HashSet<>(participants.get(i).getPartiallySealedReplicas());
        if (!partiallySealedReplicas1.equals(partiallySealedReplicas2)) {
          logger.warn("Mismatch in partially sealed replicas. Set {} is different from set {}",
              partiallySealedReplicas1, partiallySealedReplicas2);
          metrics.partiallySealedReplicasMismatchCount.inc();
        }
      }
    } catch (Throwable t) {
      logger.error("Exception occurs when running consistency checker ", t);
    }
  }
A thread that helps periodically check consistency of participants. Specifically, it checks if there is a mismatch
in sealed and stopped replicas from each participant.
ambry-server/src/main/java/com/github/ambry/server/ParticipantsConsistencyChecker.java