Package io.trino.execution.scheduler
Class UniformNodeSelector
java.lang.Object
io.trino.execution.scheduler.UniformNodeSelector
- All Implemented Interfaces:
NodeSelector
-
Constructor Summary
ConstructorsConstructorDescriptionUniformNodeSelector(InternalNodeManager nodeManager, NodeTaskMap nodeTaskMap, boolean includeCoordinator, Supplier<NodeMap> nodeMap, int minCandidates, long maxSplitsWeightPerNode, long minPendingSplitsWeightPerTask, long maxAdjustedPendingSplitsWeightPerTask, int maxUnacknowledgedSplitsPerTask, NodeSchedulerConfig.SplitsBalancingPolicy splitsBalancingPolicy, boolean optimizedLocalScheduling) -
Method Summary
Modifier and TypeMethodDescriptionallNodes()computeAssignments(Set<Split> splits, List<RemoteTask> existingTasks) Identifies the nodes for running the specified splits.computeAssignments(Set<Split> splits, List<RemoteTask> existingTasks, BucketNodeMap bucketNodeMap) Identifies the nodes for running the specified splits based on a precomputed fixed partitioning.voidstatic SplitredistributeSplit(com.google.common.collect.Multimap<InternalNode, Split> assignment, InternalNode fromNode, InternalNode toNode, com.google.common.collect.SetMultimap<InetAddress, InternalNode> nodesByHost) The method selects and removes a split from the fromNode and assigns it to the toNode.selectRandomNodes(int limit, Set<InternalNode> excludedNodes) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.trino.execution.scheduler.NodeSelector
selectRandomNodes
-
Constructor Details
-
UniformNodeSelector
public UniformNodeSelector(InternalNodeManager nodeManager, NodeTaskMap nodeTaskMap, boolean includeCoordinator, Supplier<NodeMap> nodeMap, int minCandidates, long maxSplitsWeightPerNode, long minPendingSplitsWeightPerTask, long maxAdjustedPendingSplitsWeightPerTask, int maxUnacknowledgedSplitsPerTask, NodeSchedulerConfig.SplitsBalancingPolicy splitsBalancingPolicy, boolean optimizedLocalScheduling)
-
-
Method Details
-
lockDownNodes
public void lockDownNodes()- Specified by:
lockDownNodesin interfaceNodeSelector
-
allNodes
- Specified by:
allNodesin interfaceNodeSelector
-
selectCurrentNode
- Specified by:
selectCurrentNodein interfaceNodeSelector
-
selectRandomNodes
- Specified by:
selectRandomNodesin interfaceNodeSelector
-
computeAssignments
Description copied from interface:NodeSelectorIdentifies the nodes for running the specified splits.- Specified by:
computeAssignmentsin interfaceNodeSelector- Parameters:
splits- the splits that need to be assigned to nodes- Returns:
- a multimap from node to splits only for splits for which we could identify a node to schedule on. If we cannot find an assignment for a split, it is not included in the map. Also returns a future indicating when to reattempt scheduling of this batch of splits, if some of them could not be scheduled.
-
computeAssignments
public SplitPlacementResult computeAssignments(Set<Split> splits, List<RemoteTask> existingTasks, BucketNodeMap bucketNodeMap) Description copied from interface:NodeSelectorIdentifies the nodes for running the specified splits based on a precomputed fixed partitioning.- Specified by:
computeAssignmentsin interfaceNodeSelector- Parameters:
splits- the splits that need to be assigned to nodes- Returns:
- a multimap from node to splits only for splits for which we could identify a node with free space. If we cannot find an assignment for a split, it is not included in the map. Also returns a future indicating when to reattempt scheduling of this batch of splits, if some of them could not be scheduled.
-
redistributeSplit
public static Split redistributeSplit(com.google.common.collect.Multimap<InternalNode, Split> assignment, InternalNode fromNode, InternalNode toNode, com.google.common.collect.SetMultimap<InetAddress, InternalNode> nodesByHost) The method selects and removes a split from the fromNode and assigns it to the toNode. There is an attempt to redistribute a Non-local split if possible. This case is possible when there are multiple queries running simultaneously. If a Non-local split cannot be found in the maxNode, any split is selected randomly and reassigned.
-