Package org.elasticsearch.persistent
In order to be resilient to node restarts, the persistent tasks are using the cluster state instead of a transport service to send requests and responses. The execution is done in six phases:
1. The coordinating node sends an ordinary transport request to the master node to start a new persistent task. This task is handled
by the PersistentTasksService
, which is using
PersistentTasksClusterService
to update cluster state with the record about running persistent
task.
2. The master node updates the PersistentTasksCustomMetaData
in the cluster state to indicate
that there is a new persistent task running in the system.
3. The PersistentTasksNodeService
running on every node in the cluster monitors changes in
the cluster state and starts execution of all new tasks assigned to the node it is running on.
4. If the task fails to start on the node, the PersistentTasksNodeService
uses the
PersistentTasksCustomMetaData
to notify the
PersistentTasksService
, which reassigns the action to another node in the cluster.
5. If a task finishes successfully on the node and calls listener.onResponse(), the corresponding persistent action is removed from the cluster state unless removeOnCompletion flag for this task is set to false.
6. The RemovePersistentTaskAction
action can be also used to remove the persistent task.
-
Interface Summary Interface Description PersistentTaskParams Parameters used to start persistent taskPersistentTasksService.WaitForPersistentTaskListener<P extends PersistentTaskParams> PersistentTaskState PersistentTaskState
represents the state of the persistent tasks, as it is persisted in the cluster state. -
Class Summary Class Description AllocatedPersistentTask Represents a executor node operation that corresponds to a persistent taskCompletionPersistentTaskAction Action that is used by executor node to indicate that the persistent action finished or failed on the node and needs to be removed from the cluster state in case of successful completion or restarted on some other node in case of failure.CompletionPersistentTaskAction.Request CompletionPersistentTaskAction.RequestBuilder CompletionPersistentTaskAction.TransportAction NodePersistentTasksExecutor This component is responsible for execution of persistent tasks.PersistentTaskResponse Response upon a successful start or an persistent taskPersistentTasksClusterService Component that runs only on the master node and is responsible for assigning running tasks to nodesPersistentTasksCustomMetaData A cluster state record that contains a list of all running persistent tasksPersistentTasksCustomMetaData.Assignment PersistentTasksCustomMetaData.Builder PersistentTasksCustomMetaData.PersistentTask<P extends PersistentTaskParams> A record that represents a single running persistent taskPersistentTasksExecutor<Params extends PersistentTaskParams> An executor of tasks that can survive restart of requesting or executing node.PersistentTasksExecutorRegistry Components that registers all persistent task executorsPersistentTasksNodeService This component is responsible for coordination of execution of persistent tasks on individual nodes.PersistentTasksNodeService.Status PersistentTasksService This service is used by persistent tasks and allocated persistent tasks to communicate changes to the master node so that the master can update the cluster state and can track of the states of the persistent tasks.RemovePersistentTaskAction RemovePersistentTaskAction.Request RemovePersistentTaskAction.RequestBuilder RemovePersistentTaskAction.TransportAction StartPersistentTaskAction This action can be used to add the record for the persistent action to the cluster state.StartPersistentTaskAction.Request StartPersistentTaskAction.RequestBuilder StartPersistentTaskAction.TransportAction UpdatePersistentTaskStatusAction UpdatePersistentTaskStatusAction.Request UpdatePersistentTaskStatusAction.RequestBuilder UpdatePersistentTaskStatusAction.TransportAction -
Enum Summary Enum Description AllocatedPersistentTask.State