private void addNewPartitions() {
    int additionalPartitionsNeeded = minBatchSizeForHighPriorityPartitions - currentlyReplicatingPriorityPartitions.size();

    if (additionalPartitionsNeeded <= 0) {
      return;
    }

    logger.info("Adding {} additional partitions to reach minimum batch size of {}",
        additionalPartitionsNeeded, minBatchSizeForHighPriorityPartitions);

    // Get all partitions for this node
    Set<PartitionId> remainingPartitions = new HashSet<>(allBootstrappingPartitions);
    // Remove already prioritized partitions
    remainingPartitions.removeAll(currentlyReplicatingPriorityPartitions);

    if (remainingPartitions.isEmpty()) {
      logger.info("No additional partitions available to add to batch");
      return;
    }

    // Prioritize the remaining partitions
    // Add partitions in priority order until we reach the minimum batch size
    fillUptoBatchSize(additionalPartitionsNeeded, remainingPartitions);

    replicationPrioritizationMetrics.updateCurrentlyReplicatingPriorityPartitions(currentlyReplicatingPriorityPartitions);
  }
Add additional partitions to meet the minimum batch size requirement.
Now follows the priority ordering when adding partitions.
ambry-prioritization/src/main/java/com/github/ambry/replica/prioritization/ReplicationPrioritizationManager.java