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


##########
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:
   I think it's possible that both these 2 conditions are satisfied at the same 
time, right? so maybe we should have another condition: "max bytes exceeded and 
metadata version changed", WDYT?



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