Skip to content

Commit

Permalink
chore(proto): permit DeleteGroupsRequest V1
Browse files Browse the repository at this point in the history
This is identical in format to V0, but just influences the broker's response behaviour

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
  • Loading branch information
dnwe committed Aug 3, 2023
1 parent 6010af0 commit 23d4561
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,9 @@ func (ca *clusterAdmin) DeleteConsumerGroup(group string) error {
request := &DeleteGroupsRequest{
Groups: []string{group},
}
if ca.conf.Version.IsAtLeast(V2_0_0_0) {
request.Version = 1
}

resp, err := coordinator.DeleteGroups(request)
if err != nil {
Expand Down
11 changes: 9 additions & 2 deletions delete_groups_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ func (r *DeleteGroupsRequest) headerVersion() int16 {
}

func (r *DeleteGroupsRequest) isValidVersion() bool {
return r.Version == 0
return r.Version >= 0 && r.Version <= 1
}

func (r *DeleteGroupsRequest) requiredVersion() KafkaVersion {
return V1_1_0_0
switch r.Version {
case 1:
return V2_0_0_0
case 0:
return V1_1_0_0
default:
return V2_0_0_0
}
}

func (r *DeleteGroupsRequest) AddGroup(group string) {
Expand Down
11 changes: 9 additions & 2 deletions delete_groups_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,18 @@ func (r *DeleteGroupsResponse) headerVersion() int16 {
}

func (r *DeleteGroupsResponse) isValidVersion() bool {
return r.Version == 0
return r.Version >= 0 && r.Version <= 1
}

func (r *DeleteGroupsResponse) requiredVersion() KafkaVersion {
return V1_1_0_0
switch r.Version {
case 1:
return V2_0_0_0
case 0:
return V1_1_0_0
default:
return V2_0_0_0
}
}

func (r *DeleteGroupsResponse) throttleTime() time.Duration {
Expand Down

0 comments on commit 23d4561

Please sign in to comment.