Skip to content

Commit

Permalink
fix: add retry logic to ListPartitionReassignments
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hindess <[email protected]>
Signed-off-by: Ioan Zicu <[email protected]>
  • Loading branch information
hindessm authored and Ioan Zicu committed Jul 31, 2023
1 parent 1f0190f commit cb2e368
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,20 @@ func (ca *clusterAdmin) ListPartitionReassignments(topic string, partitions []in

request.AddBlock(topic, partitions)

b, err := ca.Controller()
if err != nil {
return nil, err
}
_ = b.Open(ca.client.Config())
var rsp *ListPartitionReassignmentsResponse
err = ca.retryOnError(isErrNoController, func() error {
b, err := ca.Controller()
if err != nil {
return err
}
_ = b.Open(ca.client.Config())

rsp, err := b.ListPartitionReassignments(request)
rsp, err = b.ListPartitionReassignments(request)
if isErrNoController(err) {
_, _ = ca.refreshController()
}
return err
})

if err == nil && rsp != nil {
return rsp.TopicStatus, nil
Expand Down

0 comments on commit cb2e368

Please sign in to comment.