kamalcph commented on code in PR #15825:
URL: https://github.com/apache/kafka/pull/15825#discussion_r1608831211
##########
core/src/main/scala/kafka/log/LocalLog.scala:
##########
@@ -370,11 +370,17 @@ class LocalLog(@volatile private var _dir: File,
throw new OffsetOutOfRangeException(s"Received request for offset
$startOffset for partition $topicPartition, " +
s"but we only have log segments upto $endOffset.")
- if (startOffset == maxOffsetMetadata.messageOffset)
+ if (startOffset == maxOffsetMetadata.messageOffset) {
emptyFetchDataInfo(maxOffsetMetadata, includeAbortedTxns)
- else if (startOffset > maxOffsetMetadata.messageOffset)
+ } else if (startOffset > maxOffsetMetadata.messageOffset ||
+ maxOffsetMetadata.messageOffsetOnly() ||
+ maxOffsetMetadata.segmentBaseOffset < segmentOpt.get.baseOffset) {
Review Comment:
When applying this change, the newly added
LocalLog#testWhenFetchOffsetHigherThanMaxOffset test fails for the case-3 and
case-4. (ie) Which offset to return back in the FetchDataInfo when the
conditions didn't met?
1. In current approach, the same fetch-offset gets returned back in the
FetchDataInfo
2. In the suggested approach, the next-offset/log-end-offset gets returned
back in the FetchDataInfo
I'm not sure which one is correct. Please suggest. Thanks!
--
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]