jeqo commented on code in PR #13936:
URL: https://github.com/apache/kafka/pull/13936#discussion_r1255748772


##########
storage/api/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogSegmentMetadata.java:
##########
@@ -100,7 +100,16 @@ public RemoteLogSegmentMetadata(RemoteLogSegmentId 
remoteLogSegmentId,
         this.remoteLogSegmentId = Objects.requireNonNull(remoteLogSegmentId, 
"remoteLogSegmentId can not be null");
         this.state = Objects.requireNonNull(state, "state can not be null");
 
+        if (startOffset < 0) {
+            throw new IllegalArgumentException(
+                String.format("Unexpected start offset = %d. StartOffset for a 
remote segment cannot negative", startOffset));
+        }
         this.startOffset = startOffset;
+
+        if (endOffset < 0) {
+            throw new IllegalArgumentException(
+                String.format("Unexpected end offset = %d. EndOffset for a 
remote segment cannot negative", endOffset));
+        }

Review Comment:
   Maybe?
   ```suggestion
           if (endOffset < startOffset) {
               throw new IllegalArgumentException(
                   String.format("Unexpected end offset = %d. EndOffset for a 
remote segment cannot be less than startOffset {}", endOffset, startOffset));
           }
   ```



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

Reply via email to