Skip to content

Commit

Permalink
fix: add retry logic to AlterUserScramCredentials
Browse files Browse the repository at this point in the history
According to KIP-554, the AlterUserScramCredentialsRequest description states:

  It will be will be sent to the controller and will return NOT_CONTROLLER if
  the receiving broker is not the controller.

so this request should handle retries.

Signed-off-by: Mark Hindess <[email protected]>
  • Loading branch information
hindessm authored and dnwe committed Aug 30, 2023
1 parent ae5eee5 commit 87229d9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,12 +1203,16 @@ func (ca *clusterAdmin) AlterUserScramCredentials(u []AlterUserScramCredentialsU
Upsertions: u,
}

b, err := ca.Controller()
if err != nil {
return nil, err
}
var rsp *AlterUserScramCredentialsResponse
err := ca.retryOnError(isErrNoController, func() error {
b, err := ca.Controller()
if err != nil {
return err
}

rsp, err := b.AlterUserScramCredentials(req)
rsp, err = b.AlterUserScramCredentials(req)
return err
})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 87229d9

Please sign in to comment.