dajac opened a new pull request, #12734:
URL: https://github.com/apache/kafka/pull/12734

   Fetching from a follower is only allowed from version 11 of the fetch 
request. Our intent was to allow it assuming that those would also implement 
KIP-320 (leader epoch). It turns out that some clients use version 11 without 
KIP-320 and the broker allows this. The issue is that we don't know whether the 
client fetches from the follower based on the order of the leader or by mistake 
e.g. based on stale metadata. The latter means that a client could end up on 
the follower with an offset that the follower does not have yet. Instead of 
returning OffsetOutOfRangeException, we return an empty batch to the client 
with the expectation that the client will retry and eventually refresh its 
metadata. Note that we only do this if the client does not provide a leader 
epoch and use version 11. If the client uses version 11 and provided a leader 
epoch, it knows that it has to consult the leader on an 
OffsetOutOfRangeException error.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to