public class StreamTaskStateInitializerImpl extends Object implements StreamTaskStateInitializer
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.
Constructor and Description |
---|
StreamTaskStateInitializerImpl(Environment environment,
StateBackend stateBackend) |
StreamTaskStateInitializerImpl(Environment environment,
StateBackend stateBackend,
TtlTimeProvider ttlTimeProvider,
InternalTimeServiceManager.Provider timeServiceManagerProvider) |
Modifier and Type | Method and Description |
---|---|
protected <K> CheckpointableKeyedStateBackend<K> |
keyedStatedBackend(TypeSerializer<K> keySerializer,
String operatorIdentifierText,
PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates,
CloseableRegistry backendCloseableRegistry,
MetricGroup metricGroup,
double managedMemoryFraction) |
protected OperatorStateBackend |
operatorStateBackend(String operatorIdentifierText,
PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates,
CloseableRegistry backendCloseableRegistry) |
protected CloseableIterable<KeyGroupStatePartitionStreamProvider> |
rawKeyedStateInputs(Iterator<StateObjectCollection<KeyedStateHandle>> restoreStateAlternatives) |
protected CloseableIterable<StatePartitionStreamProvider> |
rawOperatorStateInputs(Iterator<StateObjectCollection<OperatorStateHandle>> restoreStateAlternatives) |
StreamOperatorStateContext |
streamOperatorStateContext(OperatorID operatorID,
String operatorClassName,
ProcessingTimeService processingTimeService,
KeyContext keyContext,
TypeSerializer<?> keySerializer,
CloseableRegistry streamTaskCloseableRegistry,
MetricGroup metricGroup,
double managedMemoryFraction,
boolean isUsingCustomRawKeyedState)
Returns the
StreamOperatorStateContext for an AbstractStreamOperator that
runs in the stream task that owns this manager. |
public StreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend)
@VisibleForTesting public StreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend, TtlTimeProvider ttlTimeProvider, InternalTimeServiceManager.Provider timeServiceManagerProvider)
public StreamOperatorStateContext streamOperatorStateContext(@Nonnull OperatorID operatorID, @Nonnull String operatorClassName, @Nonnull ProcessingTimeService processingTimeService, @Nonnull KeyContext keyContext, @Nullable TypeSerializer<?> keySerializer, @Nonnull CloseableRegistry streamTaskCloseableRegistry, @Nonnull MetricGroup metricGroup, double managedMemoryFraction, boolean isUsingCustomRawKeyedState) throws Exception
StreamTaskStateInitializer
StreamOperatorStateContext
for an AbstractStreamOperator
that
runs in the stream task that owns this manager.streamOperatorStateContext
in interface StreamTaskStateInitializer
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 the AbstractStreamOperator
is writing custom raw keyed state.Exception
- when something went wrong while creating the context.protected OperatorStateBackend operatorStateBackend(String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, CloseableRegistry backendCloseableRegistry) throws Exception
Exception
protected <K> CheckpointableKeyedStateBackend<K> keyedStatedBackend(TypeSerializer<K> keySerializer, String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, CloseableRegistry backendCloseableRegistry, MetricGroup metricGroup, double managedMemoryFraction) throws Exception
Exception
protected CloseableIterable<StatePartitionStreamProvider> rawOperatorStateInputs(Iterator<StateObjectCollection<OperatorStateHandle>> restoreStateAlternatives)
protected CloseableIterable<KeyGroupStatePartitionStreamProvider> rawKeyedStateInputs(Iterator<StateObjectCollection<KeyedStateHandle>> restoreStateAlternatives)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.