hachikuji commented on a change in pull request #9332:
URL: https://github.com/apache/kafka/pull/9332#discussion_r494494797



##########
File path: raft/src/test/java/org/apache/kafka/raft/MockLogTest.java
##########
@@ -370,6 +365,23 @@ public void testReadOutOfRangeOffset() {
             Isolation.UNCOMMITTED));
     }
 
+    @Test
+    public void testMonotonicEpochStartOffset() {
+        appendBatch(5, 1);
+        assertEquals(5L, log.endOffset().offset);
+
+        log.initializeLeaderEpoch(2);
+        assertEquals(Optional.of(new OffsetAndEpoch(5L, 1)), 
log.endOffsetForEpoch(1));
+        assertEquals(Optional.of(new OffsetAndEpoch(5L, 2)), 
log.endOffsetForEpoch(2));
+
+        // Initialize a new epoch at the same end offset. The epoch cache 
ensures
+        // that the start offset of each retained epoch increases 
monotonically.

Review comment:
       The epoch cache tracks tuples of (epoch, start offset). The start offset 
of a new leader epoch is the current log end offset.




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