satishd commented on code in PR #16237:
URL: https://github.com/apache/kafka/pull/16237#discussion_r1635802677


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -912,10 +911,8 @@ class RemoteLogRetentionHandler {
 
             private final Optional<RetentionSizeData> retentionSizeData;
             private final Optional<RetentionTimeData> retentionTimeData;
-
             private long remainingBreachedSize;
-
-            private OptionalLong logStartOffset = OptionalLong.empty();
+            private Optional<Long> logStartOffset = Optional.empty();

Review Comment:
   We can continue using `OptionalLong` as discussed offline as it has the 
required methods.



##########
core/src/test/java/kafka/log/remote/RemoteLogManagerTest.java:
##########
@@ -2038,6 +2038,69 @@ public void testDeletionOnRetentionBreachedSegments(long 
retentionSize,
         assertEquals(0, 
brokerTopicStats.allTopicsStats().failedRemoteDeleteRequestRate().count());
     }
 
+    @ParameterizedTest(name = 
"testDeletionOnOverlappingRetentionBreachedSegments retentionSize={0} 
retentionMs={1}")
+    @CsvSource(value = {"0, -1", "-1, 0"})
+    public void testDeletionOnOverlappingRetentionBreachedSegments(long 
retentionSize,
+                                                                   long 
retentionMs)
+            throws RemoteStorageException, ExecutionException, 
InterruptedException {
+        Map<String, Long> logProps = new HashMap<>();
+        logProps.put("retention.bytes", retentionSize);
+        logProps.put("retention.ms", retentionMs);
+        LogConfig mockLogConfig = new LogConfig(logProps);
+        when(mockLog.config()).thenReturn(mockLogConfig);
+
+        List<EpochEntry> epochEntries = Collections.singletonList(epochEntry0);
+        checkpoint.write(epochEntries);
+        LeaderEpochFileCache cache = new LeaderEpochFileCache(tp, checkpoint, 
scheduler);
+        when(mockLog.leaderEpochCache()).thenReturn(Option.apply(cache));
+
+        
when(mockLog.topicPartition()).thenReturn(leaderTopicIdPartition.topicPartition());
+        when(mockLog.logEndOffset()).thenReturn(200L);
+
+        RemoteLogSegmentMetadata metadata1 = 
listRemoteLogSegmentMetadata(leaderTopicIdPartition, 1, 100, 1024,
+                epochEntries, RemoteLogSegmentState.COPY_SEGMENT_FINISHED)
+                .get(0);
+        // overlapping segment

Review Comment:
   Please describe the test case in detail about the overlapping segment and 
how the duplicate entry with the earlier endoffset will not move the 
log-start-offset backwards.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to