Search in sources :

Example 1 with MigrationStreamStateHandle

use of org.apache.flink.migration.state.MigrationStreamStateHandle in project flink by apache.

the class SavepointV0Serializer method convertOperatorAndFunctionState.

/**
	 * This is public so that we can use it when restoring a legacy snapshot
	 * in {@code AbstractStreamOperatorTestHarness}.
	 */
public static StreamStateHandle convertOperatorAndFunctionState(StreamTaskState streamTaskState) throws Exception {
    List<StreamStateHandle> mergeStateHandles = new ArrayList<>(4);
    StateHandle<Serializable> functionState = streamTaskState.getFunctionState();
    StateHandle<?> operatorState = streamTaskState.getOperatorState();
    if (null != functionState) {
        mergeStateHandles.add(SIGNAL_1);
        mergeStateHandles.add(convertStateHandle(functionState));
    } else {
        mergeStateHandles.add(SIGNAL_0);
    }
    if (null != operatorState) {
        mergeStateHandles.add(convertStateHandle(operatorState));
    }
    return new MigrationStreamStateHandle(new MultiStreamStateHandle(mergeStateHandles));
}
Also used : MigrationStreamStateHandle(org.apache.flink.migration.state.MigrationStreamStateHandle) Serializable(java.io.Serializable) MigrationStreamStateHandle(org.apache.flink.migration.state.MigrationStreamStateHandle) StreamStateHandle(org.apache.flink.runtime.state.StreamStateHandle) ByteStreamStateHandle(org.apache.flink.runtime.state.memory.ByteStreamStateHandle) MultiStreamStateHandle(org.apache.flink.runtime.state.MultiStreamStateHandle) ArrayList(java.util.ArrayList) MultiStreamStateHandle(org.apache.flink.runtime.state.MultiStreamStateHandle)

Aggregations

Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 MigrationStreamStateHandle (org.apache.flink.migration.state.MigrationStreamStateHandle)1 MultiStreamStateHandle (org.apache.flink.runtime.state.MultiStreamStateHandle)1 StreamStateHandle (org.apache.flink.runtime.state.StreamStateHandle)1 ByteStreamStateHandle (org.apache.flink.runtime.state.memory.ByteStreamStateHandle)1