Class StateAssignmentOperation


  • @Internal
    public class StateAssignmentOperation
    extends Object
    This class encapsulates the operation of assigning restored state when restoring from a checkpoint.
    • Method Detail

      • assignStates

        public void assignStates()
      • checkParallelismPreconditions

        public void checkParallelismPreconditions​(org.apache.flink.runtime.checkpoint.TaskStateAssignment taskStateAssignment)
      • reDistributeResultSubpartitionStates

        public void reDistributeResultSubpartitionStates​(org.apache.flink.runtime.checkpoint.TaskStateAssignment assignment)
      • reDistributeInputChannelStates

        public void reDistributeInputChannelStates​(org.apache.flink.runtime.checkpoint.TaskStateAssignment stateAssignment)
      • 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> List<List<T>> applyRepartitioner​(OperatorStateRepartitioner<T> opStateRepartitioner,
                                                           List<List<T>> chainOpParallelStates,
                                                           int oldParallelism,
                                                           int newParallelism)
        Repartitions the given operator state using the given OperatorStateRepartitioner with respect to the new parallelism.
        Parameters:
        opStateRepartitioner - partitioner to use
        chainOpParallelStates - state to repartition
        oldParallelism - parallelism with which the state is currently partitioned
        newParallelism - parallelism with which the state should be partitioned
        Returns:
        repartitioned state