jsancio commented on a change in pull request #10899:
URL: https://github.com/apache/kafka/pull/10899#discussion_r655550695



##########
File path: raft/src/main/java/org/apache/kafka/snapshot/SnapshotWriter.java
##########
@@ -135,9 +210,12 @@ public void append(List<T> records) {
 
     /**
      * Freezes the snapshot by flushing all pending writes and marking it as 
immutable.
+     *
+     * Also adds a {@link MetadataSnapshotFooterRecord} to the end of the 
snapshot
      */
     public void freeze() {
         appendBatches(accumulator.drain());
+        finalizeSnapshotWithFooter();

Review comment:
       When `freeze` is called it is possible that the `accumulator` has 
batches. When freezing the `SnapshotWriter`, it needs to:
   1. Add the footer batch to the accumulator
   2. Drain any pending batches in the accumulator including the control batch 
appended in 1.
   3. Append those batches to the underlying `RawSnapshotWriter`.




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