mjsax commented on code in PR #23924:
URL: https://github.com/apache/kafka/pull/23924#discussion_r4560482482


##########
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) {

Review Comment:
   This formatting give better (ie smaller) diffs going forward, if we change 
the method signature or name



##########
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) {

Review Comment:
   This formatting gives better (ie smaller) diffs going forward, if we change 
the method signature or name



-- 
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]

Reply via email to