kamalcph commented on code in PR #15825:
URL: https://github.com/apache/kafka/pull/15825#discussion_r1610404165


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java:
##########
@@ -445,7 +445,7 @@ public FetchDataInfo read(long startOffset, int maxSize, 
long maxPosition, boole
             adjustedMaxSize = Math.max(maxSize, startOffsetAndSize.size);
 
         // return a log segment but with zero size in the case below
-        if (adjustedMaxSize == 0)
+        if (adjustedMaxSize == 0 || maxPosition == -1)

Review Comment:
   LogSegment is in Java and using Optional as a method parameter in 
LogSegment#read shows warnings in the intelliJ and require some refactoring, so 
went with the negative value approach:
   
   ```
   'Optional<Long>' used as type for parameter 'maxPosition' 
   ```



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