ashmeet13 commented on code in PR #12414: URL: https://github.com/apache/kafka/pull/12414#discussion_r960901730
########## core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala: ########## @@ -119,16 +120,29 @@ class BrokerMetadataListener( } _bytesSinceLastSnapshot = _bytesSinceLastSnapshot + results.numBytes - if (shouldSnapshot()) { - maybeStartSnapshot() + + val shouldTakeSnapshot: Set[SnapshotReason] = shouldSnapshot() + if (shouldTakeSnapshot.nonEmpty) { + maybeStartSnapshot(shouldTakeSnapshot) } _publisher.foreach(publish) } } - private def shouldSnapshot(): Boolean = { - (_bytesSinceLastSnapshot >= maxBytesBetweenSnapshots) || metadataVersionChanged() + private def shouldSnapshot(): Set[SnapshotReason] = { + val metadataVersionHasChanged: Boolean = metadataVersionChanged() + val maxBytesHaveExceeded: Boolean = (_bytesSinceLastSnapshot >= maxBytesBetweenSnapshots) Review Comment: Removed the type declaration -- 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