Interface CompletedCheckpointStore
-
- All Known Implementing Classes:
AbstractCompleteCheckpointStore,DeactivatedCheckpointCompletedCheckpointStore,DefaultCompletedCheckpointStore,EmbeddedCompletedCheckpointStore,StandaloneCompletedCheckpointStore
public interface CompletedCheckpointStoreA bounded LIFO-queue ofCompletedCheckpointinstances.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOG
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletedCheckpointaddCheckpointAndSubsumeOldestOne(CompletedCheckpoint checkpoint, CheckpointsCleaner checkpointsCleaner, Runnable postCleanup)Adds aCompletedCheckpointinstance to the list of completed checkpoints.List<CompletedCheckpoint>getAllCheckpoints()Returns allCompletedCheckpointinstances.default CompletedCheckpointgetLatestCheckpoint()Returns the latestCompletedCheckpointinstance ornullif none was added.default longgetLatestCheckpointId()Returns the id of the latest completed checkpoints.intgetMaxNumberOfRetainedCheckpoints()Returns the max number of retained checkpoints.intgetNumberOfRetainedCheckpoints()Returns the current number of retained checkpoints.SharedStateRegistrygetSharedStateRegistry()Returns theSharedStateRegistryused to register the shared state.booleanrequiresExternalizedCheckpoints()This method returns whether the completed checkpoint store requires checkpoints to be externalized.voidshutdown(org.apache.flink.api.common.JobStatus jobStatus, CheckpointsCleaner checkpointsCleaner)Shuts down the store.
-
-
-
Method Detail
-
addCheckpointAndSubsumeOldestOne
@Nullable CompletedCheckpoint addCheckpointAndSubsumeOldestOne(CompletedCheckpoint checkpoint, CheckpointsCleaner checkpointsCleaner, Runnable postCleanup) throws Exception
Adds aCompletedCheckpointinstance to the list of completed checkpoints.Only a bounded number of checkpoints is kept. When exceeding the maximum number of retained checkpoints, the oldest one will be discarded.
After FLINK-24611,
SharedStateRegistry.unregisterUnusedState(long)should be called here to subsume unused state. Note, theCompletedCheckpointpassed toSharedStateRegistry.registerAllAfterRestored(org.apache.flink.runtime.checkpoint.CompletedCheckpoint, org.apache.flink.core.execution.RecoveryClaimMode)orSharedStateRegistryFactory.create(java.util.concurrent.Executor, java.util.Collection<org.apache.flink.runtime.checkpoint.CompletedCheckpoint>, org.apache.flink.core.execution.RecoveryClaimMode)must be the same object as the input parameter, otherwise the state may be deleted by mistake.After FLINK-25872,
CheckpointsCleaner.cleanSubsumedCheckpoints(long, java.util.Set<java.lang.Long>, java.lang.Runnable, java.util.concurrent.Executor)should be called explicitly here.- Returns:
- the subsumed oldest completed checkpoint if possible, return null if no checkpoint needs to be discarded on subsume.
- Throws:
Exception
-
getLatestCheckpoint
default CompletedCheckpoint getLatestCheckpoint()
Returns the latestCompletedCheckpointinstance ornullif none was added.
-
getLatestCheckpointId
default long getLatestCheckpointId()
Returns the id of the latest completed checkpoints.
-
shutdown
void shutdown(org.apache.flink.api.common.JobStatus jobStatus, CheckpointsCleaner checkpointsCleaner) throws ExceptionShuts down the store.The job status is forwarded and used to decide whether state should actually be discarded or kept.
SharedStateRegistry.unregisterUnusedState(long)andCheckpointsCleaner.cleanSubsumedCheckpoints(long, java.util.Set<java.lang.Long>, java.lang.Runnable, java.util.concurrent.Executor)should be called here to subsume unused state.- Parameters:
jobStatus- Job state on shut downcheckpointsCleaner- that will cleanup completed checkpoints if needed- Throws:
Exception
-
getAllCheckpoints
List<CompletedCheckpoint> getAllCheckpoints()
Returns allCompletedCheckpointinstances.Returns an empty list if no checkpoint has been added yet.
-
getNumberOfRetainedCheckpoints
int getNumberOfRetainedCheckpoints()
Returns the current number of retained checkpoints.
-
getMaxNumberOfRetainedCheckpoints
int getMaxNumberOfRetainedCheckpoints()
Returns the max number of retained checkpoints.
-
requiresExternalizedCheckpoints
boolean requiresExternalizedCheckpoints()
This method returns whether the completed checkpoint store requires checkpoints to be externalized. Externalized checkpoints have their meta data persisted, which the checkpoint store can exploit (for example by simply pointing the persisted metadata).- Returns:
- True, if the store requires that checkpoints are externalized before being added, false if the store stores the metadata itself.
-
getSharedStateRegistry
SharedStateRegistry getSharedStateRegistry()
Returns theSharedStateRegistryused to register the shared state.
-
-