Class ForStNativeFullSnapshotStrategy<K>
- java.lang.Object
-
- org.apache.flink.state.forst.snapshot.ForStSnapshotStrategyBase<K,ForStSnapshotStrategyBase.ForStNativeSnapshotResources>
-
- org.apache.flink.state.forst.snapshot.ForStNativeFullSnapshotStrategy<K>
-
- Type Parameters:
K
- type of the backend keys.
- All Implemented Interfaces:
AutoCloseable
,CheckpointListener
,SnapshotStrategy<KeyedStateHandle,ForStSnapshotStrategyBase.ForStNativeSnapshotResources>
- Direct Known Subclasses:
ForStIncrementalSnapshotStrategy
public class ForStNativeFullSnapshotStrategy<K> extends ForStSnapshotStrategyBase<K,ForStSnapshotStrategyBase.ForStNativeSnapshotResources>
Snapshot strategy forForStKeyedStateBackend
that is based on disableFileDeletions()+getLiveFiles() of ForSt and creates full snapshots.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.state.forst.snapshot.ForStSnapshotStrategyBase
ForStSnapshotStrategyBase.ForStNativeSnapshotResources, ForStSnapshotStrategyBase.ForStSnapshotOperation, ForStSnapshotStrategyBase.ForStSyncSnapshotResources, ForStSnapshotStrategyBase.PreviousSnapshot
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.state.SnapshotStrategy
SnapshotStrategy.SnapshotResultSupplier<S extends StateObject>
-
-
Field Summary
Fields Modifier and Type Field Description protected ForStStateDataTransfer
stateTransfer
The help class used to upload state files.-
Fields inherited from class org.apache.flink.state.forst.snapshot.ForStSnapshotStrategyBase
backendUID, db, EMPTY_PREVIOUS_SNAPSHOT, keyGroupPrefixBytes, keyGroupRange, keySerializer, kvStateInformation, resourceContainer, resourceGuard
-
-
Constructor Summary
Constructors Constructor Description ForStNativeFullSnapshotStrategy(String description, org.forstdb.RocksDB db, ResourceGuard resourceGuard, ForStResourceContainer resourceContainer, TypeSerializer<K> keySerializer, LinkedHashMap<String,ForStOperationUtils.ForStKvStateInfo> kvStateInformation, KeyGroupRange keyGroupRange, int keyGroupPrefixBytes, UUID backendUID, ForStStateDataTransfer stateTransfer)
ForStNativeFullSnapshotStrategy(org.forstdb.RocksDB db, ResourceGuard resourceGuard, ForStResourceContainer resourceContainer, TypeSerializer<K> keySerializer, LinkedHashMap<String,ForStOperationUtils.ForStKvStateInfo> kvStateInformation, KeyGroupRange keyGroupRange, int keyGroupPrefixBytes, UUID backendUID, ForStStateDataTransfer stateTransfer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SnapshotStrategy.SnapshotResultSupplier<KeyedStateHandle>
asyncSnapshot(ForStSnapshotStrategyBase.ForStNativeSnapshotResources syncPartResource, long checkpointId, long timestamp, CheckpointStreamFactory streamFactory, CheckpointOptions checkpointOptions)
Operation that writes a snapshot into a stream that is provided by the givenCheckpointStreamFactory
and returns a @SupplierWithException
that gives a state handle to the snapshot.void
close()
void
notifyCheckpointAborted(long abortedCheckpointId)
This method is called as a notification once a distributed checkpoint has been aborted.void
notifyCheckpointComplete(long checkpointId)
Notifies the listener that the checkpoint with the givencheckpointId
completed and was committed.protected ForStSnapshotStrategyBase.PreviousSnapshot
snapshotMetaData(long checkpointId, List<StateMetaInfoSnapshot> stateMetaInfoSnapshots)
ForStSnapshotStrategyBase.ForStNativeSnapshotResources
syncPrepareResources(long checkpointId)
Performs the synchronous part of the snapshot.-
Methods inherited from class org.apache.flink.state.forst.snapshot.ForStSnapshotStrategyBase
cleanupIncompleteSnapshot, getDescription, materializeMetaData
-
-
-
-
Field Detail
-
stateTransfer
protected final ForStStateDataTransfer stateTransfer
The help class used to upload state files.
-
-
Constructor Detail
-
ForStNativeFullSnapshotStrategy
public ForStNativeFullSnapshotStrategy(@Nonnull org.forstdb.RocksDB db, @Nonnull ResourceGuard resourceGuard, @Nonnull ForStResourceContainer resourceContainer, @Nonnull TypeSerializer<K> keySerializer, @Nonnull LinkedHashMap<String,ForStOperationUtils.ForStKvStateInfo> kvStateInformation, @Nonnull KeyGroupRange keyGroupRange, int keyGroupPrefixBytes, @Nonnull UUID backendUID, @Nonnull ForStStateDataTransfer stateTransfer)
-
ForStNativeFullSnapshotStrategy
public ForStNativeFullSnapshotStrategy(@Nonnull String description, @Nonnull org.forstdb.RocksDB db, @Nonnull ResourceGuard resourceGuard, @Nonnull ForStResourceContainer resourceContainer, @Nonnull TypeSerializer<K> keySerializer, @Nonnull LinkedHashMap<String,ForStOperationUtils.ForStKvStateInfo> kvStateInformation, @Nonnull KeyGroupRange keyGroupRange, int keyGroupPrefixBytes, @Nonnull UUID backendUID, @Nonnull ForStStateDataTransfer stateTransfer)
-
-
Method Detail
-
snapshotMetaData
protected ForStSnapshotStrategyBase.PreviousSnapshot snapshotMetaData(long checkpointId, @Nonnull List<StateMetaInfoSnapshot> stateMetaInfoSnapshots)
- Specified by:
snapshotMetaData
in classForStSnapshotStrategyBase<K,ForStSnapshotStrategyBase.ForStNativeSnapshotResources>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classForStSnapshotStrategyBase<K,ForStSnapshotStrategyBase.ForStNativeSnapshotResources>
-
notifyCheckpointAborted
public void notifyCheckpointAborted(long abortedCheckpointId)
Description copied from interface:CheckpointListener
This method is called as a notification once a distributed checkpoint has been aborted.Important: The fact that a checkpoint has been aborted does NOT mean that the data and artifacts produced between the previous checkpoint and the aborted checkpoint are to be discarded. The expected behavior is as if this checkpoint was never triggered in the first place, and the next successful checkpoint simply covers a longer time span. See the "Checkpoint Subsuming Contract" in the
class-level JavaDocs
for details.These notifications are "best effort", meaning they can sometimes be skipped.
This method is very rarely necessary to implement. The "best effort" guarantee, together with the fact that this method should not result in discarding any data (per the "Checkpoint Subsuming Contract") means it is mainly useful for earlier cleanups of auxiliary resources. One example is to pro-actively clear a local per-checkpoint state cache upon checkpoint failure.
- Parameters:
abortedCheckpointId
- The ID of the checkpoint that has been aborted.
-
notifyCheckpointComplete
public void notifyCheckpointComplete(long checkpointId) throws Exception
Description copied from interface:CheckpointListener
Notifies the listener that the checkpoint with the givencheckpointId
completed and was committed.These notifications are "best effort", meaning they can sometimes be skipped. To behave properly, implementers need to follow the "Checkpoint Subsuming Contract". Please see the
class-level JavaDocs
for details.Please note that checkpoints may generally overlap, so you cannot assume that the
notifyCheckpointComplete()
call is always for the latest prior checkpoint (or snapshot) that was taken on the function/operator implementing this interface. It might be for a checkpoint that was triggered earlier. Implementing the "Checkpoint Subsuming Contract" (see above) properly handles this situation correctly as well.Please note that throwing exceptions from this method will not cause the completed checkpoint to be revoked. Throwing exceptions will typically cause task/job failure and trigger recovery.
- Parameters:
checkpointId
- The ID of the checkpoint that has been completed.- Throws:
Exception
- This method can propagate exceptions, which leads to a failure/recovery for the task. Note that this will NOT lead to the checkpoint being revoked.
-
syncPrepareResources
public ForStSnapshotStrategyBase.ForStNativeSnapshotResources syncPrepareResources(long checkpointId) throws Exception
Description copied from interface:SnapshotStrategy
Performs the synchronous part of the snapshot. It returns resources which can be later on used in the asynchronous part.- Parameters:
checkpointId
- The ID of the checkpoint.- Returns:
- Resources needed to finish the snapshot.
- Throws:
Exception
-
asyncSnapshot
public SnapshotStrategy.SnapshotResultSupplier<KeyedStateHandle> asyncSnapshot(ForStSnapshotStrategyBase.ForStNativeSnapshotResources syncPartResource, long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory streamFactory, @Nonnull CheckpointOptions checkpointOptions)
Description copied from interface:SnapshotStrategy
Operation that writes a snapshot into a stream that is provided by the givenCheckpointStreamFactory
and returns a @SupplierWithException
that gives a state handle to the snapshot.checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.streamFactory
- The factory that we can use for writing our state to streams.checkpointOptions
- Options for how to perform this checkpoint.- Returns:
- A supplier that will yield a
StateObject
.
-
-