jeqo commented on code in PR #13561: URL: https://github.com/apache/kafka/pull/13561#discussion_r1300314011
########## core/src/main/java/kafka/log/remote/RemoteLogManager.java: ########## @@ -1096,6 +1493,43 @@ public void close() { } } + // Visible for testing + public static class RetentionSizeData { + private final long retentionSize; + private final long remainingBreachedSize; + + public RetentionSizeData(long retentionSize, long remainingBreachedSize) { + if (retentionSize < 0) + throw new IllegalArgumentException("retentionSize should be non negative, but it is " + retentionSize); + + if (remainingBreachedSize <= 0) { + throw new IllegalArgumentException("remainingBreachedSize should be more than zero, but it is " + remainingBreachedSize); + } + + this.retentionSize = retentionSize; + this.remainingBreachedSize = remainingBreachedSize; + } + } + + // Visible for testing + public static class RetentionTimeData { + + private final long retentionMs; + private final long cleanupUntilMs; + + public RetentionTimeData(long retentionMs, long cleanupUntilMs) { + if (retentionMs < 0) + throw new IllegalArgumentException("retentionMs should be non negative, but it is " + retentionMs); + + if (retentionMs < cleanupUntilMs) { Review Comment: > This check will be true when using system time. Yeah, but the part I'm missing is why should we throw an exception when this is true. If retention is 1 hour, and `cleanupUntil` is at any point in system time, we are throwing an exception. -- 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