dajac commented on code in PR #11965: URL: https://github.com/apache/kafka/pull/11965#discussion_r841628203
########## core/src/main/scala/kafka/server/ReplicaManager.scala: ########## @@ -1234,8 +1234,9 @@ class ReplicaManager(val config: KafkaConfig, fetchOffset: Long, currentTimeMs: Long): Option[Int] = { partition.leaderReplicaIdOpt.flatMap { leaderReplicaId => - // Don't look up preferred for follower fetches via normal replication - if (Request.isValidBrokerId(replicaId)) + // Don't look up preferred for follower fetches via normal replication and + // don't look up preferred read replica while fetch from follower replica + if (Request.isValidBrokerId(replicaId) || partition.leaderIdIfLocal.isEmpty) Review Comment: It would be better to directly use `leaderIdIfLocal` at L1236: `partition.leaderIdIfLocal.flatMap { leaderReplicaId =>`. -- 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