Package org.apache.ignite.internal
Class CheckCpHistTask
-
- All Implemented Interfaces:
Serializable
,ComputeTask<Map<UUID,Map<Integer,Set<Integer>>>,Boolean>
@GridInternal public class CheckCpHistTask extends ComputeTaskAdapter<Map<UUID,Map<Integer,Set<Integer>>>,Boolean>
Task that checks whether last checkpoint is applicable for providing history for all groups and partitions that are passed as parameters. If at least one group or partition can't be supplied due to absence of last checkpoint, the task enforces a checkpoint to ensure possibility of the historical rebalancing. The task takes as parametes a collection by fillowing structure: Map{node id -> Map{Group id -> Set{Partition id}}}. Each node that is mentioned in parameter is receiving own particular collection: Map{Group id -> Set{Partition id}}.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CheckCpHistTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<org.apache.ignite.internal.CheckCpHistTask.CheckCpHistClosureJob,ClusterNode>
map(List<ClusterNode> subgrid, Map<UUID,Map<Integer,Set<Integer>>> arg)
This method is called to map or split grid task into multiple grid jobs.Boolean
reduce(List<ComputeJobResult> results)
Reduces (or aggregates) results received so far into one compound result to be returned to caller viaComputeTaskFuture.get()
method.ComputeJobResultPolicy
result(ComputeJobResult res, List<ComputeJobResult> rcvd)
Default implementation which will wait for all jobs to complete before callingComputeTask.reduce(List)
method.
-
-
-
Field Detail
-
CP_REASON
public static final String CP_REASON
Reason of checkpoint, which can be triggered by this task.- See Also:
- Constant Field Values
-
-
Method Detail
-
map
public Map<org.apache.ignite.internal.CheckCpHistTask.CheckCpHistClosureJob,ClusterNode> map(List<ClusterNode> subgrid, Map<UUID,Map<Integer,Set<Integer>>> arg) throws IgniteException
This method is called to map or split grid task into multiple grid jobs. This is the first method that gets called when task execution starts.- Parameters:
subgrid
- Nodes available for this task execution. Note that order of nodes is guaranteed to be randomized by container. This ensures that every time you simply iterate through grid nodes, the order of nodes will be random which over time should result into all nodes being used equally.arg
- Task execution argument. Can benull
. This is the same argument as the one passed intoGrid#execute(...)
methods.- Returns:
- Map of grid jobs assigned to subgrid node. Unless
ComputeTaskContinuousMapper
is injected into task, ifnull
or empty map is returned, exception will be thrown. - Throws:
IgniteException
- If mapping could not complete successfully. This exception will be thrown out ofComputeTaskFuture.get()
method.
-
result
public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) throws IgniteException
Default implementation which will wait for all jobs to complete before callingComputeTask.reduce(List)
method.If remote job resulted in exception (
ComputeJobResult.getException()
is notnull
), thenComputeJobResultPolicy.FAILOVER
policy will be returned if the exception is instance ofClusterTopologyException
orComputeExecutionRejectedException
, which means that remote node either failed or job execution was rejected before it got a chance to start. In all other cases the exception will be rethrown which will ultimately cause task to fail.- Specified by:
result
in interfaceComputeTask<Map<UUID,Map<Integer,Set<Integer>>>,Boolean>
- Overrides:
result
in classComputeTaskAdapter<Map<UUID,Map<Integer,Set<Integer>>>,Boolean>
- Parameters:
res
- Received remote grid executable result.rcvd
- All previously received results.- Returns:
- Result policy that dictates how to process further upcoming job results.
- Throws:
IgniteException
- If handling a job result caused an error effectively rejecting a failover. This exception will be thrown out ofComputeTaskFuture.get()
method.
-
reduce
public Boolean reduce(List<ComputeJobResult> results) throws IgniteException
Reduces (or aggregates) results received so far into one compound result to be returned to caller viaComputeTaskFuture.get()
method.Note, that if some jobs did not succeed and could not be failed over then the list of results passed into this method will include the failed results. Otherwise, failed results will not be in the list.
- Parameters:
results
- Received results of broadcasted remote executions. Note that if task class hasComputeTaskNoResultCache
annotation, then this list will be empty.- Returns:
- Grid job result constructed from results of remote executions.
- Throws:
IgniteException
- If reduction or results caused an error. This exception will be thrown out ofComputeTaskFuture.get()
method.
-
-