You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Status

Current state: Under discussion

Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]

JIRA: here [Change the link from KAFKA-1 to your own ticket]

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

At the moment, the ListGroups API always returns all groups. There are metrics that track the number of groups in several states but the only way to know the state of a group is to describe it using the DescribeGroups API. In large clusters with hundreds or thousands of groups, it can be hard for a cluster administrator to identify which groups are stable or which groups are dead and can be deleted for example. Basically this requires describing a large number of groups which is inefficiency in terms of time for the administrator and load for the cluster. For example listing stable groups allows to immediately tell if several applications are healthy if their groups are all returned without needing to describe each group. This would allow building tools and user interfaces that can easily and quickly display informations about live groups.

Public Interfaces

ListGroups API, new version 3.

ListGroups Request (Version: 3)
  state => STRING      <-- New field

ListGroups Response (Version: 3) => throttle_time_ms error_code [groups]   <-- Same as V2
  throttle_time_ms => INT32
  error_code => INT16
  groups => group_id protocol_type 
    group_id => STRING
    protocol_type => STRING

The new "state" field could be added as an optional field using KIP-482.

At the moment, consumer group state is already serialized as a STRING in DescribeGroupsResponse. To save a few bytes we could use an ID and update ConsumerGroupState?

To enable this feature in the AdminClient API, ListConsumerGroupsOptions will be updated.

ListConsumerGroupsOptions
public class ListConsumerGroupsOptions extends AbstractOptions<ListConsumerGroupsOptions> {

    /**
     * Only groups in this state will be returned by listConsumerGroups()
     * By default, all groups are returned
     */
    public void withState(String state) {}

    public String getState() {}
}

Proposed Changes

  • Update the ListGroups protocol definition and bump the version to 3
    • A new field "state" is added to the request
    • The response stays the same
    • The broker will only return groups that are in the specified state. If no state is specified, the specified state is unknown, or version < 3, all groups are returned.


  • Update the ListConsumerGroupsOptions object to expose this feature to the AdminClient
    • This allows to user to optionally specify a state groups should be in to be returned by the broker


  • Update the ConsumerGroupCommand tool also will be updated to support filtering by group state
    • A new command line argument "–state STATE" enables users to specify a state. This new option will only be valid when used with "--list".


Compatibility, Deprecation, and Migration Plan

The default behaviour of ListGroups will stay the same and it will still list all groups if no state is specified.

There should be no compatibility issues, nothing to deprecate or migrate.

Rejected Alternatives

  • Allow specifying a filter in ListGroups to retrieve groups by name or by state using wildcard
    • Unclear if it's a common use case
  • Allow specifying multiple states to retrieve groups in any of the provided state
    • The current response only contains the names, so if multiple states are provided, we don't know which state each group is in
  • No labels