void updateSealedStatus() {
    // In two zk clusters case, "replicaId.isSealed()" might be true in first cluster but is still unsealed in second
    // cluster, as server only spectates the first cluster. To guarantee both clusters have consistent seal/unseal
    // state, we bypass "isSealed()" check if there are more than one replicaStatusDelegates.
    ReplicaSealStatus oldReplicaSealStatus = replicaSealStatus.get();
    ReplicaSealStatus resolvedReplicaSealStatus = resolveReplicaSealStatusFromLogSize();
    if (resolvedReplicaSealStatus == ReplicaSealStatus.SEALED && ((replicaStatusDelegates.size() > 1
        && replicaSealStatus.getAndSet(ReplicaSealStatus.SEALED) != ReplicaSealStatus.SEALED)
        || !replicaId.isSealed())) {
      for (ReplicaStatusDelegate replicaStatusDelegate : replicaStatusDelegates) {
        if (!replicaStatusDelegate.seal(replicaId)) {
          metrics.sealSetError.inc();
          logger.warn("Could not set the partition as read-only status on {}", replicaId);
          replicaSealStatus.set(oldReplicaSealStatus);
        } else {
          // From the sealDoneCount metric, we can identify the hosts which frequently seal and unseal partitions.
          metrics.sealDoneCount.inc();
          logger.info(
              "[CAPACITY] Store is successfully sealed for partition : {} because current used capacity : {} bytes exceeds ReadOnly threshold : (low : {}, high : {}) bytes",
              replicaId.getPartitionId(), index.getLogUsedCapacity(), sealThresholdBytesLow, sealThresholdBytesHigh);
        }
      }
    } else if (resolvedReplicaSealStatus == ReplicaSealStatus.PARTIALLY_SEALED && ((replicaStatusDelegates.size() > 1
        && replicaSealStatus.getAndSet(ReplicaSealStatus.PARTIALLY_SEALED) != ReplicaSealStatus.PARTIALLY_SEALED)
        || !replicaId.isPartiallySealed())) {
      for (ReplicaStatusDelegate replicaStatusDelegate : replicaStatusDelegates) {
        if (!replicaStatusDelegate.partialSeal(replicaId)) {
          metrics.partialSealSetError.inc();
          logger.warn("Could not set the partition as partially-sealed status on {}", replicaId);
          replicaSealStatus.set(oldReplicaSealStatus);
        } else {
          metrics.partialSealDoneCount.inc();
          logger.info(
              "Store is successfully partial-sealed for partition : {} because current used capacity : {} bytes is exceeds Partial Read threshold : (low : {}, high : {}) bytes",
              replicaId.getPartitionId(), index.getLogUsedCapacity(), partialSealThresholdBytesLow,
              partialSealThresholdBytesHigh);
        }
      }
    } else if (resolvedReplicaSealStatus == ReplicaSealStatus.NOT_SEALED && ((replicaStatusDelegates.size() > 1
        && replicaSealStatus.getAndSet(ReplicaSealStatus.NOT_SEALED) != ReplicaSealStatus.NOT_SEALED)
        || !replicaId.isUnsealed())) {
      for (ReplicaStatusDelegate replicaStatusDelegate : replicaStatusDelegates) {
        if (!replicaStatusDelegate.unseal(replicaId)) {
          metrics.unsealSetError.inc();
          logger.warn("Could not set the partition as not sealed on {}", replicaId);
          replicaSealStatus.set(oldReplicaSealStatus);
        } else {
          metrics.unsealDoneCount.inc();
          logger.info(
              "[CAPACITY] Store is successfully unsealed for partition : {} because current used capacity : {} bytes is below Read Write threshold : {} bytes",
              replicaId.getPartitionId(), index.getLogUsedCapacity(), partialSealThresholdBytesHigh);
        }
      }
    }
  }
Update the sealed status of the replica.
ambry-store/src/main/java/com/github/ambry/store/BlobStore.java