ijuma commented on a change in pull request #4204:
URL: https://github.com/apache/kafka/pull/4204#discussion_r418680839



##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1035,11 +1035,13 @@ class ReplicaManager(val config: KafkaConfig,
       val partitionFetchSize = fetchInfo.maxBytes
       val followerLogStartOffset = fetchInfo.logStartOffset
 
-      brokerTopicStats.topicStats(tp.topic).totalFetchRequestRate.mark()
-      brokerTopicStats.allTopicsStats.totalFetchRequestRate.mark()
-
       val adjustedMaxBytes = math.min(fetchInfo.maxBytes, limitBytes)
       try {
+        brokerTopicStats.allTopicsStats.totalFetchRequestRate.mark()
+        if (allPartitions.contains(tp)) {

Review comment:
       Yeah, this is the reason this PR got stuck a bit. @rajinisivaram had 
said:
   
   >I had a look through the code and I think it should be possible to close 
the timing window altogether by creating metrics within one of the existing 
locks (locking should be required only when metrics for the topic is not 
available). I am not sure if it is worth the additional complexity.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to