Class StreamOperatorStateHandler
java.lang.Object
org.apache.flink.streaming.api.operators.StreamOperatorStateHandler
Class encapsulating various state backend handling logic for
StreamOperator
implementations.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCustom state handling hooks to be invoked byStreamOperatorStateHandler. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStreamOperatorStateHandler(StreamOperatorStateContext context, org.apache.flink.api.common.ExecutionConfig executionConfig, org.apache.flink.core.fs.CloseableRegistry closeableRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()<K> AsyncKeyedStateBackend<K><K> KeyedStateBackend<K>Optional<org.apache.flink.api.common.state.KeyedStateStore><K> org.apache.flink.api.common.typeutils.TypeSerializer<K><N,S extends org.apache.flink.api.common.state.v2.State, T>
SgetOrCreateKeyedState(N defaultNamespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor) Create new state (v2) based on new state descriptor.<N,S extends org.apache.flink.api.common.state.State, T>
SgetOrCreateKeyedState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S, T> stateDescriptor) protected <S extends org.apache.flink.api.common.state.State,N>
SgetPartitionedState(N namespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S, ?> stateDescriptor) Creates a partitioned state handle, using the state backend configured for this task.voidvoidnotifyCheckpointAborted(long checkpointId) voidnotifyCheckpointComplete(long checkpointId) static SnapshotStrategyRunner<KeyedStateHandle,? extends FullSnapshotResources<?>> prepareCanonicalSavepoint(CheckpointableKeyedStateBackend<?> keyedStateBackend, org.apache.flink.core.fs.CloseableRegistry closeableRegistry) voidsetCurrentKey(Object key) snapshotState(StreamOperatorStateHandler.CheckpointedStreamOperator streamOperator, Optional<InternalTimeServiceManager<?>> timeServiceManager, String operatorName, long checkpointId, long timestamp, CheckpointOptions checkpointOptions, CheckpointStreamFactory factory, boolean isUsingCustomRawKeyedState, boolean useAsyncState)
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
StreamOperatorStateHandler
public StreamOperatorStateHandler(StreamOperatorStateContext context, org.apache.flink.api.common.ExecutionConfig executionConfig, org.apache.flink.core.fs.CloseableRegistry closeableRegistry)
-
-
Method Details
-
initializeOperatorState
public void initializeOperatorState(StreamOperatorStateHandler.CheckpointedStreamOperator streamOperator) throws Exception - Throws:
Exception
-
dispose
- Throws:
Exception
-
snapshotState
public OperatorSnapshotFutures snapshotState(StreamOperatorStateHandler.CheckpointedStreamOperator streamOperator, Optional<InternalTimeServiceManager<?>> timeServiceManager, String operatorName, long checkpointId, long timestamp, CheckpointOptions checkpointOptions, CheckpointStreamFactory factory, boolean isUsingCustomRawKeyedState, boolean useAsyncState) throws CheckpointException - Throws:
CheckpointException
-
prepareCanonicalSavepoint
@Nonnull public static SnapshotStrategyRunner<KeyedStateHandle,? extends FullSnapshotResources<?>> prepareCanonicalSavepoint(CheckpointableKeyedStateBackend<?> keyedStateBackend, org.apache.flink.core.fs.CloseableRegistry closeableRegistry) throws Exception - Throws:
Exception
-
notifyCheckpointComplete
- Throws:
Exception
-
notifyCheckpointAborted
- Throws:
Exception
-
getKeySerializer
public <K> org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer() -
getKeyedStateBackend
-
getAsyncKeyedStateBackend
-
getOperatorStateBackend
-
getOrCreateKeyedState
public <N,S extends org.apache.flink.api.common.state.State, S getOrCreateKeyedStateT> (org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S, T> stateDescriptor) throws Exception- Throws:
Exception
-
getOrCreateKeyedState
public <N,S extends org.apache.flink.api.common.state.v2.State, S getOrCreateKeyedStateT> (N defaultNamespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor) throws Exception Create new state (v2) based on new state descriptor.- Throws:
Exception
-
getPartitionedState
protected <S extends org.apache.flink.api.common.state.State,N> S getPartitionedState(N namespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S, ?> stateDescriptor) throws ExceptionCreates a partitioned state handle, using the state backend configured for this task.- Throws:
IllegalStateException- Thrown, if the key/value state was already initialized.Exception- Thrown, if the state backend cannot create the key/value state.
-
setCurrentKey
-
getCurrentKey
-
getAsyncInternalTimerServiceManager
-
getKeyedStateStore
-