- All Implemented Interfaces:
Traceable
When the request is not sliced, this task is the only task created, and starts an action to perform search requests.
When the request is sliced, this task can either represent a coordinating task (using
setWorkerCount(int)) or a worker task that performs search queries (using
setWorker(float, Integer)).
We don't always know if this task will be a leader or worker task when it's created, because if slices is set to "auto" it may
be either depending on the number of shards in the source indices. We figure that out when the request is handled and set it on this
class with setWorkerCount(int) or setWorker(float, Integer).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStatus of the reindex, update by query, or delete by query.static classThis class acts as a builder forBulkByScrollTask.Status.static classThe status of a slice of the request.Nested classes/interfaces inherited from class org.elasticsearch.tasks.CancellableTask
CancellableTask.CancellationListener -
Field Summary
Fields inherited from class org.elasticsearch.tasks.Task
APM_TRACE_CONTEXT, HEADERS_TO_COPY, PARENT_APM_TRACE_CONTEXT, PARENT_TRACE_PARENT_HEADER, PARENT_TRACE_STATE, startTime, TRACE_ID, TRACE_PARENT_HTTP_HEADER, TRACE_START_TIME, TRACE_STATE, X_ELASTIC_PRODUCT_ORIGIN_HTTP_HEADER, X_ELASTIC_PROJECT_ID_HTTP_HEADER, X_OPAQUE_ID_HTTP_HEADER -
Constructor Summary
ConstructorsConstructorDescriptionBulkByScrollTask(TaskId taskId, String type, String action, String description, TaskId parentTaskId, Map<String, String> headers, boolean eligibleForRelocationOnShutdown, ResumeInfo.RelocationOrigin relocationOrigin) -
Method Summary
Modifier and TypeMethodDescriptionReturns the object that tracks the state of sliced subtasks.Build a status for this task or null if this task doesn't have status.Returns the object that manages sending search requests.booleanReturns whether we should attempt to relocate this task to another node when the current node is preparing to shut down.booleanisLeader()Returns true if this task is a leader for other slice subtasksbooleanReturns true if this task was created via relocation from another node.booleanReturns whether this task has been marked as requiring relocation to another node.booleanisWorker()Returns true if this task is a worker task that performs search requests.voidCalled after the task is cancelled so that it can take any actions that it has to take.Returns the relocation origin if this task is a relocated continuation.voidMarks this task as requiring relocation to another node, e.g.voidSets this task to be a worker task that performs search requestsvoidsetWorkerCount(int slices) Sets this task to be a leader task forslicessliced subtaskstaskInfoGivenSubtaskInfo(String localNodeId, List<TaskInfo> sliceInfo) Build the status for this task given a snapshot of the information of running slices.Methods inherited from class org.elasticsearch.tasks.CancellableTask
addListener, ensureNotCancelled, getReasonCancelled, isCancelled, notifyIfCancelled, shouldCancelChildrenOnCancellation, toStringMethods inherited from class org.elasticsearch.tasks.Task
getAction, getDescription, getHeader, getId, getParentTaskId, getProjectId, getSpanId, getStartTime, getStartTimeNanos, getType, headers, result, result, taskInfo, taskInfo
-
Constructor Details
-
BulkByScrollTask
-
-
Method Details
-
getStatus
Description copied from class:TaskBuild a status for this task or null if this task doesn't have status. Since most tasks don't have status this defaults to returning null. While this can never perform IO it might be a costly operation, requiring collating lists of results, etc. So only use it if you need the value. -
taskInfoGivenSubtaskInfo
Build the status for this task given a snapshot of the information of running slices. This is only supported if the task is set as a leader for slice subtasks -
isLeader
public boolean isLeader()Returns true if this task is a leader for other slice subtasks -
setWorkerCount
public void setWorkerCount(int slices) Sets this task to be a leader task forslicessliced subtasks -
getLeaderState
Returns the object that tracks the state of sliced subtasks. Throws IllegalStateException if this task is not set to be a leader task. -
isWorker
public boolean isWorker()Returns true if this task is a worker task that performs search requests. False otherwise -
setWorker
Sets this task to be a worker task that performs search requests- Parameters:
requestsPerSecond- How many search requests per second this task should makesliceId- If this is is a sliced task, which slice number this task corresponds to. Null if not sliced.
-
getWorkerState
Returns the object that manages sending search requests. Throws IllegalStateException if this task is not set to be a worker task. -
onCancelled
public void onCancelled()Description copied from class:CancellableTaskCalled after the task is cancelled so that it can take any actions that it has to take.- Overrides:
onCancelledin classCancellableTask
-
isEligibleForRelocationOnShutdown
public boolean isEligibleForRelocationOnShutdown()Returns whether we should attempt to relocate this task to another node when the current node is preparing to shut down. -
requestRelocation
public void requestRelocation()Marks this task as requiring relocation to another node, e.g. because this node is about to shut down.This method is fire-and-forget and does not guarantee that relocation actually happens. (That can depend on various factors, such as whether a suitable new node is available, and whether the task is able to get to an appropriate point to stop work and trigger the relocation in time.)
This should only be called on tasks where
returns true. -
isRelocationRequested
public boolean isRelocationRequested()Returns whether this task has been marked as requiring relocation to another node. SeerequestRelocation(). -
relocationOrigin
Returns the relocation origin if this task is a relocated continuation. -
isRelocatedTask
public boolean isRelocatedTask()Returns true if this task was created via relocation from another node.
-