Skip to content

Commit

Permalink
chore(proto): permit AlterConfigsRequest 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
  • Loading branch information
dnwe committed Aug 3, 2023
1 parent c4255f4 commit c01e9cf
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 @@ -716,6 +716,9 @@ func (ca *clusterAdmin) AlterConfig(resourceType ConfigResourceType, name string
Resources: resources,
ValidateOnly: validateOnly,
}
if ca.conf.Version.IsAtLeast(V2_0_0_0) {
request.Version = 1
}

var (
b *Broker
Expand Down
11 changes: 9 additions & 2 deletions alter_configs_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,16 @@ func (a *AlterConfigsRequest) headerVersion() int16 {
}

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

func (a *AlterConfigsRequest) requiredVersion() KafkaVersion {
return V0_11_0_0
switch a.Version {
case 1:
return V2_0_0_0
case 0:
return V0_11_0_0
default:
return V2_0_0_0
}
}
11 changes: 9 additions & 2 deletions alter_configs_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,18 @@ func (a *AlterConfigsResponse) headerVersion() int16 {
}

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

func (a *AlterConfigsResponse) requiredVersion() KafkaVersion {
return V0_11_0_0
switch a.Version {
case 1:
return V2_0_0_0
case 0:
return V0_11_0_0
default:
return V2_0_0_0
}
}

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

0 comments on commit c01e9cf

Please sign in to comment.