From 7dbf0b5d85538641227a30a281f1a54e18a94cb7 Mon Sep 17 00:00:00 2001 From: faillefer <23032941+faillefer@users.noreply.github.com> Date: Tue, 7 Mar 2023 22:49:17 +0100 Subject: [PATCH] fix: use version 4 of DescribeGroupsRequest only if kafka broker version is >= 2.4 Fixes #2443 --- admin.go | 2 +- describe_groups_request.go | 8 +++++++- describe_groups_response.go | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/admin.go b/admin.go index a334daff5..f5d1427a0 100644 --- a/admin.go +++ b/admin.go @@ -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) diff --git a/describe_groups_request.go b/describe_groups_request.go index f81f69ac4..fc8e6b588 100644 --- a/describe_groups_request.go +++ b/describe_groups_request.go @@ -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 } diff --git a/describe_groups_response.go b/describe_groups_response.go index 09052e431..12bf93e15 100644 --- a/describe_groups_response.go +++ b/describe_groups_response.go @@ -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 }