gabriellefu commented on code in PR #23924:
URL: https://github.com/apache/kafka/pull/23924#discussion_r4568647977
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/BalancedTaskAssignor.java:
##########
@@ -273,7 +283,63 @@ private static void assignStandbyReplicaTasks(final
Collection<ProcessTasks> pro
tasksShortOfReplicas, statefulTasks.size(),
numStandbyReplicas, missingReplicas, processes.size());
}
- balanceTasksOverProcesses(processes, process -> process.standbyTasks);
+ balanceTasksOverProcesses(
+ processes,
+ process -> process.standbyTasks,
+ rackAwareAssignmentTags.isEmpty() ? null : new
RackDiversity(processes, statefulTasks.size(), rackAwareAssignmentTags)
+ );
+ }
+
+ /**
+ * Places the standby tasks that make their task more rack-diverse, each
on the least loaded process among the
+ * most diverse ones, and returns the number placed per task. A process
takes them while one of its members is
+ * below the per-member task quota.
+ */
+ private static Map<TaskId, Integer> assignRackAwareStandbys(final
Collection<ProcessTasks> processes,
+ final
SortedSet<TaskId> statefulTasks,
+ final int
numStandbyReplicas,
+ final
List<String> rackAwareAssignmentTags) {
+ final Map<TaskId, ProcessTasks> activeTaskToProcess =
Utils.newHashMap(statefulTasks.size());
+ for (final ProcessTasks process : processes) {
+ for (final TaskId task : process.statefulActiveTasks) {
+ activeTaskToProcess.put(task, process);
+ }
+ }
+
+ final TaskQuota quota = new TaskQuota(processes, (long)
statefulTasks.size() * numStandbyReplicas);
Review Comment:
cause it's taskquota is for the whole group which is the upper bound of how
many each member can at most hold right now.(for those haven't full yet)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]