Interface StateObject
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
ChangelogStateBackendHandle,ChangelogStateHandle,ChannelState,CheckpointBoundKeyedStateHandle,CompositeStateHandle,IncrementalKeyedStateHandle,InputStateHandle,KeyedStateHandle,OperatorStateHandle,OutputStateHandle,RetrievableStateHandle<T>,SavepointKeyedStateHandle,StreamStateHandle
- All Known Implementing Classes:
AbstractChannelStateHandle,AbstractIncrementalStateHandle,AbstractMergedChannelStateHandle,ByteStreamStateHandle,ChainedStateHandle,ChangelogStateBackendHandle.ChangelogStateBackendHandleImpl,ChangelogStateBackendLocalHandle,ChangelogStateHandleStreamImpl,DirectoryStateHandle,DirectoryStreamStateHandle,EmptyFileMergingOperatorStreamStateHandle,EmptySegmentFileStateHandle,FileMergingOperatorStreamStateHandle,FileStateHandle,FinishedOperatorSubtaskState,FullyFinishedOperatorState,IncrementalLocalKeyedStateHandle,IncrementalRemoteKeyedStateHandle,InMemoryChangelogStateHandle,InputChannelStateHandle,KeyGroupsSavepointStateHandle,KeyGroupsStateHandle,MergedInputChannelStateHandle,MergedResultSubpartitionStateHandle,OperatorState,OperatorStreamStateHandle,OperatorSubtaskState,PlaceholderStreamStateHandle,RelativeFileStateHandle,ResultSubpartitionStateHandle,RetrievableStreamStateHandle,SegmentFileStateHandle,SharedStateRegistryImpl.EmptyDiscardStateObjectForRegister,SnapshotResult,StateObjectCollection,SubtaskState,TaskState,TaskStateSnapshot
public interface StateObject extends Serializable
Base of all handles that represent checkpointed state in some form. The object may hold the (small) state directly, or contain a file path (state is in the file), or contain the metadata to access the state stored in some external database.State objects define how to
discard stateand how to access thesize of the state.State Objects are transported via RPC between JobManager and TaskManager and must be
serializableto support that.Some State Objects are stored in the checkpoint/savepoint metadata. For long-term compatibility, they are not stored via
Java Serialization, but through custom serializers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classStateObject.StateObjectLocationEnum for state locations.static classStateObject.StateObjectSizeStatsCollectorCollector for size and location stats from a state object viacollectSizeStats(StateObjectSizeStatsCollector).
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcollectSizeStats(StateObject.StateObjectSizeStatsCollector collector)Collects statistics about state size and location from the state object.voiddiscardState()Discards the state referred to and solemnly owned by this handle, to free up resources in the persistent storage.longgetStateSize()Returns the size of the state in bytes.
-
-
-
Method Detail
-
discardState
void discardState() throws ExceptionDiscards the state referred to and solemnly owned by this handle, to free up resources in the persistent storage. This method is called when the state represented by this object will not be used anymore.- Throws:
Exception
-
getStateSize
long getStateSize()
Returns the size of the state in bytes. If the size is not known, this method should return0.The values produced by this method are only used for informational purposes and for metrics/monitoring. If this method returns wrong values, the checkpoints and recovery will still behave correctly. However, efficiency may be impacted (wrong space pre-allocation) and functionality that depends on metrics (like monitoring) will be impacted.
Note for implementors: This method should not perform any I/O operations while obtaining the state size (hence it does not declare throwing an
IOException). Instead, the state size should be stored in the state object, or should be computable from the state stored in this object. The reason is that this method is called frequently by several parts of the checkpointing and issuing I/O requests from this method accumulates a heavy I/O load on the storage system at higher scale.- Returns:
- Size of the state in bytes.
-
collectSizeStats
default void collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
Collects statistics about state size and location from the state object.- Parameters:
collector- the statistics collector.
-
-