kafka
kafka copied to clipboard
KAFKA-14255: Fetching from follower should be disallowed if fetch from follower is disabled
There are clients out there that have implemented KIP-392 (Fetch From Follower) and thus use FetchRequest >= 11. However, they have not implemented KIP-320 which add the leader epoch to the FetchRequest in version 9. Without KIP-320, it is not safe to fetch from the follower. If a client does it by mistake – e.g. based on stale metadata – that could lead to offset out of range.
This patch proposes to disable fetching from a follower when the cluster does not have a replica selector. If it does not, consumers are not expected to fetch from followers.
Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)