void maybeDeprioritizeLocalBootstrapReplicas(int numLocalAndLiveReplicas) {
    // we know local and live replicas are going to be put in frontend of the pool
    if (isGetOperation() && numLocalAndLiveReplicas > 1
        && routerConfig.routerGetOperationDeprioritizeBootstrapReplicas) {
      List<ReplicaId> localAndLiveReplicas = new ArrayList<>(replicaPool.subList(0, numLocalAndLiveReplicas));
      // Sort local and live replicas based on the replica state, bootstrap replicas
      // are going to be pushed back
      localAndLiveReplicas.sort((r1, r2) -> {
        ReplicaState rs1 = getReplicaState(r1);
        ReplicaState rs2 = getReplicaState(r2);
        if (rs1 == ReplicaState.BOOTSTRAP && rs2 == ReplicaState.BOOTSTRAP) {
          return 0;
        } else if (rs1 == ReplicaState.BOOTSTRAP || rs2 == ReplicaState.BOOTSTRAP) {
          // if rs1 is bootstrap, which means rs2 is not, then r2 should be smaller than r1
          // so it can be prioritized.
          return rs1 == ReplicaState.BOOTSTRAP ? 1 : -1;
        } else {
          return 0;
        }
      });
      ListIterator<ReplicaId> iter = replicaPool.listIterator();
      for (ReplicaId replicaId : localAndLiveReplicas) {
        iter.next();
        iter.set(replicaId);
      }
    }
  }
Deprioritize bootstrap replicas in local dc if all conditions are satisfied.
@param numLocalAndLiveReplicas The number of live replicas in local dc.
ambry-router/src/main/java/com/github/ambry/router/SimpleOperationTracker.java