Skip to content

Commit

Permalink
Assume REFRESH MATERIALIZED VIEW tasks do not need memory
Browse files Browse the repository at this point in the history
  • Loading branch information
linzebing authored and losipiuk committed Aug 24, 2023
1 parent b5e16e7 commit 40ab466
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import io.trino.sql.planner.plan.PlanFragmentId;
import io.trino.sql.planner.plan.PlanNode;
import io.trino.sql.planner.plan.PlanNodeId;
import io.trino.sql.planner.plan.RefreshMaterializedViewNode;
import io.trino.sql.planner.plan.RemoteSourceNode;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
Expand Down Expand Up @@ -1638,6 +1639,12 @@ public void addPartition(int partitionId, NodeRequirements nodeRequirements)
DataSize defaultTaskMemory = stage.getFragment().getPartitioning().equals(COORDINATOR_DISTRIBUTION) ?
getFaultTolerantExecutionDefaultCoordinatorTaskMemory(session) :
getFaultTolerantExecutionDefaultTaskMemory(session);
if (stage.getFragment().getRoot().getSources().stream()
.anyMatch(planNode -> planNode instanceof RefreshMaterializedViewNode)) {
// REFRESH MATERIALIZED VIEW will issue other SQL commands under the hood. If its task memory is
// non-zero, then a deadlock scenario is possible if we only have a single node in the cluster.
defaultTaskMemory = DataSize.ofBytes(0);
}
StagePartition partition = new StagePartition(
taskDescriptorStorage,
stage.getStageId(),
Expand Down

0 comments on commit 40ab466

Please sign in to comment.