squah-confluent commented on code in PR #23092:
URL: https://github.com/apache/kafka/pull/23092#discussion_r3749666480
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/assignor/StickyTaskAssignorTest.java:
##########
@@ -926,7 +925,7 @@ public void
shouldHandleOddNumberOfClientsWithStandbyTasks() {
}
GroupAssignment result = assignor.assign(
- new GroupSpecImpl(members,
mkMap(mkEntry(NUM_STANDBY_REPLICAS_CONFIG,
String.valueOf(numStandbyReplicas)))),
+ new GroupSpecImpl(members, new
AssignmentConfigsImpl(numStandbyReplicas, List.of())),
Review Comment:
These constructor calls are still going to be annoying to update when we add
new configs.
We could leave them be or we could try to tidy things up some more, for
example, by adding helper methods to construct an `AssignmentConfigsImpl` with
default values but a specific `num.standby.replicas` or
`rack.aware.assignment.tags` (eg. a `withNumStandbyReplicas`)
(Only applies to calls where we would want to take the defaults for future
configs.)
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/AssignmentConfigsImpl.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.api.streams.assignor.AssignmentConfigs;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * The assignment configurations for a streams group.
+ *
+ * @param numStandbyReplicas The number of standby replicas for each task.
+ * @param rackAwareAssignmentTags The client tags used to distribute standby
tasks across racks.
+ */
+public record AssignmentConfigsImpl(
+ int numStandbyReplicas,
+ List<String> rackAwareAssignmentTags
+) implements AssignmentConfigs {
+
+ private static final String NUM_STANDBY_REPLICAS_CONFIG =
"num.standby.replicas";
+ private static final String RACK_AWARE_ASSIGNMENT_TAGS_CONFIG =
"rack.aware.assignment.tags";
+
+ /**
+ * The configs used for a group that has none of them set.
+ */
+ public static final AssignmentConfigsImpl DEFAULT = new
AssignmentConfigsImpl(0, List.of());
Review Comment:
Where do we plan to define the default `num.standby.replicas` and
`rack.aware.assignment.tags`? Can we have a single source of truth for the
defaults?
--
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]