Class SqlTaskManager

java.lang.Object
io.trino.execution.SqlTaskManager
All Implemented Interfaces:
TaskManager, Closeable, AutoCloseable

public class SqlTaskManager extends Object implements TaskManager, Closeable
  • Constructor Details

  • Method Details

    • updateMemoryPoolAssignments

      public void updateMemoryPoolAssignments(MemoryPoolAssignmentsRequest assignments)
      Specified by:
      updateMemoryPoolAssignments in interface TaskManager
    • start

      @PostConstruct public void start()
    • close

      @PreDestroy public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getIoStats

      public SqlTaskIoStats getIoStats()
    • getTaskNotificationExecutor

      public io.airlift.concurrent.ThreadPoolExecutorMBean getTaskNotificationExecutor()
    • getFailedTasks

      public io.airlift.stats.CounterStat getFailedTasks()
    • getAllTasks

      public List<SqlTask> getAllTasks()
    • getAllTaskInfo

      public List<TaskInfo> getAllTaskInfo()
      Description copied from interface: TaskManager
      Gets all of the currently tracked tasks. This will included uninitialized, running, and completed tasks.
      Specified by:
      getAllTaskInfo in interface TaskManager
    • getTaskInfo

      public TaskInfo getTaskInfo(TaskId taskId)
      Description copied from interface: TaskManager
      Gets the info for the specified task. If the task has not been created yet, an uninitialized task is created and the info is returned.

      NOTE: this design assumes that only tasks that will eventually exist are queried.

      Specified by:
      getTaskInfo in interface TaskManager
    • getTaskStatus

      public TaskStatus getTaskStatus(TaskId taskId)
      Description copied from interface: TaskManager
      Gets the status for the specified task.
      Specified by:
      getTaskStatus in interface TaskManager
    • getTaskInfo

      public com.google.common.util.concurrent.ListenableFuture<TaskInfo> getTaskInfo(TaskId taskId, long currentVersion)
      Description copied from interface: TaskManager
      Gets future info for the task after the state changes from current state. If the task has not been created yet, an uninitialized task is created and the future is returned. If the task is already in a final state, the info is returned immediately.

      NOTE: this design assumes that only tasks that will eventually exist are queried.

      Specified by:
      getTaskInfo in interface TaskManager
    • getTaskInstanceId

      public String getTaskInstanceId(TaskId taskId)
      Description copied from interface: TaskManager
      Gets the unique instance id of a task. This can be used to detect a task that was destroyed and recreated.
      Specified by:
      getTaskInstanceId in interface TaskManager
    • getTaskStatus

      public com.google.common.util.concurrent.ListenableFuture<TaskStatus> getTaskStatus(TaskId taskId, long currentVersion)
      Description copied from interface: TaskManager
      Gets future status for the task after the state changes from current state. If the task has not been created yet, an uninitialized task is created and the future is returned. If the task is already in a final state, the status is returned immediately.

      NOTE: this design assumes that only tasks that will eventually exist are queried.

      Specified by:
      getTaskStatus in interface TaskManager
    • acknowledgeAndGetNewDynamicFilterDomains

      public DynamicFiltersCollector.VersionedDynamicFilterDomains acknowledgeAndGetNewDynamicFilterDomains(TaskId taskId, long currentDynamicFiltersVersion)
      Specified by:
      acknowledgeAndGetNewDynamicFilterDomains in interface TaskManager
    • updateTask

      public TaskInfo updateTask(Session session, TaskId taskId, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers, Map<DynamicFilterId,Domain> dynamicFilterDomains)
      Description copied from interface: TaskManager
      Updates the task plan, sources and output buffers. If the task does not already exist, it is created and then updated.
      Specified by:
      updateTask in interface TaskManager
    • getTaskResults

      public com.google.common.util.concurrent.ListenableFuture<BufferResult> getTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId, long startingSequenceId, io.airlift.units.DataSize maxSize)
      Description copied from interface: TaskManager
      Gets results from a task either immediately or in the future. If the task or buffer has not been created yet, an uninitialized task is created and a future is returned.

      NOTE: this design assumes that only tasks and buffers that will eventually exist are queried.

      Specified by:
      getTaskResults in interface TaskManager
    • acknowledgeTaskResults

      public void acknowledgeTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId, long sequenceId)
      Description copied from interface: TaskManager
      Acknowledges previously received results.
      Specified by:
      acknowledgeTaskResults in interface TaskManager
    • abortTaskResults

      public TaskInfo abortTaskResults(TaskId taskId, OutputBuffers.OutputBufferId bufferId)
      Description copied from interface: TaskManager
      Aborts a result buffer for a task. If the task or buffer has not been created yet, an uninitialized task is created and a the buffer is aborted.

      NOTE: this design assumes that only tasks and buffers that will eventually exist are queried.

      Specified by:
      abortTaskResults in interface TaskManager
    • cancelTask

      public TaskInfo cancelTask(TaskId taskId)
      Description copied from interface: TaskManager
      Cancels a task. If the task does not already exist, it is created and then canceled.
      Specified by:
      cancelTask in interface TaskManager
    • abortTask

      public TaskInfo abortTask(TaskId taskId)
      Description copied from interface: TaskManager
      Aborts a task. If the task does not already exist, it is created and then aborted.
      Specified by:
      abortTask in interface TaskManager
    • failTask

      public TaskInfo failTask(TaskId taskId, Throwable failure)
      Description copied from interface: TaskManager
      Fail a task. If the task does not already exist, it is created and then failed.
      Specified by:
      failTask in interface TaskManager
    • removeOldTasks

      public void removeOldTasks()
    • failAbandonedTasks

      public void failAbandonedTasks()
    • addStateChangeListener

      public void addStateChangeListener(TaskId taskId, StateMachine.StateChangeListener<TaskState> stateChangeListener)
      Description copied from interface: TaskManager
      Adds a state change listener to the specified task. Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leaking this when adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution.
      Specified by:
      addStateChangeListener in interface TaskManager
    • addSourceTaskFailureListener

      public void addSourceTaskFailureListener(TaskId taskId, TaskFailureListener listener)
      Description copied from interface: TaskManager
      Add a listener that notifies about failures of any source tasks for a given task
      Specified by:
      addSourceTaskFailureListener in interface TaskManager
    • getTraceToken

      public Optional<String> getTraceToken(TaskId taskId)
      Description copied from interface: TaskManager
      Return trace token for a given task (see Session#traceToken)
      Specified by:
      getTraceToken in interface TaskManager
    • getQueryContext

      public QueryContext getQueryContext(QueryId queryId)