ashmeet13 commented on code in PR #12414:
URL: https://github.com/apache/kafka/pull/12414#discussion_r933081305


##########
core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala:
##########
@@ -119,16 +119,24 @@ class BrokerMetadataListener(
       }
 
       _bytesSinceLastSnapshot = _bytesSinceLastSnapshot + results.numBytes
-      if (shouldSnapshot()) {
-        maybeStartSnapshot()
+      
+      val shouldTakeSnapshot: Option[String] = shouldSnapshot()
+      if (shouldTakeSnapshot.isDefined) {
+        maybeStartSnapshot(shouldTakeSnapshot.get)
       }
 
       _publisher.foreach(publish)
     }
   }
 
-  private def shouldSnapshot(): Boolean = {
-    (_bytesSinceLastSnapshot >= maxBytesBetweenSnapshots) || 
metadataVersionChanged()
+  private def shouldSnapshot(): Option[String] = {
+    if (_bytesSinceLastSnapshot >= maxBytesBetweenSnapshots) {

Review Comment:
   Makes sense, I wasn't sure whether this scenario was possible or not. 
Haven't dug deep yet. Should've clarified this before, my bad.
   
   Have made the changes to accommodate this.  



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

Reply via email to