You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/04/04 11:22:02 UTC
[GitHub] [kafka] dajac commented on a diff in pull request #11965: KAFKA-13778: Fetch from follower should never run the preferred read replica selection
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org