-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Allow assigning exclusive node for task execution #10432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9f8d86b
634b038
af08f9a
32b9f24
45f046c
83b7c62
b9f82a3
4442111
8cb727f
2ccf7f6
cebfae3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,9 @@ | |
| import io.trino.exchange.ExchangeManagerRegistry; | ||
|
||
| import io.trino.execution.QueryPreparer.PreparedQuery; | ||
| import io.trino.execution.StateMachine.StateChangeListener; | ||
| import io.trino.execution.scheduler.NodeAllocatorService; | ||
| import io.trino.execution.scheduler.NodeScheduler; | ||
| import io.trino.execution.scheduler.PartitionMemoryEstimator; | ||
| import io.trino.execution.scheduler.SplitSchedulerStats; | ||
| import io.trino.execution.scheduler.SqlQueryScheduler; | ||
| import io.trino.execution.scheduler.TaskDescriptorStorage; | ||
|
|
@@ -99,6 +101,8 @@ public class SqlQueryExecution | |
| private final SplitSourceFactory splitSourceFactory; | ||
| private final NodePartitioningManager nodePartitioningManager; | ||
| private final NodeScheduler nodeScheduler; | ||
| private final NodeAllocatorService nodeAllocatorService; | ||
| private final PartitionMemoryEstimator partitionMemoryEstimator; | ||
| private final List<PlanOptimizer> planOptimizers; | ||
| private final PlanFragmenter planFragmenter; | ||
| private final RemoteTaskFactory remoteTaskFactory; | ||
|
|
@@ -132,6 +136,8 @@ private SqlQueryExecution( | |
| SplitSourceFactory splitSourceFactory, | ||
| NodePartitioningManager nodePartitioningManager, | ||
| NodeScheduler nodeScheduler, | ||
| NodeAllocatorService nodeAllocatorService, | ||
| PartitionMemoryEstimator partitionMemoryEstimator, | ||
| List<PlanOptimizer> planOptimizers, | ||
| PlanFragmenter planFragmenter, | ||
| RemoteTaskFactory remoteTaskFactory, | ||
|
|
@@ -159,6 +165,8 @@ private SqlQueryExecution( | |
| this.splitSourceFactory = requireNonNull(splitSourceFactory, "splitSourceFactory is null"); | ||
| this.nodePartitioningManager = requireNonNull(nodePartitioningManager, "nodePartitioningManager is null"); | ||
| this.nodeScheduler = requireNonNull(nodeScheduler, "nodeScheduler is null"); | ||
| this.nodeAllocatorService = requireNonNull(nodeAllocatorService, "nodeAllocatorService is null"); | ||
| this.partitionMemoryEstimator = requireNonNull(partitionMemoryEstimator, "partitionMemoryEstimator is null"); | ||
| this.planOptimizers = requireNonNull(planOptimizers, "planOptimizers is null"); | ||
| this.planFragmenter = requireNonNull(planFragmenter, "planFragmenter is null"); | ||
| this.queryExecutor = requireNonNull(queryExecutor, "queryExecutor is null"); | ||
|
|
@@ -497,6 +505,8 @@ private void planDistribution(PlanRoot plan) | |
| plan.getRoot(), | ||
| nodePartitioningManager, | ||
| nodeScheduler, | ||
| nodeAllocatorService, | ||
| partitionMemoryEstimator, | ||
| remoteTaskFactory, | ||
| plan.isSummarizeTaskInfos(), | ||
| scheduleSplitBatchSize, | ||
|
|
@@ -698,6 +708,8 @@ public static class SqlQueryExecutionFactory | |
| private final SplitSourceFactory splitSourceFactory; | ||
| private final NodePartitioningManager nodePartitioningManager; | ||
| private final NodeScheduler nodeScheduler; | ||
| private final NodeAllocatorService nodeAllocatorService; | ||
| private final PartitionMemoryEstimator partitionMemoryEstimator; | ||
| private final List<PlanOptimizer> planOptimizers; | ||
| private final PlanFragmenter planFragmenter; | ||
| private final RemoteTaskFactory remoteTaskFactory; | ||
|
|
@@ -724,6 +736,8 @@ public static class SqlQueryExecutionFactory | |
| SplitSourceFactory splitSourceFactory, | ||
| NodePartitioningManager nodePartitioningManager, | ||
| NodeScheduler nodeScheduler, | ||
| NodeAllocatorService nodeAllocatorService, | ||
| PartitionMemoryEstimator partitionMemoryEstimator, | ||
| PlanOptimizersFactory planOptimizersFactory, | ||
| PlanFragmenter planFragmenter, | ||
| RemoteTaskFactory remoteTaskFactory, | ||
|
|
@@ -751,6 +765,8 @@ public static class SqlQueryExecutionFactory | |
| this.splitSourceFactory = requireNonNull(splitSourceFactory, "splitSourceFactory is null"); | ||
| this.nodePartitioningManager = requireNonNull(nodePartitioningManager, "nodePartitioningManager is null"); | ||
| this.nodeScheduler = requireNonNull(nodeScheduler, "nodeScheduler is null"); | ||
| this.nodeAllocatorService = requireNonNull(nodeAllocatorService, "nodeAllocatorService is null"); | ||
| this.partitionMemoryEstimator = requireNonNull(partitionMemoryEstimator, "partitionMemoryEstimator is null"); | ||
| this.planFragmenter = requireNonNull(planFragmenter, "planFragmenter is null"); | ||
| this.remoteTaskFactory = requireNonNull(remoteTaskFactory, "remoteTaskFactory is null"); | ||
| this.queryExecutor = requireNonNull(queryExecutor, "queryExecutor is null"); | ||
|
|
@@ -790,6 +806,8 @@ public QueryExecution createQueryExecution( | |
| splitSourceFactory, | ||
| nodePartitioningManager, | ||
| nodeScheduler, | ||
| nodeAllocatorService, | ||
| partitionMemoryEstimator, | ||
| planOptimizers, | ||
| planFragmenter, | ||
| remoteTaskFactory, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.trino.execution.scheduler; | ||
|
|
||
| import io.airlift.units.DataSize; | ||
| import io.trino.Session; | ||
| import io.trino.spi.ErrorCode; | ||
|
|
||
| public class ConstantPartitionMemoryEstimator | ||
| implements PartitionMemoryEstimator | ||
| { | ||
| @Override | ||
| public MemoryRequirements getInitialMemoryRequirements(Session session, DataSize defaultMemoryLimit) | ||
| { | ||
| return new MemoryRequirements( | ||
| defaultMemoryLimit, | ||
| true); | ||
| } | ||
|
|
||
| @Override | ||
| public MemoryRequirements getNextRetryMemoryRequirements(Session session, MemoryRequirements previousMemoryRequirements, ErrorCode errorCode) | ||
| { | ||
| return previousMemoryRequirements; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this config is not needed --- Spark only has
taskRetryAttemptsPerTask. Given the number of tasks of different stages can be different, this config may not make too much senseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not super attached to it. And the default value is
Integer.MAX_VALUEso by default it is ineffective. I think we can rid of it.Then we should rename
taskRetryAttemptsPerTasktotaskRetryAttempts. @arhimondr makes sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property can be used as a safeguard from a retry avalanche, when all the tasks suddenly start failing? Though this is more of a hypothetical thinking, not sure how useful is it going to be in practice. I don't really have a strong opinion here. Since it's already there and implemented I'm fine with keeping it. But if you feel like it won't be particularly useful you should also feel free to remove it.