jolshan commented on a change in pull request #9590: URL: https://github.com/apache/kafka/pull/9590#discussion_r622321621
########## File path: clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java ########## @@ -386,6 +390,13 @@ public long maxOffset() { return maxOffset; } + /** + * @return the baseOffset of the first batch of retained records or -1 if no batches are retained + */ + public long baseOffsetOfFirstBatch() { Review comment: In the non-test code, this is only used when we have bytes in the segment (so it will not be -1). In tests, this is sometimes called when the value is -1. I switched to OptionalLong, but we can also switch back. It is a little awkward, since we will need to call get() and there isn't really an alternative if the optional is empty. (I guess we could throw an error) -- 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