public boolean hasCompletedReplication(PartitionId partitionId) {
    Store store = storageManager.getStore(partitionId);

    if (store != null && store.isStarted()) {
      ReplicaState state = store.getCurrentState();
      if (state == null) {
        logger.error("Replica state not found for partition {}", partitionId);
        return true;
      }

      logger.debug("Found state {} for partition {}", state, partitionId);
      // Check if replica is in STANDBY or LEADER state, which means bootstrap is complete
      return state == ReplicaState.STANDBY || state == ReplicaState.LEADER || state == ReplicaState.ERROR;
    } else {
      logger.error("Store not started or not found for partition {}. Will try this partition in next run", partitionId);
      return true;
    }
  }
Manually check if a specific partition has completed replication.
This uses storageManager to verify status.
@param partitionId The partition to check.
@return true if replication is complete (bootstrap finished)
ambry-prioritization/src/main/java/com/github/ambry/replica/prioritization/ReplicationPrioritizationManager.java