Current state: "Under Discussion"
Discussion thread: here
Vote thread: "Will update after discussion"
JIRA: KAFKA-19784
PR: https://github.com/apache/kafka/pull/20691
Apache Kafka supports rack-aware partition assignment to improve fault tolerance and reduce cross-rack network traffic/cost. However, the current Admin API does not expose rack information for all type of consumer group members, despite this information being available at the protocol level.
The ConsumerGroupDescribeResponse (API Key 69) protocol includes a rackId field for each group member, as defined in the protocol specification:
{ "name": "RackId", "type": "string", "versions": "0+",
"nullableVersions": "0+", "default": "null",
"about": "The member rack ID." }
However, when users call AdminClient.describeConsumerGroups(), the returned MemberDescription objects do not include this rack information. The rack ID is available in the wire protocol but is discarded during response processing in DescribeConsumerGroupsHandler.
The Similar case is for AdminClient.describeShareGroups():
Class | Type of Group | contain RackId? | protocoal response contain rackId? |
MemberDescription | Consumer Group | ❌ | ✅ 是 |
ShareMemberDescription | Share Group | ❌ | ✅ 是 |
StreamsGroupMemberDescription | Streams Group | ✅ | ✅ 是 |
This limitation creates several issues:
Inconsistency: Other group types expose rack information:
StreamsGroupMemberDescription includes rackId() methodTake one example: currently we have to implemen our AZ/Rack analysis using a workaround — passing the rack information into the clientId field and parsing it afterward.
kafkaConsumerConfig.customConfig(ConsumerConfig.CLIENT_ID_CONFIG, generateClientIdWithRack(ip, rack));

We need to do tiny change for the existed public class:
1. Add rack ID support to org.apache.kafka.clients.admin.MemberDescription:
public class MemberDescription {
private final String memberId;
private final Optional<String> groupInstanceId;
private final Optional<String> rackId; // NEW FIELD
private final String clientId;
//omit other codes
}
|
2. Add rack ID support to org.apache.kafka.clients.admin.MemberDescription:
public class ShareMemberDescription{
private final String memberId;
private final Optional<String> rackId; // NEW FIELD
private final String clientId;
//omit other codes
}
|
You can refer to https://github.com/apache/kafka/pull/20691:
This change is fully backward compatible:
Binary Compatibility:
@Deprecated)empty()Source Compatibility:
Behavioral Compatibility:
For users upgrading:
memberDescription.rackId() when neededFor developers using MemberDescription:
@Deprecated immediatelyWe can use follow test to cover the change:
describeConsumerGroupsWithRack() method