Skip to content

Commit

Permalink
kgo: fix batch coordinator fetching
Browse files Browse the repository at this point in the history
v1.10.0 introduced batch coordinator fetching, but had a bug: when
fetching many coordinators in a batch, we would not use the proper
NodeID (we would use the top level NodeID, not the per-coordinator
NodeID).

This worked for non-batch coordinator fetching because we mirrored the
first coordinator to the top level response, if the request/response was
batched.
  • Loading branch information
twmb committed Dec 13, 2022
1 parent c6f7f9a commit ca67da4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/kgo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,12 +1229,12 @@ func (cl *Client) loadCoordinators(ctx context.Context, typ int8, keys ...string
}
}
} else {
resp, _ := shard.Resp.(*kmsg.FindCoordinatorResponse)
resp := shard.Resp.(*kmsg.FindCoordinatorResponse)
for _, rc := range resp.Coordinators {
c, ok := key2load[rc.Key]
if ok {
c.err = kerr.ErrorForCode(rc.ErrorCode)
c.node = resp.NodeID
c.node = rc.NodeID
}
}
}
Expand Down

0 comments on commit ca67da4

Please sign in to comment.