jsancio commented on a change in pull request #10786:
URL: https://github.com/apache/kafka/pull/10786#discussion_r647596275



##########
File path: core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
##########
@@ -247,6 +247,34 @@ final class KafkaMetadataLog private (
     FileRawSnapshotWriter.create(log.dir.toPath, snapshotId, Optional.of(this))
   }
 
+  override def createSnapshotFromEndOffset(endOffset: Long): RawSnapshotWriter 
= {
+    val highWatermarkOffset = highWatermark.offset
+    if (endOffset > highWatermarkOffset) {
+      throw new IllegalArgumentException(
+        s"Cannot create a snapshot for an end offset ($endOffset) greater than 
the high-watermark ($highWatermarkOffset)"
+      )
+    }
+
+    if (endOffset < startOffset) {
+      throw new IllegalArgumentException(
+        s"Cannot create a snapshot for an end offset ($endOffset) less or 
equal to the log start offset ($startOffset)"

Review comment:
       Fixed as part of the merge commit.




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


Reply via email to