Closed soundvibe closed 3 weeks ago
The area of the code that handles KIP-392 is no different between the group consumer and the direct consumer. The group consumer, in a way, is a layer on top of the direct consumer (managing the directness).
KIP-392 is opted into via the Rack
option, and that's it.
Do you have logs of this failing to not happen on the direct consumer, but happening on the group consumer? The most recent release contains a log line that shows when preferred replica application is happening: https://github.com/twmb/franz-go/commit/cda897d
Yes, I'm getting fetch partitions returned preferred replicas
in the logs when using group consumer but this isn't logged when using direct consumer.
After digging deeper it seems that rack awareness works with direct consumer when offsets are set using NewOffset()
. Previously, I was setting offsets which were fetched using admin package, so I guess they had some internal state about which broker to use.
Fetching from closest replicas doesn't work when using direct consumer (via
kgo.ConsumePartitions()
). This works when switching to group consumer but using it isn't convenient and practical for some use cases when static membership is needed.