aliehsaeedii commented on code in PR #24321:
URL: https://github.com/apache/kafka/pull/24321#discussion_r4644447954
##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java:
##########
@@ -462,6 +462,14 @@ Map<TopicPartition, OffsetsInfo>
getOffsets(StreamsGroupDescription description)
for (StreamsGroupMemberDescription memberDescription : members) {
allTp.addAll(getTopicPartitions(memberDescription.assignment().activeTasks(),
description));
}
+ // Also include partitions that have committed offsets but are not
assigned to any member,
+ // e.g., when the group is empty, so that their committed offsets
are still shown.
+ Map<TopicPartition, OffsetAndMetadata> committedOffsets =
getCommittedOffsets(description.groupId());
+ committedOffsets.forEach((tp, offsetAndMetadata) -> {
+ if (offsetAndMetadata != null) {
+ allTp.add(tp);
Review Comment:
Agreed, empty groups can hit this now. #24193 (KAFKA-21457) adds exactly
that: it runs `filterNoneLeaderPartitions` on `allTp` in `getOffsets` and
prints `-` for those partitions. To avoid two PRs changing the same lines, I'd
leave it to that PR and rebase whichever lands second.
##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java:
##########
@@ -462,6 +462,14 @@ Map<TopicPartition, OffsetsInfo>
getOffsets(StreamsGroupDescription description)
for (StreamsGroupMemberDescription memberDescription : members) {
allTp.addAll(getTopicPartitions(memberDescription.assignment().activeTasks(),
description));
}
+ // Also include partitions that have committed offsets but are not
assigned to any member,
+ // e.g., when the group is empty, so that their committed offsets
are still shown.
+ Map<TopicPartition, OffsetAndMetadata> committedOffsets =
getCommittedOffsets(description.groupId());
Review Comment:
Done: `getOffsets` now passes the description to a new
`getCommittedOffsets(StreamsGroupDescription)` overload, so the group is no
longer described twice. The `groupId` variant stays for the reset and delete
paths and delegates to it.
--
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]