Package io.trino.execution.scheduler
Class TaskDescriptorStorage
java.lang.Object
io.trino.execution.scheduler.TaskDescriptorStorage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNotifies the storage that the query with a givenqueryIdhas been finished and the task descriptors can be safely discarded.Get task descriptorlongvoidinitialize(QueryId queryId) Initializes task descriptor storage for a givenqueryId.voidput(StageId stageId, TaskDescriptor descriptor) void
-
Constructor Details
-
TaskDescriptorStorage
-
TaskDescriptorStorage
public TaskDescriptorStorage(io.airlift.units.DataSize maxMemory)
-
-
Method Details
-
initialize
Initializes task descriptor storage for a givenqueryId. It is expected to be called before query scheduling begins. -
put
StoresTaskDescriptorfor a task identified by thestageIdandpartitionId. ThepartitionIdis obtained from theTaskDescriptorby callingTaskDescriptor.getPartitionId(). If the query has been terminated the call is ignored.- Throws:
IllegalStateException- if the storage already has a task descriptor for a given task
-
get
Get task descriptor- Returns:
- Non empty
TaskDescriptorfor a task identified by thestageIdandpartitionId. ReturnsOptional.empty()if the query of a givenstageIdhas been finished (e.g.: cancelled by the user or finished early). - Throws:
NoSuchElementException- ifTaskDescriptorfor a given task does not exist
-
remove
RemovesTaskDescriptorfor a task identified by thestageIdandpartitionId. If the query has been terminated the call is ignored.- Throws:
NoSuchElementException- ifTaskDescriptorfor a given task does not exist
-
destroy
Notifies the storage that the query with a givenqueryIdhas been finished and the task descriptors can be safely discarded.The engine may decided to destroy the storage while the scheduling is still in process (for example if query was cancelled). Under such circumstances the implementation will ignore future calls to
put(StageId, TaskDescriptor)and returnOptional.empty()fromget(StageId, int). The scheduler is expected to handle this condition appropriately. -
getReservedBytes
public long getReservedBytes()
-