You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "9aman (via GitHub)" <gi...@apache.org> on 2025/09/26 12:04:51 UTC

[PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

9aman opened a new pull request, #16908:
URL: https://github.com/apache/pinot/pull/16908

   (no comment)


-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "swaminathanmanish (via GitHub)" <gi...@apache.org>.
swaminathanmanish commented on code in PR #16908:
URL: https://github.com/apache/pinot/pull/16908#discussion_r2387105855


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -79,12 +79,12 @@ public class RetentionManager extends ControllerPeriodicTask<Void> {
   public static final long OLD_LLC_SEGMENTS_RETENTION_IN_MILLIS = TimeUnit.DAYS.toMillis(5L);
   public static final int DEFAULT_UNTRACKED_SEGMENTS_DELETION_BATCH_SIZE = 100;
   private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);
-  private final boolean _untrackedSegmentDeletionEnabled;
-  private final int _untrackedSegmentsRetentionTimeInDays;
+  private boolean _untrackedSegmentDeletionEnabled;

Review Comment:
   Can you make the 3 vars volatile that ensures visibility of changes across threads (



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "noob-se7en (via GitHub)" <gi...@apache.org>.
noob-se7en commented on code in PR #16908:
URL: https://github.com/apache/pinot/pull/16908#discussion_r2387199799


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -79,12 +79,12 @@ public class RetentionManager extends ControllerPeriodicTask<Void> {
   public static final long OLD_LLC_SEGMENTS_RETENTION_IN_MILLIS = TimeUnit.DAYS.toMillis(5L);
   public static final int DEFAULT_UNTRACKED_SEGMENTS_DELETION_BATCH_SIZE = 100;
   private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);
-  private final boolean _untrackedSegmentDeletionEnabled;
-  private final int _untrackedSegmentsRetentionTimeInDays;
+  private boolean _untrackedSegmentDeletionEnabled;

Review Comment:
   +1



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "swaminathanmanish (via GitHub)" <gi...@apache.org>.
swaminathanmanish commented on code in PR #16908:
URL: https://github.com/apache/pinot/pull/16908#discussion_r2387105855


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -79,12 +79,12 @@ public class RetentionManager extends ControllerPeriodicTask<Void> {
   public static final long OLD_LLC_SEGMENTS_RETENTION_IN_MILLIS = TimeUnit.DAYS.toMillis(5L);
   public static final int DEFAULT_UNTRACKED_SEGMENTS_DELETION_BATCH_SIZE = 100;
   private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);
-  private final boolean _untrackedSegmentDeletionEnabled;
-  private final int _untrackedSegmentsRetentionTimeInDays;
+  private boolean _untrackedSegmentDeletionEnabled;

Review Comment:
   Can you make the 3 vars volatile that ensures visibility of changes across threads, since they are updated by one thread and read in another. 



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
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 one, 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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
KKcorps merged PR #16908:
URL: https://github.com/apache/pinot/pull/16908


-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "9aman (via GitHub)" <gi...@apache.org>.
9aman commented on code in PR #16908:
URL: https://github.com/apache/pinot/pull/16908#discussion_r2390906561


##########
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:
   Fixed. 



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -79,12 +79,12 @@ public class RetentionManager extends ControllerPeriodicTask<Void> {
   public static final long OLD_LLC_SEGMENTS_RETENTION_IN_MILLIS = TimeUnit.DAYS.toMillis(5L);
   public static final int DEFAULT_UNTRACKED_SEGMENTS_DELETION_BATCH_SIZE = 100;
   private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);
-  private final boolean _untrackedSegmentDeletionEnabled;
-  private final int _untrackedSegmentsRetentionTimeInDays;
+  private boolean _untrackedSegmentDeletionEnabled;

Review Comment:
   Fixed



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add support for cluster config change listeners for controller periodic tasks. [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16908:
URL: https://github.com/apache/pinot/pull/16908#issuecomment-3351614291

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/16908?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 56.39%. Comparing base ([`d8e4a13`](https://app.codecov.io/gh/apache/pinot/commit/d8e4a13b382e5f064ec12e91338c77d1be70b8c3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5af6a00`](https://app.codecov.io/gh/apache/pinot/commit/5af6a00a9109e00cbae80f4b476292a15a188b83?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   > :exclamation:  There is a different number of reports uploaded between BASE (d8e4a13) and HEAD (5af6a00). Click for more details.
   > 
   > <details><summary>HEAD has 28 uploads less than BASE</summary>
   >
   >| Flag | BASE (d8e4a13) | HEAD (5af6a00) |
   >|------|------|------|
   >|java-21|4|1|
   >|unittests1|2|1|
   >|unittests|3|1|
   >|temurin|8|1|
   >|java-11|4|0|
   >|unittests2|1|0|
   >|integration|5|0|
   >|integration1|2|0|
   >|custom-integration1|2|0|
   >|integration2|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #16908      +/-   ##
   ============================================
   - Coverage     63.50%   56.39%   -7.12%     
   + Complexity     1411      701     -710     
   ============================================
     Files          3073     2407     -666     
     Lines        180721   133871   -46850     
     Branches      27624    21270    -6354     
   ============================================
   - Hits         114771    75493   -39278     
   + Misses        57110    52084    -5026     
   + Partials       8840     6294    -2546     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.39% <ø> (-7.08%)` | :arrow_down: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.39% <ø> (-7.12%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.39% <ø> (-7.12%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.39% <ø> (-0.07%)` | :arrow_down: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/16908/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/16908?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org