Search in sources :

Example 6 with SavepointMetadata

use of org.apache.flink.state.api.runtime.metadata.SavepointMetadata in project flink by apache.

the class SavepointTest method testExistingSavepointEnforceUniqueUIDsWithOldSavepoint.

@Test(expected = IllegalArgumentException.class)
public void testExistingSavepointEnforceUniqueUIDsWithOldSavepoint() throws IOException {
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    env.setParallelism(10);
    DataSource<Integer> input = env.fromElements(0);
    BootstrapTransformation<Integer> transformation = OperatorTransformation.bootstrapWith(input).transform(new ExampleStateBootstrapFunction());
    Collection<OperatorState> operatorStates = Collections.singletonList(new OperatorState(OperatorIDGenerator.fromUid(UID), 1, 4));
    SavepointMetadata metadata = new SavepointMetadata(4, Collections.emptyList(), operatorStates);
    new ExistingSavepoint(env, metadata, new MemoryStateBackend()).withOperator(UID, transformation).write("");
}
Also used : ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) MemoryStateBackend(org.apache.flink.runtime.state.memory.MemoryStateBackend) SavepointMetadata(org.apache.flink.state.api.runtime.metadata.SavepointMetadata) OperatorState(org.apache.flink.runtime.checkpoint.OperatorState) Test(org.junit.Test)

Example 7 with SavepointMetadata

use of org.apache.flink.state.api.runtime.metadata.SavepointMetadata in project flink by apache.

the class SavepointTest method testExistingSavepointEnforceUniqueUIDs.

@Test(expected = IllegalArgumentException.class)
public void testExistingSavepointEnforceUniqueUIDs() throws IOException {
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    env.setParallelism(10);
    DataSource<Integer> input = env.fromElements(0);
    BootstrapTransformation<Integer> transformation = OperatorTransformation.bootstrapWith(input).transform(new ExampleStateBootstrapFunction());
    Collection<OperatorState> operatorStates = Collections.singletonList(new OperatorState(OperatorIDGenerator.fromUid(UID), 1, 4));
    SavepointMetadata metadata = new SavepointMetadata(4, Collections.emptyList(), operatorStates);
    new ExistingSavepoint(env, metadata, new MemoryStateBackend()).withOperator(UID, transformation).withOperator(UID, transformation);
}
Also used : ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) MemoryStateBackend(org.apache.flink.runtime.state.memory.MemoryStateBackend) SavepointMetadata(org.apache.flink.state.api.runtime.metadata.SavepointMetadata) OperatorState(org.apache.flink.runtime.checkpoint.OperatorState) Test(org.junit.Test)

Aggregations

SavepointMetadata (org.apache.flink.state.api.runtime.metadata.SavepointMetadata)7 OperatorState (org.apache.flink.runtime.checkpoint.OperatorState)4 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)3 MemoryStateBackend (org.apache.flink.runtime.state.memory.MemoryStateBackend)3 Test (org.junit.Test)3 CheckpointMetadata (org.apache.flink.runtime.checkpoint.metadata.CheckpointMetadata)2