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



##########
File path: 
clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
##########
@@ -664,4 +666,55 @@ private static void writeLeaderChangeMessage(ByteBuffer 
buffer,
         builder.close();
     }
 
+    public static MemoryRecords withSnapshotHeaderRecord(
+            long initialOffset,
+            long timestamp,
+            int leaderEpoch,
+            ByteBuffer buffer,
+            MetadataSnapshotHeaderRecord snapshotHeaderRecord) {
+        writeSnapshotHeaderRecord(buffer, initialOffset, timestamp, 
leaderEpoch, snapshotHeaderRecord);
+        buffer.flip();
+        return MemoryRecords.readableRecords(buffer);
+            }
+
+    private static void writeSnapshotHeaderRecord(ByteBuffer buffer,
+            long initialOffset,
+            long timestamp,
+            int leaderEpoch,
+            MetadataSnapshotHeaderRecord snapshotHeaderRecord) {
+        MemoryRecordsBuilder builder = new MemoryRecordsBuilder(

Review comment:
       Does this need to be wrapped in a try... catch block to avoid leaking 
something if we throw an exception in `appendSnapshotHeaderMessage` ?




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