This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 8dec9686d78 [cleanup] Remove ControllerConf config keys deprecated
since 0.8.0
8dec9686d78 is described below
commit 8dec9686d783b76e2899ac76a91df31acc8e1765
Author: Xiang Fu <[email protected]>
AuthorDate: Fri Mar 27 18:03:36 2026 -0700
[cleanup] Remove ControllerConf config keys deprecated since 0.8.0
Auto-merged: LOW risk cleanup PR with all CI checks passed and maintainer
approval.
---
.../apache/pinot/controller/ControllerConf.java | 383 +++++++++------------
.../pinot/controller/ControllerConfTest.java | 124 +------
.../apache/pinot/tools/utils/PinotConfigUtils.java | 8 +-
3 files changed, 182 insertions(+), 333 deletions(-)
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
index f6dc9edbfa7..4449e16e50e 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
@@ -104,21 +104,9 @@ public class ControllerConf extends PinotConfiguration {
public static class ControllerPeriodicTasksConf {
// frequency configs
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_RETENTION_MANAGER_FREQUENCY_IN_SECONDS =
- "controller.retention.frequencyInSeconds";
public static final String RETENTION_MANAGER_FREQUENCY_PERIOD =
"controller.retention.frequencyPeriod";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS =
- "controller.offline.segment.interval.checker.frequencyInSeconds";
public static final String
OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD =
"controller.offline.segment.interval.checker.frequencyPeriod";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS =
- "controller.realtime.segment.validation.frequencyInSeconds";
public static final String REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD =
"controller.realtime.segment.validation.frequencyPeriod";
public static final String
REALTIME_SEGMENT_VALIDATION_INITIAL_DELAY_IN_SECONDS =
@@ -129,28 +117,13 @@ public class ControllerConf extends PinotConfiguration {
"controller.realtime.offsetAutoReset.backfill.frequencyPeriod";
public static final String
REALTIME_OFFSET_AUTO_RESET_BACKFILL_INITIAL_DELAY_IN_SECONDS =
"controller.realtime.offsetAutoReset.backfill.initialDelayInSeconds";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS =
- "controller.broker.resource.validation.frequencyInSeconds";
public static final String BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD =
"controller.broker.resource.validation.frequencyPeriod";
public static final String
BROKER_RESOURCE_VALIDATION_INITIAL_DELAY_IN_SECONDS =
"controller.broker.resource.validation.initialDelayInSeconds";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String DEPRECATED_STATUS_CHECKER_FREQUENCY_IN_SECONDS =
- "controller.statuschecker.frequencyInSeconds";
public static final String STATUS_CHECKER_FREQUENCY_PERIOD =
"controller.statuschecker.frequencyPeriod";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_STATUS_CHECKER_WAIT_FOR_PUSH_TIME_IN_SECONDS =
- "controller.statuschecker.waitForPushTimeInSeconds";
public static final String STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD =
"controller.statuschecker.waitForPushTimePeriod";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String DEPRECATED_TASK_MANAGER_FREQUENCY_IN_SECONDS =
"controller.task.frequencyInSeconds";
public static final String TASK_MANAGER_FREQUENCY_PERIOD =
"controller.task.frequencyPeriod";
public static final String TASK_MANAGER_SKIP_LATE_CRON_SCHEDULE =
"controller.task.skipLateCronSchedule";
public static final String TASK_MANAGER_MAX_CRON_SCHEDULE_DELAY_IN_SECONDS
=
@@ -163,10 +136,6 @@ public class ControllerConf extends PinotConfiguration {
public static final String
STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD =
"controller.stale.instances.cleanup.task.minOfflineTimeBeforeDeletionPeriod";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_TASK_METRICS_EMITTER_FREQUENCY_IN_SECONDS =
- "controller.minion.task.metrics.emitter.frequencyInSeconds";
public static final String TASK_METRICS_EMITTER_FREQUENCY_PERIOD =
"controller.minion.task.metrics.emitter.frequencyPeriod";
@@ -207,14 +176,6 @@ public class ControllerConf extends PinotConfiguration {
public static final String ENABLE_DISTRIBUTED_LOCKING =
"controller.task.enableDistributedLocking";
public static final boolean DEFAULT_ENABLE_DISTRIBUTED_LOCKING = false;
- @Deprecated
- // RealtimeSegmentRelocator has been rebranded as SegmentRelocator
- public static final String DEPRECATED_REALTIME_SEGMENT_RELOCATOR_FREQUENCY
=
- "controller.realtime.segment.relocator.frequency";
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS =
- "controller.segment.relocator.frequencyInSeconds";
public static final String SEGMENT_RELOCATOR_FREQUENCY_PERIOD =
"controller.segment.relocator.frequencyPeriod";
public static final String SEGMENT_RELOCATOR_REASSIGN_INSTANCES =
"controller.segment.relocator.reassignInstances";
@@ -245,10 +206,6 @@ public class ControllerConf extends PinotConfiguration {
public static final String REBALANCE_CHECKER_FREQUENCY_PERIOD =
"controller.rebalance.checker.frequencyPeriod";
// Because segment level validation is expensive and requires heavy ZK
access, we run segment level validation
// with a separate interval
- // Deprecated as of 0.8.0
- @Deprecated
- public static final String
DEPRECATED_SEGMENT_LEVEL_VALIDATION_INTERVAL_IN_SECONDS =
- "controller.segment.level.validation.intervalInSeconds";
public static final String SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD =
"controller.segment.level.validation.intervalPeriod";
public static final String AUTO_RESET_ERROR_SEGMENTS_VALIDATION =
@@ -267,10 +224,6 @@ public class ControllerConf extends PinotConfiguration {
public static final String OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD =
"controller.offline.segment.validation.frequencyPeriod";
- @Deprecated
- // RealtimeSegmentRelocator has been rebranded as SegmentRelocator
- public static final String
DEPRECATED_REALTIME_SEGMENT_RELOCATION_INITIAL_DELAY_IN_SECONDS =
- "controller.realtimeSegmentRelocation.initialDelayInSeconds";
public static final String SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS =
"controller.segmentRelocator.initialDelayInSeconds";
public static final String REBALANCE_CHECKER_INITIAL_DELAY_IN_SECONDS =
@@ -315,29 +268,29 @@ public class ControllerConf extends PinotConfiguration {
return MIN_INITIAL_DELAY_IN_SECONDS +
RANDOM.nextInt(MAX_INITIAL_DELAY_IN_SECONDS - MIN_INITIAL_DELAY_IN_SECONDS);
}
- // Default values
- public static final int DEFAULT_RETENTION_MANAGER_FREQUENCY_IN_SECONDS = 6
* 60 * 60; // 6 Hours.
- public static final int
DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS = 24 * 60 * 60;
// 24 Hours.
- public static final int
DEFAULT_OFFLINE_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS = 60 * 60; // 1 Hour.
- public static final int
DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS = 60 * 60; // 1 Hour.
- public static final int
DEFAULT_REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_IN_SECONDS = 60 * 60; //
1 Hour.
- public static final int
DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS = 60 * 60; // 1 Hour.
- public static final int DEFAULT_STATUS_CHECKER_FREQUENCY_IN_SECONDS = 5 *
60; // 5 minutes
- public static final int DEFAULT_REBALANCE_CHECKER_FREQUENCY_IN_SECONDS = 5
* 60; // 5 minutes
- public static final int
DEFAULT_TENANT_REBALANCE_CHECKER_FREQUENCY_IN_SECONDS = 5 * 60; // 5 minutes
- public static final int DEFAULT_TASK_METRICS_EMITTER_FREQUENCY_IN_SECONDS
= 5 * 60; // 5 minutes
- public static final int
DEFAULT_STATUS_CONTROLLER_WAIT_FOR_PUSH_TIME_IN_SECONDS = 10 * 60; // 10 minutes
- public static final int DEFAULT_TASK_MANAGER_FREQUENCY_IN_SECONDS = -1; //
Disabled
+ // Default values as period strings
+ public static final String DEFAULT_RETENTION_MANAGER_FREQUENCY_PERIOD =
"6h";
+ public static final String
DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD = "24h";
+ public static final String
DEFAULT_OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD = "1h";
+ public static final String
DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD = "1h";
+ public static final String
DEFAULT_REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD = "1h";
+ public static final String
DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD = "1h";
+ public static final String DEFAULT_STATUS_CHECKER_FREQUENCY_PERIOD = "5m";
+ public static final String DEFAULT_REBALANCE_CHECKER_FREQUENCY_PERIOD =
"5m";
+ public static final String
DEFAULT_TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD = "5m";
+ public static final String DEFAULT_TASK_METRICS_EMITTER_FREQUENCY_PERIOD =
"5m";
+ public static final String
DEFAULT_STATUS_CONTROLLER_WAIT_FOR_PUSH_TIME_PERIOD = "10m";
+ public static final String DEFAULT_TASK_MANAGER_FREQUENCY_PERIOD = "-1s";
// Disabled
// NOTE:
// StaleInstancesCleanupTask is disabled by default because there is a
race condition between this task removing
// instance and instance of the same name joining the cluster, which
could end up leaving a live instance without
// InstanceConfig, and breaks Helix controller.
- public static final int
DEFAULT_STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_IN_SECONDS = -1; // Disabled
+ public static final String
DEFAULT_STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD = "-1s"; // Disabled
// TODO: Consider making it longer (e.g. 24 hours) to avoid deleting
instances that are temporarily down
- public static final int
DEFAULT_STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_IN_SECONDS = 60 * 60;
// 1 Hour.
+ public static final String
DEFAULT_STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD = "1h";
- public static final int
DEFAULT_SEGMENT_LEVEL_VALIDATION_INTERVAL_IN_SECONDS = 24 * 60 * 60;
- public static final int DEFAULT_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS =
60 * 60;
+ public static final String
DEFAULT_SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD = "24h";
+ public static final String DEFAULT_SEGMENT_RELOCATOR_FREQUENCY_PERIOD =
"1h";
// Realtime Consumer Monitor
public static final String RT_CONSUMER_MONITOR_FREQUENCY_PERIOD =
@@ -345,7 +298,7 @@ public class ControllerConf extends PinotConfiguration {
public static final String RT_CONSUMER_MONITOR_INITIAL_DELAY_IN_SECONDS =
"controller.realtimeConsumerMonitor.initialDelayInSeconds";
- public static final int DEFAULT_RT_CONSUMER_MONITOR_FREQUENCY_IN_SECONDS =
-1; // Disabled by default
+ public static final String DEFAULT_RT_CONSUMER_MONITOR_FREQUENCY_PERIOD =
"-1s"; // Disabled by default
}
public static final String SERVER_ADMIN_REQUEST_TIMEOUT_SECONDS =
"server.request.timeoutSeconds";
@@ -684,66 +637,60 @@ public class ControllerConf extends PinotConfiguration {
}
public int getRetentionControllerFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
- ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_RETENTION_MANAGER_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_RETENTION_MANAGER_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_RETENTION_MANAGER_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_RETENTION_MANAGER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setRetentionControllerFrequencyInSeconds(int
retentionFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_RETENTION_MANAGER_FREQUENCY_IN_SECONDS,
- Integer.toString(retentionFrequencyInSeconds));
+ setProperty(ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD,
+ Long.toString(retentionFrequencyInSeconds) + "s");
}
/**
- * Returns
<code>controller.offline.segment.interval.checker.frequencyPeriod</code>, or
- * <code>controller.offline.segment.interval.checker.frequencyPeriod</code>
or the segment level
- * validation interval, in the order of decreasing preference from left to
right. Falls-back to
- * the next config only if the current config is missing. This is done in
order to retain the
- * current behavior, wherein the offline validation tasks were done at
segment level validation
- * interval frequency The default value is the new
DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS
+ * Returns the offline segment interval checker frequency in seconds.
+ * Reads {@code controller.offline.segment.interval.checker.frequencyPeriod}
as a period string (e.g. "24h"),
+ * falling back to {@code
DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD} if absent or invalid.
*
- * @return the supplied config in seconds
+ * @return the configured frequency in seconds
*/
public int getOfflineSegmentIntervalCheckerFrequencyInSeconds() {
- return Optional.ofNullable(
-
getProperty(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(() ->
getProperty(
-
ControllerPeriodicTasksConf.DEPRECATED_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD);
+ if (!isValidPeriodWithLogging(ControllerPeriodicTasksConf
+ .OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD, period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setOfflineSegmentIntervalCheckerFrequencyInSeconds(int
validationFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS,
- Integer.toString(validationFrequencyInSeconds));
+
setProperty(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD,
+ Long.toString(validationFrequencyInSeconds) + "s");
}
/**
- * Returns
<code>controller.realtime.segment.validation.frequencyPeriod</code> or
- * <code>controller.realtime.segment.validation.frequencyInSeconds</code> or
the default realtime segment
- * validation frequncy, in the order of decreasing preference from left to
right. This is done in
- * order to retain the current behavior, wherein the realtime validation
tasks were done at
- * validation controller frequency The default value is the new
- * DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS
+ * Returns the realtime segment validation frequency in seconds.
+ * Reads {@code controller.realtime.segment.validation.frequencyPeriod} as a
period string (e.g. "1h"),
+ * falling back to {@code
DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD} if absent or invalid.
*
- * @return supplied config in seconds
+ * @return the configured frequency in seconds
*/
public int getRealtimeSegmentValidationFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setRealtimeSegmentValidationFrequencyInSeconds(int
validationFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS,
- Integer.toString(validationFrequencyInSeconds));
+
setProperty(ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
+ Long.toString(validationFrequencyInSeconds) + "s");
}
public boolean isRealtimeOffsetAutoResetBackfillEnabled() {
@@ -751,37 +698,39 @@ public class ControllerConf extends PinotConfiguration {
}
public int getRealtimeOffsetAutoResetBackfillFrequencyInSeconds() {
- return
getProperty(ControllerPeriodicTasksConf.REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD,
-
ControllerPeriodicTasksConf.DEFAULT_REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD);
+ if (!isValidPeriodWithLogging(ControllerPeriodicTasksConf
+ .REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD, period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setRealtimeOffsetAutoResetBackfillFrequencyInSeconds(int
offsetAutoResetBackfillFrequencyInSeconds) {
setProperty(ControllerPeriodicTasksConf.REALTIME_OFFSET_AUTO_RESET_BACKFILL_FREQUENCY_PERIOD,
- Integer.toString(offsetAutoResetBackfillFrequencyInSeconds));
+ Integer.toString(offsetAutoResetBackfillFrequencyInSeconds) + "s");
}
/**
- * Return <code>controller.broker.resource.validation.frequencyPeriod</code>
or
- * <code>controller.broker.resource.validation.frequencyInSeconds</code> or
the default broker resource validation
- * frequency, in order of decreasing preference from left to righ. This is
done in order
- * to retain the current behavior, wherein the broker resource validation
tasks were done at
- * validation controller frequency The default value is the new
- * DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS
+ * Returns the broker resource validation frequency in seconds.
+ * Reads {@code controller.broker.resource.validation.frequencyPeriod} as a
period string (e.g. "1h"),
+ * falling back to {@code
DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD} if absent or invalid.
*
- * @return the supplied config in seconds
+ * @return the configured frequency in seconds
*/
public int getBrokerResourceValidationFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setBrokerResourceValidationFrequencyInSeconds(int
validationFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS,
- Integer.toString(validationFrequencyInSeconds));
+
setProperty(ControllerPeriodicTasksConf.BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD,
+ Long.toString(validationFrequencyInSeconds) + "s");
}
public long getBrokerResourceValidationInitialDelayInSeconds() {
@@ -790,24 +739,26 @@ public class ControllerConf extends PinotConfiguration {
}
public int getStatusCheckerFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.STATUS_CHECKER_FREQUENCY_PERIOD))
- .filter(period ->
isValidPeriodWithLogging(ControllerPeriodicTasksConf.STATUS_CHECKER_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_STATUS_CHECKER_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_STATUS_CHECKER_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.STATUS_CHECKER_FREQUENCY_PERIOD,
+ ControllerPeriodicTasksConf.DEFAULT_STATUS_CHECKER_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.STATUS_CHECKER_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_STATUS_CHECKER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setStatusCheckerFrequencyInSeconds(int
statusCheckerFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_STATUS_CHECKER_FREQUENCY_IN_SECONDS,
- Integer.toString(statusCheckerFrequencyInSeconds));
+ setProperty(ControllerPeriodicTasksConf.STATUS_CHECKER_FREQUENCY_PERIOD,
+ Long.toString(statusCheckerFrequencyInSeconds) + "s");
}
public int getRebalanceCheckerFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.REBALANCE_CHECKER_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
- ControllerPeriodicTasksConf.REBALANCE_CHECKER_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period))
-
.orElse(ControllerPeriodicTasksConf.DEFAULT_REBALANCE_CHECKER_FREQUENCY_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.REBALANCE_CHECKER_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_REBALANCE_CHECKER_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.REBALANCE_CHECKER_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_REBALANCE_CHECKER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public long getRebalanceCheckerInitialDelayInSeconds() {
@@ -816,11 +767,12 @@ public class ControllerConf extends PinotConfiguration {
}
public int getTenantRebalanceCheckerFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD, period))
- .map(period -> (int) convertPeriodToSeconds(period))
-
.orElse(ControllerPeriodicTasksConf.DEFAULT_TENANT_REBALANCE_CHECKER_FREQUENCY_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_TENANT_REBALANCE_CHECKER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public long getTenantRebalanceCheckerInitialDelayInSeconds() {
@@ -829,9 +781,12 @@ public class ControllerConf extends PinotConfiguration {
}
public int getRealtimeConsumerMonitorRunFrequency() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.RT_CONSUMER_MONITOR_FREQUENCY_PERIOD))
- .map(period -> (int) convertPeriodToSeconds(period))
-
.orElse(ControllerPeriodicTasksConf.DEFAULT_RT_CONSUMER_MONITOR_FREQUENCY_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.RT_CONSUMER_MONITOR_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_RT_CONSUMER_MONITOR_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.RT_CONSUMER_MONITOR_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_RT_CONSUMER_MONITOR_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public long getRealtimeConsumerMonitorInitialDelayInSeconds() {
@@ -840,61 +795,50 @@ public class ControllerConf extends PinotConfiguration {
}
public int getTaskMetricsEmitterFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.TASK_METRICS_EMITTER_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
- ControllerPeriodicTasksConf.TASK_METRICS_EMITTER_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_TASK_METRICS_EMITTER_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_TASK_METRICS_EMITTER_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.TASK_METRICS_EMITTER_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_TASK_METRICS_EMITTER_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.TASK_METRICS_EMITTER_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_TASK_METRICS_EMITTER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setTaskMetricsEmitterFrequencyInSeconds(int
taskMetricsEmitterFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_TASK_METRICS_EMITTER_FREQUENCY_IN_SECONDS,
- Integer.toString(taskMetricsEmitterFrequencyInSeconds));
+
setProperty(ControllerPeriodicTasksConf.TASK_METRICS_EMITTER_FREQUENCY_PERIOD,
+ Long.toString(taskMetricsEmitterFrequencyInSeconds) + "s");
}
public int getStatusCheckerWaitForPushTimeInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD, period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_STATUS_CHECKER_WAIT_FOR_PUSH_TIME_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_STATUS_CONTROLLER_WAIT_FOR_PUSH_TIME_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_STATUS_CONTROLLER_WAIT_FOR_PUSH_TIME_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_STATUS_CONTROLLER_WAIT_FOR_PUSH_TIME_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setStatusCheckerWaitForPushTimeInSeconds(int
statusCheckerWaitForPushTimeInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_STATUS_CHECKER_WAIT_FOR_PUSH_TIME_IN_SECONDS,
- Integer.toString(statusCheckerWaitForPushTimeInSeconds));
+
setProperty(ControllerPeriodicTasksConf.STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD,
+ Long.toString(statusCheckerWaitForPushTimeInSeconds) + "s");
}
/**
- * RealtimeSegmentRelocator has been rebranded to SegmentRelocator. Returns
<code>controller.segment.relocator
- * .frequencyPeriod</code> or <code>controller.segment.relocator
.frequencyInSeconds</code> or
- * REALTIME_SEGMENT_RELOCATOR_FREQUENCY, in the order of decreasing
perference (left -> right).
+ * Returns the segment relocator frequency in seconds.
+ * Reads {@code controller.segment.relocator.frequencyPeriod} as a period
string (e.g. "1h"),
+ * falling back to {@code DEFAULT_SEGMENT_RELOCATOR_FREQUENCY_PERIOD} if
absent or invalid.
*/
public int getSegmentRelocatorFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
- ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(() -> {
- Integer segmentRelocatorFreqSeconds =
-
getProperty(ControllerPeriodicTasksConf.DEPRECATED_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS,
Integer.class);
- if (segmentRelocatorFreqSeconds == null) {
- String realtimeSegmentRelocatorPeriod =
-
getProperty(ControllerPeriodicTasksConf.DEPRECATED_REALTIME_SEGMENT_RELOCATOR_FREQUENCY);
- if (realtimeSegmentRelocatorPeriod != null) {
- segmentRelocatorFreqSeconds = (int)
convertPeriodToSeconds(realtimeSegmentRelocatorPeriod);
- } else {
- segmentRelocatorFreqSeconds =
ControllerPeriodicTasksConf.DEFAULT_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS;
- }
- }
- return segmentRelocatorFreqSeconds;
- });
+ String period =
getProperty(ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_SEGMENT_RELOCATOR_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_SEGMENT_RELOCATOR_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setSegmentRelocatorFrequencyInSeconds(int
segmentRelocatorFrequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS,
- Integer.toString(segmentRelocatorFrequencyInSeconds));
+ setProperty(ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_FREQUENCY_PERIOD,
+ Long.toString(segmentRelocatorFrequencyInSeconds) + "s");
}
public boolean getSegmentRelocatorReassignInstances() {
@@ -1008,25 +952,26 @@ public class ControllerConf extends PinotConfiguration {
}
public int getTaskManagerFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.TASK_MANAGER_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
- ControllerPeriodicTasksConf.TASK_MANAGER_FREQUENCY_PERIOD, period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_TASK_MANAGER_FREQUENCY_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_TASK_MANAGER_FREQUENCY_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.TASK_MANAGER_FREQUENCY_PERIOD,
+ ControllerPeriodicTasksConf.DEFAULT_TASK_MANAGER_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.TASK_MANAGER_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_TASK_MANAGER_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setTaskManagerFrequencyInSeconds(int frequencyInSeconds) {
-
setProperty(ControllerPeriodicTasksConf.DEPRECATED_TASK_MANAGER_FREQUENCY_IN_SECONDS,
- Integer.toString(frequencyInSeconds));
+ setProperty(ControllerPeriodicTasksConf.TASK_MANAGER_FREQUENCY_PERIOD,
+ Long.toString(frequencyInSeconds) + "s");
}
public int getStaleInstancesCleanupTaskFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period))
-
.orElse(ControllerPeriodicTasksConf.DEFAULT_STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_STALE_INSTANCES_CLEANUP_TASK_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setStaleInstanceCleanupTaskFrequencyInSeconds(String
frequencyPeriod) {
@@ -1043,12 +988,13 @@ public class ControllerConf extends PinotConfiguration {
}
public int getStaleInstancesCleanupTaskInstancesRetentionInSeconds() {
- return Optional.ofNullable(
-
getProperty(ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period))
-
.orElse(ControllerPeriodicTasksConf.DEFAULT_STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD);
+ if (!isValidPeriodWithLogging(ControllerPeriodicTasksConf
+ .STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD, period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_STALE_INSTANCES_CLEANUP_TASK_INSTANCES_RETENTION_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setStaleInstancesCleanupTaskInstancesRetentionPeriod(String
retentionPeriod) {
@@ -1182,12 +1128,12 @@ public class ControllerConf extends PinotConfiguration {
}
public int getSegmentLevelValidationIntervalInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD, period))
- .map(period -> (int) convertPeriodToSeconds(period)).orElseGet(
- () ->
getProperty(ControllerPeriodicTasksConf.DEPRECATED_SEGMENT_LEVEL_VALIDATION_INTERVAL_IN_SECONDS,
-
ControllerPeriodicTasksConf.DEFAULT_SEGMENT_LEVEL_VALIDATION_INTERVAL_IN_SECONDS));
+ String period =
getProperty(ControllerPeriodicTasksConf.SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public boolean isAutoResetErrorSegmentsOnValidationEnabled() {
@@ -1225,11 +1171,12 @@ public class ControllerConf extends PinotConfiguration {
}
public int getOfflineSegmentValidationFrequencyInSeconds() {
- return
Optional.ofNullable(getProperty(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD))
- .filter(period -> isValidPeriodWithLogging(
-
ControllerPeriodicTasksConf.OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
period))
- .map(period -> (int) convertPeriodToSeconds(period))
-
.orElse(ControllerPeriodicTasksConf.DEFAULT_OFFLINE_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS);
+ String period =
getProperty(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
+
ControllerPeriodicTasksConf.DEFAULT_OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD);
+ if
(!isValidPeriodWithLogging(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
period)) {
+ period =
ControllerPeriodicTasksConf.DEFAULT_OFFLINE_SEGMENT_VALIDATION_FREQUENCY_PERIOD;
+ }
+ return (int) convertPeriodToSeconds(period);
}
public void setOfflineSegmentValidationFrequencyInSeconds(int
validationFrequencyInSeconds) {
@@ -1335,19 +1282,13 @@ public class ControllerConf extends PinotConfiguration {
}
/**
- * RealtimeSegmentRelocator has been rebranded to SegmentRelocator.
- * Check for SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS property, if not
found, return
- * REALTIME_SEGMENT_RELOCATION_INITIAL_DELAY_IN_SECONDS
+ * Returns the segment relocator initial delay in seconds.
+ * Reads {@code controller.segmentRelocator.initialDelayInSeconds}, falling
back to a random
+ * value between {@code MIN_INITIAL_DELAY_IN_SECONDS} and {@code
MAX_INITIAL_DELAY_IN_SECONDS}.
*/
public long getSegmentRelocatorInitialDelayInSeconds() {
- Long segmentRelocatorInitialDelaySeconds =
-
getProperty(ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS,
Long.class);
- if (segmentRelocatorInitialDelaySeconds == null) {
- segmentRelocatorInitialDelaySeconds =
-
getProperty(ControllerPeriodicTasksConf.DEPRECATED_REALTIME_SEGMENT_RELOCATION_INITIAL_DELAY_IN_SECONDS,
- ControllerPeriodicTasksConf.getRandomInitialDelayInSeconds());
- }
- return segmentRelocatorInitialDelaySeconds;
+ return
getProperty(ControllerPeriodicTasksConf.SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS,
+ ControllerPeriodicTasksConf.getRandomInitialDelayInSeconds());
}
public long getPeriodicTaskInitialDelayInSeconds() {
diff --git
a/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
b/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
index 6fc7f920233..fd53f33e0e1 100644
---
a/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
+++
b/pinot-controller/src/test/java/org/apache/pinot/controller/ControllerConfTest.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.lang3.RandomStringUtils;
import org.apache.pinot.controller.helix.core.rebalance.RebalanceConfig;
import org.apache.pinot.spi.config.table.DisasterRecoveryMode;
import org.apache.pinot.spi.utils.Enablement;
@@ -36,19 +35,7 @@ import static
org.apache.pinot.controller.ControllerConf.ControllerPeriodicTasks
public class ControllerConfTest {
- private static final List<String> DEPRECATED_CONFIGS = List.of(
- DEPRECATED_RETENTION_MANAGER_FREQUENCY_IN_SECONDS,
- DEPRECATED_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS,
- DEPRECATED_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS,
- DEPRECATED_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS,
- DEPRECATED_STATUS_CHECKER_FREQUENCY_IN_SECONDS,
- DEPRECATED_TASK_MANAGER_FREQUENCY_IN_SECONDS,
- DEPRECATED_TASK_METRICS_EMITTER_FREQUENCY_IN_SECONDS,
- DEPRECATED_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS,
- DEPRECATED_SEGMENT_LEVEL_VALIDATION_INTERVAL_IN_SECONDS,
- DEPRECATED_REALTIME_SEGMENT_RELOCATION_INITIAL_DELAY_IN_SECONDS,
- DEPRECATED_STATUS_CHECKER_WAIT_FOR_PUSH_TIME_IN_SECONDS
- );
+ // Deprecated configs have been removed - no configs to test for fallback
behavior
private static final List<String> NEW_CONFIGS = List.of(
RETENTION_MANAGER_FREQUENCY_PERIOD,
@@ -56,109 +43,25 @@ public class ControllerConfTest {
REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD,
STATUS_CHECKER_FREQUENCY_PERIOD,
+ STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD,
TASK_MANAGER_FREQUENCY_PERIOD,
TASK_METRICS_EMITTER_FREQUENCY_PERIOD,
SEGMENT_RELOCATOR_FREQUENCY_PERIOD,
- SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD,
- SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS,
- STATUS_CHECKER_WAIT_FOR_PUSH_TIME_PERIOD
+ SEGMENT_LEVEL_VALIDATION_INTERVAL_PERIOD
);
private static final Random RAND = new Random();
/**
- * When config contains: 1. Both deprecated config and the corresponding new
config. 2. All new
- * configurations are valid. 3. Some deprecated configurations are invalid,
then new configs
- * override deprecated configs (invalid deprecated configs do not throw
exceptions when
- * corresponding valid new configs are supplied as well)
- */
- @Test
- public void
validNewConfigOverridesCorrespondingValidOrInvalidOldConfigOnRead() {
- //setup
- Map<String, Object> controllerConfig = new HashMap<>();
- int durationInSeconds = getRandomDurationInSeconds();
- DEPRECATED_CONFIGS.forEach(config -> controllerConfig.put(config,
durationInSeconds));
- //put some invalid deprecated configs
- controllerConfig.put(DEPRECATED_RETENTION_MANAGER_FREQUENCY_IN_SECONDS,
getRandomString());
-
controllerConfig.put(DEPRECATED_SEGMENT_LEVEL_VALIDATION_INTERVAL_IN_SECONDS,
getRandomString());
- //override all deprecated configs with valid new configs
- String period = getRandomPeriodInMinutes();
- NEW_CONFIGS.forEach(config -> controllerConfig.put(config, period));
- ControllerConf conf = new ControllerConf(controllerConfig);
- //execution and assertion
- assertOnDurations(conf,
TimeUnit.SECONDS.convert(TimeUtils.convertPeriodToMillis(period),
TimeUnit.MILLISECONDS),
- controllerConfig);
- }
-
- /**
- * When config contains: 1. Both deprecated config and the corresponding new
config. 2. All
- * deprecated configurations are valid. 3. Some new configurations are
invalid, then exceptions
- * are thrown when invalid new configurations are read (there is no
fall-back to the corresponding
- * valid deprecated configuration). For all valid new configurations, they
override the
- * corresponding deprecated configuration.
- * Added fallback logic to use valid deprecated config when new config is
invalid.
- */
- @Test
- public void
invalidNewConfigShouldNotThrowExceptionOnReadWithFallbackToCorrespondingValidDeprecatedConfig()
{
- //setup
- Map<String, Object> controllerConfig = new HashMap<>();
- int durationInSeconds = getRandomDurationInSeconds();
- //all deprecated configs should be valid
- DEPRECATED_CONFIGS.forEach(config -> controllerConfig.put(config,
durationInSeconds));
- String randomPeriodInMinutes = getRandomPeriodInMinutes();
- NEW_CONFIGS.forEach(config -> controllerConfig.put(config,
randomPeriodInMinutes));
- //put some invalid new configs
- String randomInvalidString = getRandomString();
- controllerConfig.put(RETENTION_MANAGER_FREQUENCY_PERIOD,
randomInvalidString);
- ControllerConf conf = new ControllerConf(controllerConfig);
- Assert.assertEquals(
- conf.getRetentionControllerFrequencyInSeconds(),
- durationInSeconds, // expected fallback value
- "Should fallback to deprecated config value"
- );
- //test to assert that invalid config is captured in the invalid config map
value
- Map<String, String> invalidConfigs = conf.getInvalidConfigs();
-
Assert.assertTrue(invalidConfigs.containsKey(RETENTION_MANAGER_FREQUENCY_PERIOD));
- Assert.assertEquals(
- conf.getInvalidConfigs().get(RETENTION_MANAGER_FREQUENCY_PERIOD),
- String.format(
- "Invalid time spec '%s' for config '%s'. Falling back to default
config.",
- randomInvalidString, RETENTION_MANAGER_FREQUENCY_PERIOD
- )
- );
- }
-
- /**
- * When only deprecated configs are supplied (new configs are not supplied),
then the correct
- * converted value is returned.
- */
- @Test
- public void
supplyingOnlyDeprecatedConfigsShouldReturnCorrectlyConvertedValue() {
- //setup
- Map<String, Object> controllerConfig = new HashMap<>();
- int durationInSeconds = getRandomDurationInSeconds();
- DEPRECATED_CONFIGS.forEach(config -> {
- controllerConfig.put(config, durationInSeconds);
- });
- //pre-conditions: config should not contain any new config
- NEW_CONFIGS.forEach(config ->
Assert.assertFalse(controllerConfig.containsKey(config)));
- ControllerConf conf = new ControllerConf(controllerConfig);
- //execution and assertion
- assertOnDurations(conf, durationInSeconds, controllerConfig);
- }
-
- /**
- * When only new configs are supplied (deprecated configs are not supplied),
then the correct
+ * When only new configs are supplied (deprecated configs have been
removed), then the correct
* converted value is returned.
*/
@Test
- public void supplyingOnlyNewConfigsShouldReturnCorrectlyConvertedValue() {
+ public void supplyingNewConfigsShouldReturnCorrectlyConvertedValue() {
//setup
Map<String, Object> controllerConfig = new HashMap<>();
String period = getRandomPeriodInMinutes();
NEW_CONFIGS.forEach(config -> controllerConfig.put(config, period));
- //pre-conditions: controller config should not contain any deprecated
config
- DEPRECATED_CONFIGS.forEach(config ->
Assert.assertFalse(controllerConfig.containsKey(config)));
ControllerConf conf = new ControllerConf(controllerConfig);
//execution and assertion
assertOnDurations(conf,
TimeUnit.SECONDS.convert(TimeUtils.convertPeriodToMillis(period),
TimeUnit.MILLISECONDS),
@@ -263,6 +166,7 @@ public class ControllerConfTest {
int realtimeSegmentValidationFrequencyInSeconds =
conf.getRealtimeSegmentValidationFrequencyInSeconds();
int offlineSegmentIntervalCheckerFrequencyInSeconds =
conf.getOfflineSegmentIntervalCheckerFrequencyInSeconds();
int retentionControllerFrequencyInSeconds =
conf.getRetentionControllerFrequencyInSeconds();
+ int statusCheckerWaitForPushTimeInSeconds =
conf.getStatusCheckerWaitForPushTimeInSeconds();
//then
String confAsString = controllerConfig.toString();
Assert.assertEquals(segmentLevelValidationIntervalInSeconds,
expectedDuration, confAsString);
@@ -274,10 +178,7 @@ public class ControllerConfTest {
Assert.assertEquals(realtimeSegmentValidationFrequencyInSeconds,
expectedDuration, confAsString);
Assert.assertEquals(offlineSegmentIntervalCheckerFrequencyInSeconds,
expectedDuration, confAsString);
Assert.assertEquals(retentionControllerFrequencyInSeconds,
expectedDuration, confAsString);
- }
-
- private int getRandomDurationInSeconds() {
- return RAND.nextInt(50);
+ Assert.assertEquals(statusCheckerWaitForPushTimeInSeconds,
expectedDuration, confAsString);
}
private String getRandomPeriodInMinutes() {
@@ -288,8 +189,15 @@ public class ControllerConfTest {
return 1 + RAND.nextInt(10);
}
- private String getRandomString() {
- return RandomStringUtils.randomAlphanumeric(5);
+ @Test
+ public void invalidFrequencyPeriodShouldFallBackToDefault() {
+ Map<String, Object> controllerConfig = new HashMap<>();
+ controllerConfig.put(RETENTION_MANAGER_FREQUENCY_PERIOD,
"notAValidPeriod");
+ ControllerConf conf = new ControllerConf(controllerConfig);
+ // Invalid period should fall back to the default value
+ Assert.assertEquals(conf.getRetentionControllerFrequencyInSeconds(),
+ (int) TimeUnit.SECONDS.convert(
+
TimeUtils.convertPeriodToMillis(DEFAULT_RETENTION_MANAGER_FREQUENCY_PERIOD),
TimeUnit.MILLISECONDS));
}
@Test
diff --git
a/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
b/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
index 3dd6d0d9327..eb1b965ac1b 100644
---
a/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
+++
b/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
@@ -70,10 +70,10 @@ public class PinotConfigUtils {
: TMP_DIR + String.format("Controller_%s_%s/controller/data",
controllerHost, controllerPort));
properties.put(ControllerConf.CONTROLLER_VIP_HOST, controllerHost);
properties.put(ControllerConf.CLUSTER_TENANT_ISOLATION_ENABLE,
tenantIsolation);
-
properties.put(ControllerPeriodicTasksConf.DEPRECATED_RETENTION_MANAGER_FREQUENCY_IN_SECONDS,
3600 * 6);
-
properties.put(ControllerPeriodicTasksConf.DEPRECATED_OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_IN_SECONDS,
3600);
-
properties.put(ControllerPeriodicTasksConf.DEPRECATED_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS,
3600);
-
properties.put(ControllerPeriodicTasksConf.DEPRECATED_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS,
3600);
+
properties.put(ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD,
"6h");
+
properties.put(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD,
"1h");
+
properties.put(ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
"1h");
+
properties.put(ControllerPeriodicTasksConf.BROKER_RESOURCE_VALIDATION_FREQUENCY_PERIOD,
"1h");
properties.put(ControllerConf.CONTROLLER_MODE, controllerMode.toString());
return properties;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]