From 33e005994debd26ea245a16137e0b9e1af57a22c Mon Sep 17 00:00:00 2001 From: lambdaliu Date: Fri, 1 Mar 2019 05:43:09 +0800 Subject: [PATCH] MINOR: Skip quota check when replica is in sync (#6344) Reviewers: Jason Gustafson --- core/src/main/scala/kafka/server/ReplicaFetcherThread.scala | 2 +- core/src/main/scala/kafka/server/ReplicaManager.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala b/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala index 64ae71e35f0..d1659c85525 100644 --- a/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala +++ b/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala @@ -328,7 +328,7 @@ class ReplicaFetcherThread(name: String, */ private def shouldFollowerThrottle(quota: ReplicaQuota, topicPartition: TopicPartition): Boolean = { val isReplicaInSync = fetcherLagStats.isReplicaInSync(topicPartition) - quota.isThrottled(topicPartition) && quota.isQuotaExceeded && !isReplicaInSync + !isReplicaInSync && quota.isThrottled(topicPartition) && quota.isQuotaExceeded } } diff --git a/core/src/main/scala/kafka/server/ReplicaManager.scala b/core/src/main/scala/kafka/server/ReplicaManager.scala index 6142c24943d..3e7d7bb5e1e 100644 --- a/core/src/main/scala/kafka/server/ReplicaManager.scala +++ b/core/src/main/scala/kafka/server/ReplicaManager.scala @@ -1007,7 +1007,7 @@ class ReplicaManager(val config: KafkaConfig, val isReplicaInSync = nonOfflinePartition(topicPartition).exists { partition => partition.getReplica(replicaId).exists(partition.inSyncReplicas.contains) } - quota.isThrottled(topicPartition) && quota.isQuotaExceeded && !isReplicaInSync + !isReplicaInSync && quota.isThrottled(topicPartition) && quota.isQuotaExceeded } def getLogConfig(topicPartition: TopicPartition): Option[LogConfig] = localReplica(topicPartition).flatMap(_.log.map(_.config))