[ https://issues.apache.org/jira/browse/KAFKA-13767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
zhaobo updated KAFKA-13767: --------------------------- Summary: Fetch request does not need to put into delayFetch queue when preferred read replica not local replica (was: Consumer fetch request does not need to put into delayFetch queue when the preferred read replica not local replica) > Fetch request does not need to put into delayFetch queue when preferred read > replica not local replica > ------------------------------------------------------------------------------------------------------ > > 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)