mjsax commented on code in PR #23092: URL: https://github.com/apache/kafka/pull/23092#discussion_r3755576986
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/AssignmentConfigsImpl.java: ########## @@ -0,0 +1,88 @@ +/* + * 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.GroupCoordinatorConfig; +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 { + + // The names under which the configurations are passed to the assignor and recorded for the group. + public static final String NUM_STANDBY_REPLICAS_CONFIG = "num.standby.replicas"; + public static final String RACK_AWARE_ASSIGNMENT_TAGS_CONFIG = "rack.aware.assignment.tags"; + + /** + * The configs of a group that has none of them set, holding the default value of every configuration. + */ + public static final AssignmentConfigsImpl DEFAULT = new AssignmentConfigsImpl( + GroupCoordinatorConfig.STREAMS_GROUP_NUM_STANDBY_REPLICAS_DEFAULT, + // The parsed form of STREAMS_GROUP_RACK_AWARE_ASSIGNMENT_TAGS_DEFAULT, which ConfigDef spells as "". + List.of() Review Comment: Hmmm... This still seems to be error prone? In the end, we should have a single source of truth... Should we rather use `STREAMS_GROUP_RACK_AWARE_ASSIGNMENT_TAGS_DEFAULT` and parse it into empty List? If the default changes, this code would update immediatly? But on the other hand, it seem we are using `DEFAULT` only in tests, what make it somewhat questionable, if it's the right place to add it here? -- 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]
