lucasbru commented on code in PR #20730:
URL: https://github.com/apache/kafka/pull/20730#discussion_r2445923034
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/StreamsGroupMember.java:
##########
@@ -254,42 +254,38 @@ public Builder
updateWith(StreamsGroupCurrentMemberAssignmentValue record) {
setPreviousMemberEpoch(record.previousMemberEpoch());
setState(MemberState.fromValue(record.state()));
setAssignedTasks(
- new TasksTuple(
- assignmentFromTaskIds(record.activeTasks()),
- assignmentFromTaskIds(record.standbyTasks()),
- assignmentFromTaskIds(record.warmupTasks())
+ TasksTupleWithEpochs.fromCurrentAssignmentRecord(
+ record.activeTasks(),
+ record.standbyTasks(),
+ record.warmupTasks(),
+ record.memberEpoch()
)
);
setTasksPendingRevocation(
- new TasksTuple(
-
assignmentFromTaskIds(record.activeTasksPendingRevocation()),
-
assignmentFromTaskIds(record.standbyTasksPendingRevocation()),
-
assignmentFromTaskIds(record.warmupTasksPendingRevocation())
+ TasksTupleWithEpochs.fromCurrentAssignmentRecord(
+ record.activeTasksPendingRevocation(),
+ record.standbyTasksPendingRevocation(),
+ record.warmupTasksPendingRevocation(),
+ record.memberEpoch()
)
);
return this;
}
- private static Map<String, Set<Integer>> assignmentFromTaskIds(
- List<StreamsGroupCurrentMemberAssignmentValue.TaskIds>
topicPartitionsList
- ) {
- return topicPartitionsList.stream().collect(Collectors.toMap(
-
StreamsGroupCurrentMemberAssignmentValue.TaskIds::subtopologyId,
- taskIds -> Set.copyOf(taskIds.partitions())));
- }
-
public static Builder withDefaults(String memberId) {
return new Builder(memberId)
.setRebalanceTimeoutMs(-1)
.setTopologyEpoch(-1)
.setInstanceId(null)
.setRackId(null)
+ .setClientId("")
+ .setClientHost("")
.setProcessId("")
.setClientTags(Collections.emptyMap())
.setState(MemberState.STABLE)
.setMemberEpoch(0)
- .setAssignedTasks(TasksTuple.EMPTY)
- .setTasksPendingRevocation(TasksTuple.EMPTY)
+ .setAssignedTasks(TasksTupleWithEpochs.EMPTY)
+ .setTasksPendingRevocation(TasksTupleWithEpochs.EMPTY)
.setUserEndpoint(null);
}
Review Comment:
This is indeed a very small side cleanup. It does not make a difference,
since client ID and client Host are always updated in the heartbeat handler. It
just matches the expectation that everything is initialized.
--
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]