Skip to content

Commit

Permalink
Enforce no more than 126 task retries
Browse files Browse the repository at this point in the history
  • Loading branch information
losipiuk committed Dec 20, 2022
1 parent 9cda6d0 commit 316b51f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.function.Consumer;

import static com.google.common.base.Preconditions.checkArgument;
import static io.trino.execution.QueryManagerConfig.MAX_TASK_RETRY_ATTEMPTS;
import static io.trino.execution.QueryManagerConfig.QUERY_MAX_RUN_TIME_HARD_LIMIT;
import static io.trino.plugin.base.session.PropertyMetadataUtil.dataSizeProperty;
import static io.trino.plugin.base.session.PropertyMetadataUtil.durationProperty;
Expand Down Expand Up @@ -762,6 +763,13 @@ public SystemSessionProperties(
TASK_RETRY_ATTEMPTS_PER_TASK,
"Maximum number of task retry attempts per single task",
queryManagerConfig.getTaskRetryAttemptsPerTask(),
value -> {
if (value < 0 || value > MAX_TASK_RETRY_ATTEMPTS) {
throw new TrinoException(
INVALID_SESSION_PROPERTY,
format("%s must be greater than or equal to 0 and not not greater than %s", TASK_RETRY_ATTEMPTS_PER_TASK, MAX_TASK_RETRY_ATTEMPTS));
}
},
false),
integerProperty(
MAX_TASKS_WAITING_FOR_NODE_PER_STAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class QueryManagerConfig
{
public static final String QUERY_MAX_RUN_TIME_HARD_LIMIT = "query.max-run-time.hard-limit";
public static final long AVAILABLE_HEAP_MEMORY = Runtime.getRuntime().maxMemory();
public static final int MAX_TASK_RETRY_ATTEMPTS = 126;

private int scheduleSplitBatchSize = 1000;
private int minScheduleSplitBatchSize = 100;
Expand Down Expand Up @@ -482,6 +483,7 @@ public QueryManagerConfig setTaskRetryAttemptsOverall(int taskRetryAttemptsOvera
}

@Min(0)
@Max(MAX_TASK_RETRY_ATTEMPTS)
public int getTaskRetryAttemptsPerTask()
{
return taskRetryAttemptsPerTask;
Expand Down

0 comments on commit 316b51f

Please sign in to comment.