Class EmbeddedCompletedCheckpointStore
- java.lang.Object
-
- org.apache.flink.runtime.checkpoint.AbstractCompleteCheckpointStore
-
- org.apache.flink.runtime.checkpoint.EmbeddedCompletedCheckpointStore
-
- All Implemented Interfaces:
CompletedCheckpointStore
public class EmbeddedCompletedCheckpointStore extends AbstractCompleteCheckpointStore
An embedded in-memory checkpoint store, which supports shutdown and suspend.
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.runtime.checkpoint.CompletedCheckpointStore
LOG
-
-
Constructor Summary
Constructors Constructor Description EmbeddedCompletedCheckpointStore()EmbeddedCompletedCheckpointStore(int maxRetainedCheckpoints)EmbeddedCompletedCheckpointStore(int maxRetainedCheckpoints, Collection<CompletedCheckpoint> initialCheckpoints, org.apache.flink.core.execution.RecoveryClaimMode recoveryClaimMode)EmbeddedCompletedCheckpointStore(int maxRetainedCheckpoints, Collection<CompletedCheckpoint> initialCheckpoints, SharedStateRegistry sharedStateRegistry)
-
Method Summary
All Methods Instance Methods Concrete 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.intgetMaxNumberOfRetainedCheckpoints()Returns the max number of retained checkpoints.intgetNumberOfRetainedCheckpoints()Returns the current number of retained checkpoints.Optional<org.apache.flink.api.common.JobStatus>getShutdownStatus()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.-
Methods inherited from class org.apache.flink.runtime.checkpoint.AbstractCompleteCheckpointStore
findLowest, getSharedStateRegistry, unregisterUnusedState
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.checkpoint.CompletedCheckpointStore
getLatestCheckpoint, getLatestCheckpointId
-
-
-
-
Constructor Detail
-
EmbeddedCompletedCheckpointStore
@VisibleForTesting public EmbeddedCompletedCheckpointStore()
-
EmbeddedCompletedCheckpointStore
@VisibleForTesting public EmbeddedCompletedCheckpointStore(int maxRetainedCheckpoints)
-
EmbeddedCompletedCheckpointStore
public EmbeddedCompletedCheckpointStore(int maxRetainedCheckpoints, Collection<CompletedCheckpoint> initialCheckpoints, org.apache.flink.core.execution.RecoveryClaimMode recoveryClaimMode)
-
EmbeddedCompletedCheckpointStore
public EmbeddedCompletedCheckpointStore(int maxRetainedCheckpoints, Collection<CompletedCheckpoint> initialCheckpoints, SharedStateRegistry sharedStateRegistry)
-
-
Method Detail
-
addCheckpointAndSubsumeOldestOne
public CompletedCheckpoint addCheckpointAndSubsumeOldestOne(CompletedCheckpoint checkpoint, CheckpointsCleaner checkpointsCleaner, Runnable postCleanup) throws Exception
Description copied from interface:CompletedCheckpointStoreAdds 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
-
shutdown
public void shutdown(org.apache.flink.api.common.JobStatus jobStatus, CheckpointsCleaner checkpointsCleaner) throws ExceptionDescription copied from interface:CompletedCheckpointStoreShuts 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.- Specified by:
shutdownin interfaceCompletedCheckpointStore- Overrides:
shutdownin classAbstractCompleteCheckpointStore- Parameters:
jobStatus- Job state on shut downcheckpointsCleaner- that will cleanup completed checkpoints if needed- Throws:
Exception
-
getAllCheckpoints
public List<CompletedCheckpoint> getAllCheckpoints()
Description copied from interface:CompletedCheckpointStoreReturns allCompletedCheckpointinstances.Returns an empty list if no checkpoint has been added yet.
-
getNumberOfRetainedCheckpoints
public int getNumberOfRetainedCheckpoints()
Description copied from interface:CompletedCheckpointStoreReturns the current number of retained checkpoints.
-
getMaxNumberOfRetainedCheckpoints
public int getMaxNumberOfRetainedCheckpoints()
Description copied from interface:CompletedCheckpointStoreReturns the max number of retained checkpoints.
-
requiresExternalizedCheckpoints
public boolean requiresExternalizedCheckpoints()
Description copied from interface:CompletedCheckpointStoreThis 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.
-
getShutdownStatus
public Optional<org.apache.flink.api.common.JobStatus> getShutdownStatus()
-
-