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



##########
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:
       Hmm, can you add a log message here stating that we're going to be 
generating a snapshot, and how many record bytes we had since the last one? 
It's OK to start with INFO for now, I think...




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to