jsancio commented on a change in pull request #10812: URL: https://github.com/apache/kafka/pull/10812#discussion_r659091444
########## File path: core/src/main/scala/kafka/server/KafkaConfig.scala ########## @@ -374,6 +375,7 @@ object KafkaConfig { val BrokerSessionTimeoutMsProp = "broker.session.timeout.ms" val NodeIdProp = "node.id" val MetadataLogDirProp = "metadata.log.dir" + val MetadataSnapshotMinNewRecordBytesProp = "metadata.log.snapshot.min.new_record.bytes" Review comment: I took your suggestion. ########## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ########## @@ -877,6 +880,35 @@ private void replay(ApiMessage message, Optional<OffsetAndEpoch> snapshotId, lon } } + private void checkSnapshotGeneration(long batchSizeInBytes) { + newBytesSinceLastSnapshot += batchSizeInBytes; + if (newBytesSinceLastSnapshot >= snapshotMinNewRecordBytes && + snapshotGeneratorManager.generator == null + ) { + boolean isActiveController = curClaimEpoch != -1; + if (!isActiveController) { + // The active controller creates in-memory snapshot every time an uncommitted + // batch gets appended. The in-active controller can be more efficient and only + // create an in-memory snapshot when needed. + snapshotRegistry.createSnapshot(lastCommittedOffset); + } + Review comment: Done. ########## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ########## @@ -877,6 +880,35 @@ private void replay(ApiMessage message, Optional<OffsetAndEpoch> snapshotId, lon } } + private void checkSnapshotGeneration(long batchSizeInBytes) { + newBytesSinceLastSnapshot += batchSizeInBytes; + if (newBytesSinceLastSnapshot >= snapshotMinNewRecordBytes && + snapshotGeneratorManager.generator == null + ) { + boolean isActiveController = curClaimEpoch != -1; + if (!isActiveController) { + // The active controller creates in-memory snapshot every time an uncommitted + // batch gets appended. The in-active controller can be more efficient and only + // create an in-memory snapshot when needed. + snapshotRegistry.createSnapshot(lastCommittedOffset); + } + + snapshotGeneratorManager.createSnapshotGenerator(lastCommittedOffset, lastCommittedEpoch); + newBytesSinceLastSnapshot = 0; + } + } + + private void resetState() { Review comment: Done. -- 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