cmccabe commented on a change in pull request #10812:
URL: https://github.com/apache/kafka/pull/10812#discussion_r661825135



##########
File path: 
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java
##########
@@ -877,6 +880,39 @@ private void replay(ApiMessage message, 
Optional<OffsetAndEpoch> snapshotId, lon
         }
     }
 
+    private void checkSnapshotGeneration(long batchSizeInBytes) {
+        newBytesSinceLastSnapshot += batchSizeInBytes;
+        if (newBytesSinceLastSnapshot >= snapshotMaxNewRecordBytes &&
+            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);
+            }
+
+            log.info(
+                "Generating a snapshot that includes (epoch={}, offset={}) 
after {} committed bytes since the last snapshot.",

Review comment:
       Thanks for adding the log message. Spacing seems a bit weird (can we not 
have "log.info" on its own line?)




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