AndrewJSchofield commented on code in PR #20708:
URL: https://github.com/apache/kafka/pull/20708#discussion_r2436931875
##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ShareGroupCommand.java:
##########
@@ -385,10 +386,25 @@ void resetOffsets() {
if
(!(GroupState.EMPTY.equals(shareGroupDescription.groupState()) ||
GroupState.DEAD.equals(shareGroupDescription.groupState()))) {
CommandLineUtils.printErrorAndExit(String.format("Share
group '%s' is not empty.", groupId));
}
- Map<TopicPartition, OffsetAndMetadata> offsetsToReset =
prepareOffsetsToReset(groupId);
- if (offsetsToReset == null) {
- return;
+ resetOffsetsForInactiveGroup(groupId);
+ } catch (InterruptedException ie) {
+ throw new RuntimeException(ie);
+ } catch (ExecutionException ee) {
+ Throwable cause = ee.getCause();
+ if (cause instanceof GroupIdNotFoundException) {
+ resetOffsetsForInactiveGroup(groupId);
Review Comment:
It's because if you do the operation on a non-existent group, it creates the
group (which is by definition empty) and then resets the offsets. I know this
is a bit weird, but if you want to initialise the group in a particular state
before starting any consumers, this is how you would do 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]