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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/RackAwareStandbyPicker.java:
##########
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.streams.assignor;
+
+import org.apache.kafka.coordinator.group.Utils;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.ToDoubleFunction;
+import java.util.stream.IntStream;
+
+/**
+ * Picks the conditions for the next standby of one task: the most tag keys 
that a process with room can meet,
+ * preferring the keys earlier in {@code rack.aware.assignment.tags}. A 
process meets a tag key when it has a value
+ * for it that no holder of the task has yet. A pick also returns the 
least-loaded process with room that meets the

Review Comment:
   > when it has a value for it that no holder of the task has yet
   
   This read complicated. Should we just say "when it has a value that is not 
used yet"? Or "when it has a value different from any holder of the task"?
   
   The overall description seems to be complicated. We have processes, and 
members, and processes are configured with `client.tag.<key>=<value>` pairs. We 
can assign a task (with either active or standby role, but it doesn't really 
matter for the algorithm) to a process/member, and thus "use" a `<value>` for a 
`<key>`.
   
   The phrase "that no holder of the task has yet" seems to describe it in a 
way, as if the tags a holder (ie process/member) has could change based on what 
the algorithm does, but they are fixed in the config. The algorithm assigns 
tasks, and make a process/member a holder, but it does not assign tag values to 
holders.



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