From df02e1ae47a01134e5f6c6379016b2f3712aa31e Mon Sep 17 00:00:00 2001 From: patchwork01 <110390516+patchwork01@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:19:42 +0000 Subject: [PATCH] Apply validation consistently for lambda timeout properties --- .../sleeper/core/properties/instance/BatcherProperty.java | 2 ++ .../properties/instance/PartitionSplittingProperty.java | 2 ++ .../sleeper/core/properties/instance/QueryProperty.java | 1 + .../core/properties/instance/TableStateProperty.java | 6 +++--- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/java/core/src/main/java/sleeper/core/properties/instance/BatcherProperty.java b/java/core/src/main/java/sleeper/core/properties/instance/BatcherProperty.java index f010145fef..e76c6d7dc3 100644 --- a/java/core/src/main/java/sleeper/core/properties/instance/BatcherProperty.java +++ b/java/core/src/main/java/sleeper/core/properties/instance/BatcherProperty.java @@ -33,6 +33,7 @@ public interface BatcherProperty { UserDefinedInstanceProperty INGEST_BATCHER_SUBMITTER_TIMEOUT_IN_SECONDS = Index.propertyBuilder("sleeper.ingest.batcher.submitter.timeout.seconds") .description("The timeout in seconds for the lambda that receives submitted requests to ingest files.") .defaultValue("20") + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.INGEST) .runCdkDeployWhenChanged(true).build(); UserDefinedInstanceProperty INGEST_BATCHER_JOB_CREATION_MEMORY_IN_MB = Index.propertyBuilder("sleeper.ingest.batcher.job.creation.memory.mb") @@ -43,6 +44,7 @@ public interface BatcherProperty { UserDefinedInstanceProperty INGEST_BATCHER_JOB_CREATION_TIMEOUT_IN_SECONDS = Index.propertyBuilder("sleeper.ingest.batcher.job.creation.timeout.seconds") .description("The timeout in seconds for the lambda that creates ingest jobs from submitted file ingest requests.") .defaultValue("900") + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.INGEST) .runCdkDeployWhenChanged(true).build(); UserDefinedInstanceProperty INGEST_BATCHER_JOB_CREATION_LAMBDA_PERIOD_IN_MINUTES = Index.propertyBuilder("sleeper.ingest.batcher.job.creation.period.minutes") diff --git a/java/core/src/main/java/sleeper/core/properties/instance/PartitionSplittingProperty.java b/java/core/src/main/java/sleeper/core/properties/instance/PartitionSplittingProperty.java index a23797225b..71b3f8a5c9 100644 --- a/java/core/src/main/java/sleeper/core/properties/instance/PartitionSplittingProperty.java +++ b/java/core/src/main/java/sleeper/core/properties/instance/PartitionSplittingProperty.java @@ -56,6 +56,7 @@ public interface PartitionSplittingProperty { UserDefinedInstanceProperty FIND_PARTITIONS_TO_SPLIT_TIMEOUT_IN_SECONDS = Index.propertyBuilder("sleeper.partition.splitting.finder.timeout.seconds") .description("The timeout in seconds for the lambda function used to identify partitions that need to be split.") .defaultValue("900") + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.PARTITION_SPLITTING) .runCdkDeployWhenChanged(true).build(); UserDefinedInstanceProperty FIND_PARTITIONS_TO_SPLIT_LAMBDA_CONCURRENCY_RESERVED = Index.propertyBuilder("sleeper.partition.splitting.finder.concurrency.reserved") @@ -76,6 +77,7 @@ public interface PartitionSplittingProperty { UserDefinedInstanceProperty SPLIT_PARTITIONS_TIMEOUT_IN_SECONDS = Index.propertyBuilder("sleeper.partition.splitting.timeout.seconds") .description("The timeout in seconds for the lambda function used to split partitions.") .defaultValue("900") + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.PARTITION_SPLITTING) .runCdkDeployWhenChanged(true).build(); UserDefinedInstanceProperty SPLIT_PARTITIONS_RESERVED_CONCURRENCY = Index.propertyBuilder("sleeper.partition.splitting.reserved.concurrency") diff --git a/java/core/src/main/java/sleeper/core/properties/instance/QueryProperty.java b/java/core/src/main/java/sleeper/core/properties/instance/QueryProperty.java index db433d59d9..a6b6c516c4 100644 --- a/java/core/src/main/java/sleeper/core/properties/instance/QueryProperty.java +++ b/java/core/src/main/java/sleeper/core/properties/instance/QueryProperty.java @@ -41,6 +41,7 @@ public interface QueryProperty { UserDefinedInstanceProperty QUERY_PROCESSOR_LAMBDA_TIMEOUT_IN_SECONDS = Index.propertyBuilder("sleeper.query.processor.timeout.seconds") .description("The timeout for the lambda that executes queries in seconds.") .defaultValue("900") + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.QUERY) .runCdkDeployWhenChanged(true).build(); UserDefinedInstanceProperty QUERY_PROCESSING_LAMBDA_STATE_REFRESHING_PERIOD_IN_SECONDS = Index.propertyBuilder("sleeper.query.processor.state.refresh.period.seconds") diff --git a/java/core/src/main/java/sleeper/core/properties/instance/TableStateProperty.java b/java/core/src/main/java/sleeper/core/properties/instance/TableStateProperty.java index d3914ce9d3..9623141dc4 100644 --- a/java/core/src/main/java/sleeper/core/properties/instance/TableStateProperty.java +++ b/java/core/src/main/java/sleeper/core/properties/instance/TableStateProperty.java @@ -66,7 +66,7 @@ private static UserDefinedInstancePropertyImpl.Builder propertyBuilder(String pr .description("The timeout in seconds for lambdas that create batches of tables to run some operation against, " + "eg. create compaction jobs, run garbage collection, perform partition splitting.") .defaultValue("60") - .validationPredicate(SleeperPropertyValueUtils::isPositiveInteger) + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.TABLE_STATE) .build(); UserDefinedInstanceProperty TABLE_PROPERTIES_PROVIDER_TIMEOUT_IN_MINS = Index.propertyBuilder("sleeper.cache.table.properties.provider.timeout.minutes") @@ -112,7 +112,7 @@ private static UserDefinedInstancePropertyImpl.Builder propertyBuilder(String pr UserDefinedInstanceProperty SNAPSHOT_CREATION_LAMBDA_TIMEOUT_IN_SECONDS = Index.propertyBuilder("sleeper.statestore.snapshot.creation.lambda.timeout.seconds") .description("The timeout in seconds after which to terminate the transaction log snapshot creation lambda.") .defaultValue("900") - .validationPredicate(SleeperPropertyValueUtils::isPositiveInteger) + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .propertyGroup(InstancePropertyGroup.TABLE_STATE) .build(); UserDefinedInstanceProperty SNAPSHOT_CREATION_LAMBDA_MEMORY = Index.propertyBuilder("sleeper.statestore.snapshot.creation.memory.mb") @@ -178,7 +178,7 @@ private static UserDefinedInstancePropertyImpl.Builder propertyBuilder(String pr .propertyGroup(InstancePropertyGroup.TABLE_STATE).build(); UserDefinedInstanceProperty TRANSACTION_DELETION_LAMBDA_TIMEOUT_SECS = Index.propertyBuilder("sleeper.statestore.transaction.deletion.lambda.timeout.seconds") .description("The maximum timeout for the transaction deletion lambda in seconds.") - .validationPredicate(SleeperPropertyValueUtils::isPositiveInteger) + .validationPredicate(SleeperPropertyValueUtils::isValidLambdaTimeout) .defaultValue("900") .propertyGroup(InstancePropertyGroup.TABLE_STATE).build(); UserDefinedInstanceProperty TABLE_INDEX_DYNAMO_POINT_IN_TIME_RECOVERY = Index.propertyBuilder("sleeper.tables.index.dynamo.pointintimerecovery")