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


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogConfig.java:
##########
@@ -102,49 +102,14 @@ public String topicWarningMessage(String topicName) {
 
     public static class RemoteLogConfig {
 
-        public final boolean remoteStorageEnable;
+        private final boolean remoteStorageEnable;
+        private final long localRetentionMs;
+        private final long localRetentionBytes;
 
-        public final long localRetentionMs;
-        public final long localRetentionBytes;
-
-        private RemoteLogConfig(LogConfig config, long retentionMs, long 
retentionSize) {
+        private RemoteLogConfig(LogConfig config) {
             this.remoteStorageEnable = 
config.getBoolean(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG);
-
-            long localLogRetentionMs = 
config.getLong(TopicConfig.LOCAL_LOG_RETENTION_MS_CONFIG);
-
-            // -2 indicates to derive value from retentionMs property.
-            if (localLogRetentionMs == -2)
-                this.localRetentionMs = retentionMs;
-            else {
-                // Added validation here to check the effective value should 
not be more than RetentionMs.
-                if (localLogRetentionMs == -1 && retentionMs != -1)
-                    throw new 
ConfigException(TopicConfig.LOCAL_LOG_RETENTION_MS_CONFIG, localLogRetentionMs,
-                        "Value must not be -1 as " + 
TopicConfig.RETENTION_MS_CONFIG + " value is set as " + retentionMs);
-
-                if (localLogRetentionMs > retentionMs)
-                    throw new 
ConfigException(TopicConfig.LOCAL_LOG_RETENTION_MS_CONFIG, localLogRetentionMs,
-                        "Value must not be more than property: " + 
TopicConfig.RETENTION_MS_CONFIG + " value.");
-
-                this.localRetentionMs = localLogRetentionMs;
-            }
-
-            long localLogRetentionBytes = 
config.getLong(TopicConfig.LOCAL_LOG_RETENTION_BYTES_CONFIG);
-
-            // -2 indicates to derive value from retentionSize property.
-            if (localLogRetentionBytes == -2)
-                this.localRetentionBytes = retentionSize;
-            else {
-                // Added validation here to check the effective value should 
not be more than RetentionBytes.
-                if (localLogRetentionBytes == -1 && retentionSize != -1)
-                    throw new 
ConfigException(TopicConfig.LOCAL_LOG_RETENTION_BYTES_CONFIG, 
localLogRetentionBytes,
-                        "Value must not be -1 as " + 
TopicConfig.RETENTION_BYTES_CONFIG + " value is set as " + retentionSize);
-
-                if (localLogRetentionBytes > retentionSize)
-                    throw new 
ConfigException(TopicConfig.LOCAL_LOG_RETENTION_BYTES_CONFIG, 
localLogRetentionBytes,
-                        "Value must not be more than property: " + 
TopicConfig.RETENTION_BYTES_CONFIG + " value.");
-
-                this.localRetentionBytes = localLogRetentionBytes;
-            }
+            this.localRetentionMs = 
config.getLong(TopicConfig.LOCAL_LOG_RETENTION_MS_CONFIG);
+            this.localRetentionBytes = 
config.getLong(TopicConfig.LOCAL_LOG_RETENTION_BYTES_CONFIG);

Review Comment:
   OK, 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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to