Class StateAssignmentOperation
- java.lang.Object
-
- org.apache.flink.runtime.checkpoint.StateAssignmentOperation
-
-
Constructor Summary
Constructors Constructor Description StateAssignmentOperation(long restoreCheckpointId, Set<ExecutionJobVertex> tasks, Map<OperatorID,OperatorState> operatorStates, boolean allowNonRestoredState)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> List<List<T>>
applyRepartitioner(OperatorStateRepartitioner<T> opStateRepartitioner, List<List<T>> chainOpParallelStates, int oldParallelism, int newParallelism)
Repartitions the given operator state using the givenOperatorStateRepartitioner
with respect to the new parallelism.static <T> Map<OperatorInstanceID,List<T>>
applyRepartitioner(OperatorID operatorID, OperatorStateRepartitioner<T> opStateRepartitioner, List<List<T>> chainOpParallelStates, int oldParallelism, int newParallelism)
void
assignStates()
void
checkParallelismPreconditions(org.apache.flink.runtime.checkpoint.TaskStateAssignment taskStateAssignment)
static List<KeyGroupRange>
createKeyGroupPartitions(int numberKeyGroups, int parallelism)
Groups the available set of key groups into key group partitions.static void
extractIntersectingState(Collection<? extends KeyedStateHandle> originalSubtaskStateHandles, KeyGroupRange rangeToExtract, List<KeyedStateHandle> extractedStateCollector)
Extracts certain key group ranges from the given state handles and adds them to the collector.static List<KeyedStateHandle>
getManagedKeyedStateHandles(OperatorState operatorState, KeyGroupRange subtaskKeyGroupRange)
CollectmanagedKeyedStateHandles
which have intersection with givenKeyGroupRange
fromoperatorState
.static List<KeyedStateHandle>
getRawKeyedStateHandles(OperatorState operatorState, KeyGroupRange subtaskKeyGroupRange)
void
reDistributeInputChannelStates(org.apache.flink.runtime.checkpoint.TaskStateAssignment stateAssignment)
static <T extends StateObject>
voidreDistributePartitionableStates(Map<OperatorID,OperatorState> oldOperatorStates, int newParallelism, Function<OperatorSubtaskState,StateObjectCollection<T>> extractHandle, OperatorStateRepartitioner<T> stateRepartitioner, Map<OperatorInstanceID,List<T>> result)
void
reDistributeResultSubpartitionStates(org.apache.flink.runtime.checkpoint.TaskStateAssignment assignment)
-
-
-
Constructor Detail
-
StateAssignmentOperation
public StateAssignmentOperation(long restoreCheckpointId, Set<ExecutionJobVertex> tasks, Map<OperatorID,OperatorState> operatorStates, boolean allowNonRestoredState)
-
-
Method Detail
-
assignStates
public void assignStates()
-
checkParallelismPreconditions
public void checkParallelismPreconditions(org.apache.flink.runtime.checkpoint.TaskStateAssignment taskStateAssignment)
-
reDistributePartitionableStates
public static <T extends StateObject> void reDistributePartitionableStates(Map<OperatorID,OperatorState> oldOperatorStates, int newParallelism, Function<OperatorSubtaskState,StateObjectCollection<T>> extractHandle, OperatorStateRepartitioner<T> stateRepartitioner, Map<OperatorInstanceID,List<T>> result)
-
reDistributeResultSubpartitionStates
public void reDistributeResultSubpartitionStates(org.apache.flink.runtime.checkpoint.TaskStateAssignment assignment)
-
reDistributeInputChannelStates
public void reDistributeInputChannelStates(org.apache.flink.runtime.checkpoint.TaskStateAssignment stateAssignment)
-
getManagedKeyedStateHandles
public static List<KeyedStateHandle> getManagedKeyedStateHandles(OperatorState operatorState, KeyGroupRange subtaskKeyGroupRange)
CollectmanagedKeyedStateHandles
which have intersection with givenKeyGroupRange
fromoperatorState
.- Parameters:
operatorState
- all state handles of a operatorsubtaskKeyGroupRange
- the KeyGroupRange of a subtask- Returns:
- all managedKeyedStateHandles which have intersection with given KeyGroupRange
-
getRawKeyedStateHandles
public static List<KeyedStateHandle> getRawKeyedStateHandles(OperatorState operatorState, KeyGroupRange subtaskKeyGroupRange)
- Parameters:
operatorState
- all state handles of a operatorsubtaskKeyGroupRange
- the KeyGroupRange of a subtask- Returns:
- all rawKeyedStateHandles which have intersection with given KeyGroupRange
-
extractIntersectingState
@VisibleForTesting public static void extractIntersectingState(Collection<? extends KeyedStateHandle> originalSubtaskStateHandles, KeyGroupRange rangeToExtract, List<KeyedStateHandle> extractedStateCollector)
Extracts certain key group ranges from the given state handles and adds them to the collector.
-
createKeyGroupPartitions
public static List<KeyGroupRange> createKeyGroupPartitions(int numberKeyGroups, int parallelism)
Groups the available set of key groups into key group partitions. A key group partition is the set of key groups which is assigned to the same task. Each set of the returned list constitutes a key group partition.IMPORTANT: The assignment of key groups to partitions has to be in sync with the KeyGroupStreamPartitioner.
- Parameters:
numberKeyGroups
- Number of available key groups (indexed from 0 to numberKeyGroups - 1)parallelism
- Parallelism to generate the key group partitioning for- Returns:
- List of key group partitions
-
applyRepartitioner
public static <T> Map<OperatorInstanceID,List<T>> applyRepartitioner(OperatorID operatorID, OperatorStateRepartitioner<T> opStateRepartitioner, List<List<T>> chainOpParallelStates, int oldParallelism, int newParallelism)
-
applyRepartitioner
public static <T> List<List<T>> applyRepartitioner(OperatorStateRepartitioner<T> opStateRepartitioner, List<List<T>> chainOpParallelStates, int oldParallelism, int newParallelism)
Repartitions the given operator state using the givenOperatorStateRepartitioner
with respect to the new parallelism.- Parameters:
opStateRepartitioner
- partitioner to usechainOpParallelStates
- state to repartitionoldParallelism
- parallelism with which the state is currently partitionednewParallelism
- parallelism with which the state should be partitioned- Returns:
- repartitioned state
-
-