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


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -1424,11 +1424,18 @@ class UnifiedLog(@volatile var logStartOffset: Long,
 
   /**
     * Given a message offset, find its corresponding offset metadata in the 
log.
-    * If the message offset is out of range, throw an OffsetOutOfRangeException
+    * 1. If the message offset is lesser than the log-start-offset, then throw 
an OffsetOutOfRangeException

Review Comment:
   > While updating the 
[UnifiedLog#updateLogStartOffset](https://sourcegraph.com/github.com/apache/kafka@5f933ac840343429e911f5706ccb7cd8dc379462/-/blob/core/src/main/scala/kafka/log/UnifiedLog.scala?L535),
 the HWM also gets updated and it doesn't hit the fetchHighWatermarkMetadata 
(or) convertToOffsetMetadataOrThrow so the call will succeed even when 
current-log-start-offset > old-HWM.
   
   For 
[UnifiedLog#updateLogStartOffset](https://sourcegraph.com/github.com/apache/kafka@5f933ac840343429e911f5706ccb7cd8dc379462/-/blob/core/src/main/scala/kafka/log/UnifiedLog.scala?L535),
 I think it's safe we didn't throw exception when `current-log-start-offset > 
old-HWM` because it will be called when initialization or 
`maybeIncrementLogStartOffset`. In the latter, we've checked `newLogStartOffset 
> logStartOffset` already.



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