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/03/24 10:10:06 UTC
[GitHub] [kafka] dajac commented on a change in pull request #11942: KAFKA-13767: Fetch response did not need delay return when the preferred read replica not local replica
dajac commented on a change in pull request #11942:
URL: https://github.com/apache/kafka/pull/11942#discussion_r834125268
##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1037,6 +1038,8 @@ class ReplicaManager(val config: KafkaConfig,
errorReadingData = true
if (logReadResult.divergingEpoch.nonEmpty)
hasDivergingEpoch = true
+ if (logReadResult.preferredReadReplica.getOrElse(config.brokerId) != config.brokerId)
Review comment:
I think that we could use `logReadResult.preferredReadReplica.nonEmpty` because it is only set when a follower as been selected.
##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1046,7 +1049,9 @@ class ReplicaManager(val config: KafkaConfig,
// 3) has enough data to respond
// 4) some error happens while reading data
// 5) we found a diverging epoch
- if (timeout <= 0 || fetchInfos.isEmpty || bytesReadable >= fetchMinBytes || errorReadingData || hasDivergingEpoch) {
+ // 6) the preferred read replica not local replica
Review comment:
nit: `has a preferred read replica`?
##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1028,6 +1028,7 @@ class ReplicaManager(val config: KafkaConfig,
var bytesReadable: Long = 0
var errorReadingData = false
var hasDivergingEpoch = false
+ var notLocalPreferredReadReplica = false
Review comment:
nit: `hasPreferredReadReplica` might be a better name. What do you think?
--
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