Class StreamTaskStateInitializerImpl
java.lang.Object
org.apache.flink.streaming.api.operators.StreamTaskStateInitializerImpl
- All Implemented Interfaces:
StreamTaskStateInitializer
This class is the main implementation of a
StreamTaskStateInitializer. This class obtains
the state to create StreamOperatorStateContext objects for stream operators from the
TaskStateManager of the task that runs the stream task and hence the operator.
This implementation operates on top a TaskStateManager, from which it receives
everything required to restore state in the backends from checkpoints or savepoints.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceStreamTaskStateInitializerImpl.KeyedStateBackendCreator<K,R extends org.apache.flink.util.Disposable & Closeable> Functional interface to create the keyed state backend. -
Constructor Summary
ConstructorsConstructorDescriptionStreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend) StreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend, SubTaskInitializationMetricsBuilder initializationMetrics, TtlTimeProvider ttlTimeProvider, InternalTimeServiceManager.Provider timeServiceManagerProvider, StreamTaskCancellationContext cancellationContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected <K,R extends org.apache.flink.util.Disposable & Closeable>
RkeyedStatedBackend(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, org.apache.flink.core.fs.CloseableRegistry backendCloseableRegistry, org.apache.flink.metrics.MetricGroup metricGroup, double managedMemoryFraction, StateObject.StateObjectSizeStatsCollector statsCollector, StreamTaskStateInitializerImpl.KeyedStateBackendCreator<K, R> keyedStateBackendCreator) protected OperatorStateBackendoperatorStateBackend(String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, org.apache.flink.core.fs.CloseableRegistry backendCloseableRegistry, StateObject.StateObjectSizeStatsCollector statsCollector) protected org.apache.flink.util.CloseableIterable<KeyGroupStatePartitionStreamProvider>rawKeyedStateInputs(Iterator<StateObjectCollection<KeyedStateHandle>> restoreStateAlternatives, StateObject.StateObjectSizeStatsCollector statsCollector) protected org.apache.flink.util.CloseableIterable<StatePartitionStreamProvider>rawOperatorStateInputs(Iterator<StateObjectCollection<OperatorStateHandle>> restoreStateAlternatives, StateObject.StateObjectSizeStatsCollector statsCollector) streamOperatorStateContext(OperatorID operatorID, String operatorClassName, ProcessingTimeService processingTimeService, KeyContext keyContext, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer, org.apache.flink.core.fs.CloseableRegistry streamTaskCloseableRegistry, org.apache.flink.metrics.MetricGroup metricGroup, double managedMemoryFraction, boolean isUsingCustomRawKeyedState, boolean isAsyncState) Returns theStreamOperatorStateContextfor anAbstractStreamOperatorthat runs in the stream task that owns this manager.
-
Constructor Details
-
StreamTaskStateInitializerImpl
-
StreamTaskStateInitializerImpl
public StreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend, SubTaskInitializationMetricsBuilder initializationMetrics, TtlTimeProvider ttlTimeProvider, InternalTimeServiceManager.Provider timeServiceManagerProvider, StreamTaskCancellationContext cancellationContext)
-
-
Method Details
-
streamOperatorStateContext
public StreamOperatorStateContext streamOperatorStateContext(@Nonnull OperatorID operatorID, @Nonnull String operatorClassName, @Nonnull ProcessingTimeService processingTimeService, @Nonnull KeyContext keyContext, @Nullable org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer, @Nonnull org.apache.flink.core.fs.CloseableRegistry streamTaskCloseableRegistry, @Nonnull org.apache.flink.metrics.MetricGroup metricGroup, double managedMemoryFraction, boolean isUsingCustomRawKeyedState, boolean isAsyncState) throws Exception Description copied from interface:StreamTaskStateInitializerReturns theStreamOperatorStateContextfor anAbstractStreamOperatorthat runs in the stream task that owns this manager.- Specified by:
streamOperatorStateContextin interfaceStreamTaskStateInitializer- Parameters:
operatorID- the id of the operator for which the context is created. Cannot be null.operatorClassName- the classname of the operator instance for which the context is created. Cannot be null.keyContext- the key context of the operator instance for which the context is created Cannot be null.keySerializer- the key-serializer for the operator. Can be null.streamTaskCloseableRegistry- the closeable registry to which created closeable objects will be registered.metricGroup- the parent metric group for all statebackend metricsmanagedMemoryFraction- the managed memory fraction of the operator for state backendisUsingCustomRawKeyedState- flag indicating whether or not theAbstractStreamOperatoris writing custom raw keyed state.- Returns:
- a context from which the given operator can initialize everything related to state.
- Throws:
Exception- when something went wrong while creating the context.
-
operatorStateBackend
protected OperatorStateBackend operatorStateBackend(String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, org.apache.flink.core.fs.CloseableRegistry backendCloseableRegistry, StateObject.StateObjectSizeStatsCollector statsCollector) throws Exception - Throws:
Exception
-
keyedStatedBackend
protected <K,R extends org.apache.flink.util.Disposable & Closeable> R keyedStatedBackend(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, org.apache.flink.core.fs.CloseableRegistry backendCloseableRegistry, org.apache.flink.metrics.MetricGroup metricGroup, double managedMemoryFraction, StateObject.StateObjectSizeStatsCollector statsCollector, StreamTaskStateInitializerImpl.KeyedStateBackendCreator<K, R> keyedStateBackendCreator) throws Exception- Throws:
Exception
-
rawOperatorStateInputs
protected org.apache.flink.util.CloseableIterable<StatePartitionStreamProvider> rawOperatorStateInputs(@Nonnull Iterator<StateObjectCollection<OperatorStateHandle>> restoreStateAlternatives, @Nonnull StateObject.StateObjectSizeStatsCollector statsCollector) -
rawKeyedStateInputs
protected org.apache.flink.util.CloseableIterable<KeyGroupStatePartitionStreamProvider> rawKeyedStateInputs(@Nonnull Iterator<StateObjectCollection<KeyedStateHandle>> restoreStateAlternatives, @Nonnull StateObject.StateObjectSizeStatsCollector statsCollector)
-