jsancio commented on code in PR #13772:
URL: https://github.com/apache/kafka/pull/13772#discussion_r1210417483


##########
raft/src/main/java/org/apache/kafka/snapshot/Snapshots.java:
##########
@@ -151,4 +155,24 @@ public static Path markForDelete(Path logDir, 
OffsetAndEpoch snapshotId) {
             );
         }
     }
+
+    public static long lastContainedLogTimestamp(RawSnapshotReader reader) {
+        try (RecordsSnapshotReader<ByteBuffer> recordsSnapshotReader =
+             RecordsSnapshotReader.of(
+                 reader,
+                 new IdentitySerde(),

Review Comment:
   `RecordSerde` objects are reusable. You can add an `INSTANCE` static field 
to `IndentitySerde` and use it here. Take a look at `MetadataRecordSerde` for 
an example.



##########
core/src/main/scala/kafka/raft/KafkaMetadataLog.scala:
##########
@@ -377,19 +375,7 @@ final class KafkaMetadataLog private (
    */
   private def readSnapshotTimestamp(snapshotId: OffsetAndEpoch): Option[Long] 
= {
     readSnapshot(snapshotId).asScala.map { reader =>
-      val recordsSnapshotReader = RecordsSnapshotReader.of(
-        reader,
-        recordSerde,

Review Comment:
   I think you should be able to remove `recordSerde` from the constructor for 
`KafkaMetadataLog`.



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