[ https://issues.apache.org/jira/browse/KAFKA-13767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
zhaobo updated KAFKA-13767: --------------------------- External issue URL: (was: https://github.com/apache/kafka/pull/11942) Description: {code:java} def readFromLocalLog() ... if (preferredReadReplica.isDefined) { .... // If a preferred read-replica is set, skip the read val offsetSnapshot = partition.fetchOffsetSnapshot(fetchInfo.currentLeaderEpoch, fetchOnlyFromLeader = false) LogReadResult(info = FetchDataInfo(LogOffsetMetadata.UnknownOffsetMetadata, MemoryRecords.EMPTY), divergingEpoch = None, .... } {code} when a preferred read-replica is set, skip the read ,return empty data. The fetch request maybe put into the delayFetchQueue and repeat execute the readFromLocalLog() . It might be better to return the response right away. was: {code:java} def readFromLocalLog() ... if (preferredReadReplica.isDefined) { .... // If a preferred read-replica is set, skip the read val offsetSnapshot = partition.fetchOffsetSnapshot(fetchInfo.currentLeaderEpoch, fetchOnlyFromLeader = false) LogReadResult(info = FetchDataInfo(LogOffsetMetadata.UnknownOffsetMetadata, MemoryRecords.EMPTY), divergingEpoch = None, .... } {code} when a preferred read-replica is set, skip the read ,return empty data. The fetch request maybe put into the delayFetchQueue. It might be better to return the response right away > consumer fetch request does not need to put to delayFetch queue when the > preferred read replica not local > ----------------------------------------------------------------------------------------------------------- > > Key: KAFKA-13767 > URL: https://issues.apache.org/jira/browse/KAFKA-13767 > Project: Kafka > Issue Type: Improvement > Components: core > Affects Versions: 3.2.0 > Reporter: zhaobo > Priority: Minor > Fix For: 3.2.0 > > > > {code:java} > def readFromLocalLog() > ... > if (preferredReadReplica.isDefined) { > .... > // If a preferred read-replica is set, skip the read > val offsetSnapshot = > partition.fetchOffsetSnapshot(fetchInfo.currentLeaderEpoch, > fetchOnlyFromLeader = false) > LogReadResult(info = FetchDataInfo(LogOffsetMetadata.UnknownOffsetMetadata, > MemoryRecords.EMPTY), > divergingEpoch = None, > .... > } {code} > > when a preferred read-replica is set, skip the read ,return empty data. The > fetch request maybe put into the delayFetchQueue and repeat execute the > readFromLocalLog() . It might be better to return the response right away. -- This message was sent by Atlassian Jira (v8.20.1#820001)