squah-confluent commented on code in PR #22487: URL: https://github.com/apache/kafka/pull/22487#discussion_r3510451182
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/TargetAssignmentRecordsBuilder.java: ########## @@ -0,0 +1,483 @@ +/* + * 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; + +import org.apache.kafka.common.utils.internals.LogContext; +import org.apache.kafka.coordinator.common.runtime.CoordinatorRecord; +import org.apache.kafka.coordinator.group.modern.Assignment; +import org.apache.kafka.coordinator.group.streams.StreamsCoordinatorRecordHelpers; +import org.apache.kafka.coordinator.group.streams.TasksTuple; + +import org.slf4j.Logger; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * Builds the records to persist a new target assignment for a group. + * + * Records are only created for members which have a new target assignment. If + * their assignment did not change, no new record is needed. + * + * @param <A> The member's target assignment type. + */ +public abstract class TargetAssignmentRecordsBuilder<A> { + + /** + * The logger. + */ + private final Logger log; + + /** + * The group id. + */ + private final String groupId; + + /** + * The target assignment epoch. + */ + private int assignmentEpoch; + + /** + * The time at which the target assignment calculation finished. + */ + private long assignmentTimestampMs; + + /** + * The static members in the group at the time the new target assignment was computed. + */ + private Map<String, String> previousStaticMembers = Map.of(); + + /** + * The current member ids in the group. + */ + private Set<String> currentMemberIds; Review Comment: This wasn't a conscious choice. The default initializations were taken from `TargetAssignmentBuilder`. All of them should be required, except for `previousStaticMembers` and `currentStaticMembers` which aren't set by share groups. I've removed the defaults for the others. -- 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]
