-
Notifications
You must be signed in to change notification settings - Fork 14.3k
KAFKA-17897: Deprecate Admin.listConsumerGroups [2/N] #19508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndrewJSchofield Thanks for the PR. I have a question about last change (#19477) of Jira (KAFKA-17897). In KIP-1043, it mentioned kafka-consumer-groups.sh
gives an error message when a group is not a consumer group. However, it can be used to list share / stream groups like:
./bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list --type classic,consumer,share,streams
Do we want to have an error message for this case? Thanks.

@FrankYang0529 That's an interesting point. I'll put in a change to |
|
||
// If only regular consumer group types are required, we can try an earlier request version if | ||
// UnsupportedVersionException is thrown | ||
final boolean canTryEarlierRequestVersion = options.regularConsumerGroupTypes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of re-sending the request, maybe we can modify the request (ListGroupsRequest.Builder#build) when the version is small than v5?
if (!data.typesFilter().isEmpty() && version < 5) {
var copy = new HashSet<>(data.typesFilter());
copy.remove(GroupType.CLASSIC.toString());
copy.remove(GroupType.CONSUMER.toString());
if (!copy.isEmpty())
throw new UnsupportedVersionException("The broker only supports ListGroups v" + version + ", but we need v5 or newer to request groups by type.");
return new ListGroupsRequest(data.duplicate().setTypesFilter(List.of()), version);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've taken this suggestion and tweaked it a bit.
Admin.listConsumerGroups() was able to use the early versions of
ListGroups RPC with the version used dependent upon the filters the user
specified. Admin.listGroups(ListGroupsOptions.forConsumerGroups())
inadvertently required ListGroups v5 because it always set a types
filter. This patch handles the UnsupportedVersionException and winds
back the complexity of the request unless the user has specified filters
which demand a higher version.
It also adds ListGroupsOptions.forShareGroups() and forStreamsGroups().
The usability of Admin.listGroups() is much improved as a result.