kafka/core
bozhao12 db2485cb59
KAFKA-13767; Fetch from consumers should return immediately when preferred read replica is defined by the leader (#11942)
When a replica selector is configured, the partition leader computes a preferred read replica for any fetch from the consumers. When the preferred read replica is not the leader, the leader returns the preferred read replica with `FetchDataInfo(LogOffsetMetadata.UnknownOffsetMetadata, MemoryRecords.EMPTY)` to the `ReplicaManager`. This causes the fetch to go into in the fetch purgatory because the exit conditions are not met. In turns out that the delayed fetch is not completed until the timeout is reached because the delayed fetch ignores partition with an unknown offset (-1). If the fetch contains only one partition, the fetch is unnecessarily delayed by the timeout time (500ms by default) to only inform the consumer that it has to read from a follower.

This patch fixes the issue by completing the fetch request immediately when a preferred read replica is defined.

Reviewers: David Jacot <djacot@confluent.io>
2022-03-29 10:13:05 +02:00
..
src KAFKA-13767; Fetch from consumers should return immediately when preferred read replica is defined by the leader (#11942) 2022-03-29 10:13:05 +02:00
.gitignore