Copilot commented on code in PR #24350:
URL: https://github.com/apache/kafka/pull/24350#discussion_r4680940765
##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java:
##########
@@ -1001,15 +1025,19 @@ private Collection<TopicPartition>
getPartitionsToReset(String groupId) throws E
}
}
- private Map<TopicPartition, OffsetAndMetadata>
prepareOffsetsToReset(String groupId, Collection<TopicPartition>
partitionsToReset) {
+ private Map<TopicPartition, OffsetAndMetadata> prepareOffsetsToReset(
+ String groupId,
+ Collection<TopicPartition> partitionsToReset,
+ boolean groupExists
+ ) {
Review Comment:
The parameter name `groupExists` is ambiguous because it specifically
reflects whether a Streams group description was available (ie
`description.isPresent()`), not whether there are committed offsets (or whether
a consumer group exists). Renaming it to something more specific like
`streamsGroupExists`, `hasStreamsGroupDescription`, or
`groupFoundInDescribeStreamsGroups` would make the intent clearer and reduce
the chance of misuse.
##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java:
##########
@@ -982,16 +994,28 @@ private Map<TopicPartition, OffsetAndMetadata>
resetOffsetsForInactiveGroup(Stri
}
}
- private Collection<TopicPartition> getPartitionsToReset(String
groupId) throws ExecutionException, InterruptedException {
+ private Collection<TopicPartition> getPartitionsToReset(
+ String groupId,
+ Optional<StreamsGroupDescription> description
+ ) throws ExecutionException, InterruptedException {
if (opts.options.has(opts.allInputTopicsOpt)) {
return getInputTopicOffsets(groupId).keySet();
} else if (opts.options.has(opts.inputTopicOpt)) {
Review Comment:
`--all-input-topics` still derives partitions from
`getInputTopicOffsets(groupId).keySet()`, which (via `listStreamsGroupOffsets`)
can omit partitions that have no committed offsets. This can reintroduce the
original problem (new partitions without prior commits won’t be reset) when
users choose `--all-input-topics` instead of `--input-topic`. Consider deriving
the full partition set for all source topics using the Streams topology
(`inputTopics(description)`) plus broker topic metadata (eg `describeTopics`)
to include partitions with no commits.
--
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]