Class PendingCheckpoint
- java.lang.Object
-
- org.apache.flink.runtime.checkpoint.PendingCheckpoint
-
- All Implemented Interfaces:
Checkpoint
@NotThreadSafe public class PendingCheckpoint extends Object implements Checkpoint
A pending checkpoint is a checkpoint that has been started, but has not been acknowledged by all tasks that need to acknowledge it. Once all tasks have acknowledged it, it becomes aCompletedCheckpoint
.Note that the pending checkpoint, as well as the successful checkpoint keep the state handles always as serialized values, never as actual values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PendingCheckpoint.PendingCheckpointDiscardObject
Implementation ofCheckpoint.DiscardObject
forPendingCheckpoint
.static class
PendingCheckpoint.TaskAcknowledgeResult
Result of theacknowledgedTasks
method.-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.checkpoint.Checkpoint
Checkpoint.DiscardObject
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.runtime.checkpoint.Checkpoint
NOOP_DISCARD_OBJECT
-
-
Constructor Summary
Constructors Constructor Description PendingCheckpoint(JobID jobId, long checkpointId, long checkpointTimestamp, CheckpointPlan checkpointPlan, Collection<OperatorID> operatorCoordinatorsToConfirm, Collection<String> masterStateIdentifiers, CheckpointProperties props, CompletableFuture<CompletedCheckpoint> onCompletionPromise, PendingCheckpointStats pendingCheckpointStats, CompletableFuture<Void> masterTriggerCompletionPromise)
-
Method Summary
-
-
-
Constructor Detail
-
PendingCheckpoint
public PendingCheckpoint(JobID jobId, long checkpointId, long checkpointTimestamp, CheckpointPlan checkpointPlan, Collection<OperatorID> operatorCoordinatorsToConfirm, Collection<String> masterStateIdentifiers, CheckpointProperties props, CompletableFuture<CompletedCheckpoint> onCompletionPromise, @Nullable PendingCheckpointStats pendingCheckpointStats, CompletableFuture<Void> masterTriggerCompletionPromise)
-
-
Method Detail
-
getJobId
public JobID getJobId()
-
getCheckpointID
public long getCheckpointID()
- Specified by:
getCheckpointID
in interfaceCheckpoint
-
setCheckpointTargetLocation
public void setCheckpointTargetLocation(CheckpointStorageLocation targetLocation)
-
getCheckpointStorageLocation
public CheckpointStorageLocation getCheckpointStorageLocation()
-
getCheckpointTimestamp
public long getCheckpointTimestamp()
-
getNumberOfNonAcknowledgedTasks
public int getNumberOfNonAcknowledgedTasks()
-
getNumberOfNonAcknowledgedOperatorCoordinators
public int getNumberOfNonAcknowledgedOperatorCoordinators()
-
getCheckpointPlan
public CheckpointPlan getCheckpointPlan()
-
getNumberOfAcknowledgedTasks
public int getNumberOfAcknowledgedTasks()
-
getOperatorStates
public Map<OperatorID,OperatorState> getOperatorStates()
-
getMasterStates
public List<MasterState> getMasterStates()
-
isFullyAcknowledged
public boolean isFullyAcknowledged()
-
isAcknowledgedBy
public boolean isAcknowledgedBy(ExecutionAttemptID executionAttemptId)
-
isDisposed
public boolean isDisposed()
-
canBeSubsumed
public boolean canBeSubsumed()
Checks whether this checkpoint can be subsumed or whether it should always continue, regardless of newer checkpoints in progress.- Returns:
- True if the checkpoint can be subsumed, false otherwise.
-
setCancellerHandle
public boolean setCancellerHandle(ScheduledFuture<?> cancellerHandle)
Sets the handle for the canceller to this pending checkpoint. This method fails with an exception if a handle has already been set.- Returns:
- true, if the handle was set, false, if the checkpoint is already disposed;
-
getFailureCause
public CheckpointException getFailureCause()
-
getCompletionFuture
public CompletableFuture<CompletedCheckpoint> getCompletionFuture()
Returns the completion future.- Returns:
- A future to the completed checkpoint
-
finalizeCheckpoint
public CompletedCheckpoint finalizeCheckpoint(CheckpointsCleaner checkpointsCleaner, Runnable postCleanup, Executor executor) throws IOException
- Throws:
IOException
-
acknowledgeTask
public PendingCheckpoint.TaskAcknowledgeResult acknowledgeTask(ExecutionAttemptID executionAttemptId, TaskStateSnapshot operatorSubtaskStates, CheckpointMetrics metrics)
Acknowledges the task with the given execution attempt id and the given subtask state.- Parameters:
executionAttemptId
- of the acknowledged taskoperatorSubtaskStates
- of the acknowledged taskmetrics
- Checkpoint metrics for the stats- Returns:
- TaskAcknowledgeResult of the operation
-
acknowledgeCoordinatorState
public PendingCheckpoint.TaskAcknowledgeResult acknowledgeCoordinatorState(OperatorInfo coordinatorInfo, @Nullable ByteStreamStateHandle stateHandle)
-
acknowledgeMasterState
public void acknowledgeMasterState(String identifier, @Nullable MasterState state)
Acknowledges a master state (state generated on the checkpoint coordinator) to the pending checkpoint.- Parameters:
identifier
- The identifier of the master statestate
- The state to acknowledge
-
abort
public void abort(CheckpointFailureReason reason, @Nullable Throwable cause, CheckpointsCleaner checkpointsCleaner, Runnable postCleanup, Executor executor, CheckpointStatsTracker statsTracker)
Aborts a checkpoint with reason and cause.
-
markAsDiscarded
public Checkpoint.DiscardObject markAsDiscarded()
Description copied from interface:Checkpoint
This method precede theCheckpoint.DiscardObject.discard()
method and should be called from theCheckpointCoordinator
(under the lock) whileCheckpoint.DiscardObject.discard()
can be called from any thread/place.- Specified by:
markAsDiscarded
in interfaceCheckpoint
-
-