mumrah commented on a change in pull request #10946:
URL: https://github.com/apache/kafka/pull/10946#discussion_r661710692



##########
File path: 
raft/src/main/java/org/apache/kafka/raft/internals/BatchAccumulator.java
##########
@@ -495,6 +506,10 @@ public int sizeInBytes() {
         public void release() {
             pool.release(initialBuffer);
         }
+
+        public long appendTimestamp() {
+            return data.firstBatch().maxTimestamp();

Review comment:
       This will be the timestamp of the first batch in the MemoryRecords. Do 
we assume that only a single batch is included in any given MemoryRecords?

##########
File path: raft/src/main/java/org/apache/kafka/snapshot/SnapshotReader.java
##########
@@ -77,6 +79,18 @@ public int lastContainedLogEpoch() {
         return snapshotId.epoch;
     }
 
+    /**
+     * Returns the timestamp of the last log offset which is represented in 
the snapshot.
+     */
+    public long lastContainedLogTimestamp() {
+        if (!lastContainedLogTimestamp.isPresent()) {
+            // nextBatch is expected to be empty
+            nextBatch = nextBatch();

Review comment:
       Is the whole snapshot written as a single batch? Otherwise, it seems 
like if you open a snapshot for reading and call this method, you'll just get 
the append time of the first batch. 
   
   Or is the idea that this method is called only after the reader has read 
through all the batches?




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