nileshkumar3 commented on code in PR #23780:
URL: https://github.com/apache/kafka/pull/23780#discussion_r4437129460


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/UnifiedLog.java:
##########
@@ -1812,12 +1828,36 @@ public boolean isEmpty() {
         return logStartOffset == logEndOffset();
     }
 
-    private Optional<FileRecords.TimestampAndOffset> 
searchOffsetInLocalLog(long targetTimestamp, long startOffset) throws 
IOException {
+    /**
+     * Largest timestamp among records with offset strictly less than {@code 
exclusiveEndOffset}.
+     * Segments that end before the bound contribute their full max. The 
segment that contains the bound
+     * contributes only the prefix below it, so a later uncommitted timestamp 
cannot hide an earlier one.
+     */
+    private Optional<FileRecords.TimestampAndOffset> maxTimestampBelow(long 
exclusiveEndOffset) throws IOException {

Review Comment:
    Done. Cached max timestamps are compared, and only the winning segment and 
the segment containing the bound are read.



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