Skip to content

Commit

Permalink
fix: use version 4 of DescribeGroupsRequest only if kafka broker vers…
Browse files Browse the repository at this point in the history
…ion is >= 2.4

Fixes #2443
  • Loading branch information
faillefer authored Mar 7, 2023
1 parent 1015b4f commit 7dbf0b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ func (ca *clusterAdmin) DescribeConsumerGroups(groups []string) (result []*Group
describeReq := &DescribeGroupsRequest{
Groups: brokerGroups,
}
if ca.conf.Version.IsAtLeast(V2_3_0_0) {
if ca.conf.Version.IsAtLeast(V2_4_0_0) {
describeReq.Version = 4
}
response, err := broker.DescribeGroups(describeReq)
Expand Down
8 changes: 7 additions & 1 deletion describe_groups_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ func (r *DescribeGroupsRequest) headerVersion() int16 {

func (r *DescribeGroupsRequest) requiredVersion() KafkaVersion {
switch r.Version {
case 1, 2, 3, 4:
case 1:
return V1_1_0_0
case 2:
return V2_0_0_0
case 3:
return V2_3_0_0
case 4:
return V2_4_0_0
}
return V0_9_0_0
}
Expand Down
8 changes: 7 additions & 1 deletion describe_groups_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ func (r *DescribeGroupsResponse) headerVersion() int16 {

func (r *DescribeGroupsResponse) requiredVersion() KafkaVersion {
switch r.Version {
case 1, 2, 3, 4:
case 1:
return V1_1_0_0
case 2:
return V2_0_0_0
case 3:
return V2_3_0_0
case 4:
return V2_4_0_0
}
return V0_9_0_0
}
Expand Down

0 comments on commit 7dbf0b5

Please sign in to comment.