KKcorps commented on code in PR #16908:
URL: https://github.com/apache/pinot/pull/16908#discussion_r2382260345


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -517,4 +517,74 @@ private RetentionStrategy 
createUntrackedSegmentsRetentionStrategy(
     }
     return new TimeRetentionStrategy(TimeUnit.DAYS, 
_untrackedSegmentsRetentionTimeInDays);
   }
+
+  @Override
+  public void onChange(Set<String> changedConfigs, Map<String, String> 
clusterConfigs) {
+    if 
(changedConfigs.contains(ControllerConf.ControllerPeriodicTasksConf.ENABLE_UNTRACKED_SEGMENT_DELETION))
 {
+      updateUntrackedSegmentDeletionEnabled(
+          
clusterConfigs.get(ControllerConf.ControllerPeriodicTasksConf.ENABLE_UNTRACKED_SEGMENT_DELETION));
+    }
+
+    if 
(changedConfigs.contains(ControllerConf.ControllerPeriodicTasksConf.UNTRACKED_SEGMENTS_RETENTION_TIME_IN_DAYS))
 {
+      updateUntrackedSegmentsRetentionTimeInDays(
+          
clusterConfigs.get(ControllerConf.ControllerPeriodicTasksConf.UNTRACKED_SEGMENTS_RETENTION_TIME_IN_DAYS));
+    }
+
+    if 
(changedConfigs.contains(ControllerConf.ENABLE_HYBRID_TABLE_RETENTION_STRATEGY))
 {
+      updateHybridTableRetentionStrategyEnabled(
+          
clusterConfigs.get(ControllerConf.ENABLE_HYBRID_TABLE_RETENTION_STRATEGY));
+    }
+  }
+
+  private void updateUntrackedSegmentDeletionEnabled(String newValue) {
+    boolean oldValue = _untrackedSegmentDeletionEnabled;
+    try {
+      boolean parsedValue = Boolean.parseBoolean(newValue);

Review Comment:
   Boolean.parseBoolean simply returns `false` on invalid values instead of 
throwing an exception.
   
   
   ```
       /**
        * Parses the string argument as a boolean.  The {@code boolean}
        * returned represents the value {@code true} if the string argument
        * is not {@code null} and is equal, ignoring case, to the string
        * {@code "true"}.
        * Otherwise, a false value is returned, including for a null
        * argument.<p>
        * Example: {@code Boolean.parseBoolean("True")} returns {@code 
true}.<br>
        * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}.
        *
        * @param      s   the {@code String} containing the boolean
        *                 representation to be parsed
        * @return     the boolean represented by the string argument
        * @since 1.5
        */
       public static boolean parseBoolean(String s) {
           return "true".equalsIgnoreCase(s);
       }
   ```
   
   if you want to retain the existing config on invalid values, you will need 
to handle this differently 
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to