Skip to content

Commit aad8cf3

Browse files
hindessmdnwe
authored andcommitted
fix: add retry logic to ListPartitionReassignments
Signed-off-by: Mark Hindess <[email protected]>
1 parent 66ef5a9 commit aad8cf3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

admin.go

+13-6
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,20 @@ func (ca *clusterAdmin) ListPartitionReassignments(topic string, partitions []in
556556

557557
request.AddBlock(topic, partitions)
558558

559-
b, err := ca.Controller()
560-
if err != nil {
561-
return nil, err
562-
}
563-
_ = b.Open(ca.client.Config())
559+
var rsp *ListPartitionReassignmentsResponse
560+
err = ca.retryOnError(isErrNoController, func() error {
561+
b, err := ca.Controller()
562+
if err != nil {
563+
return err
564+
}
565+
_ = b.Open(ca.client.Config())
564566

565-
rsp, err := b.ListPartitionReassignments(request)
567+
rsp, err = b.ListPartitionReassignments(request)
568+
if isErrNoController(err) {
569+
_, _ = ca.refreshController()
570+
}
571+
return err
572+
})
566573

567574
if err == nil && rsp != nil {
568575
return rsp.TopicStatus, nil

0 commit comments

Comments
 (0)