Search in sources :

Example 41 with CheckpointOptions

use of org.apache.flink.runtime.checkpoint.CheckpointOptions in project flink by apache.

the class CheckpointSerializationTest method testSuspendingCheckpointBarrierSerialization.

@Test
public void testSuspendingCheckpointBarrierSerialization() throws Exception {
    CheckpointOptions suspendSavepointToSerialize = new CheckpointOptions(SavepointType.suspend(SavepointFormatType.CANONICAL), new CheckpointStorageLocationReference(STORAGE_LOCATION_REF));
    testCheckpointBarrierSerialization(suspendSavepointToSerialize);
}
Also used : CheckpointOptions(org.apache.flink.runtime.checkpoint.CheckpointOptions) CheckpointStorageLocationReference(org.apache.flink.runtime.state.CheckpointStorageLocationReference) Test(org.junit.Test)

Example 42 with CheckpointOptions

use of org.apache.flink.runtime.checkpoint.CheckpointOptions in project flink by apache.

the class CheckpointSerializationTest method testSavepointBarrierSerialization.

@Test
public void testSavepointBarrierSerialization() throws Exception {
    CheckpointOptions savepointToSerialize = new CheckpointOptions(SavepointType.savepoint(SavepointFormatType.CANONICAL), new CheckpointStorageLocationReference(STORAGE_LOCATION_REF));
    testCheckpointBarrierSerialization(savepointToSerialize);
}
Also used : CheckpointOptions(org.apache.flink.runtime.checkpoint.CheckpointOptions) CheckpointStorageLocationReference(org.apache.flink.runtime.state.CheckpointStorageLocationReference) Test(org.junit.Test)

Example 43 with CheckpointOptions

use of org.apache.flink.runtime.checkpoint.CheckpointOptions in project flink by apache.

the class StateSnapshotTransformerTest method testNonConcurrentSnapshotTransformerAccess.

void testNonConcurrentSnapshotTransformerAccess() throws Exception {
    List<TestState> testStates = Arrays.asList(new TestValueState(), new TestListState(), new TestMapState());
    for (TestState state : testStates) {
        for (int i = 0; i < 100; i++) {
            backend.setCurrentKey(i);
            state.setToRandomValue();
        }
        CheckpointOptions checkpointOptions = CheckpointOptions.forCheckpointWithDefaultLocation();
        RunnableFuture<SnapshotResult<KeyedStateHandle>> snapshot1 = backend.snapshot(1L, 0L, streamFactory, checkpointOptions);
        RunnableFuture<SnapshotResult<KeyedStateHandle>> snapshot2 = backend.snapshot(2L, 0L, streamFactory, checkpointOptions);
        Thread runner1 = new Thread(snapshot1, "snapshot1");
        runner1.start();
        Thread runner2 = new Thread(snapshot2, "snapshot2");
        runner2.start();
        runner1.join();
        runner2.join();
        snapshot1.get();
        snapshot2.get();
    }
}
Also used : CheckpointOptions(org.apache.flink.runtime.checkpoint.CheckpointOptions)

Aggregations

CheckpointOptions (org.apache.flink.runtime.checkpoint.CheckpointOptions)43 Test (org.junit.Test)23 CheckpointBarrier (org.apache.flink.runtime.io.network.api.CheckpointBarrier)14 CheckpointStorageLocationReference (org.apache.flink.runtime.state.CheckpointStorageLocationReference)13 CheckpointMetaData (org.apache.flink.runtime.checkpoint.CheckpointMetaData)12 IOException (java.io.IOException)7 CheckpointMetricsBuilder (org.apache.flink.runtime.checkpoint.CheckpointMetricsBuilder)5 InputChannelInfo (org.apache.flink.runtime.checkpoint.channel.InputChannelInfo)5 TestInputChannel (org.apache.flink.runtime.io.network.partition.consumer.TestInputChannel)5 List (java.util.List)4 Map (java.util.Map)4 Buffer (org.apache.flink.runtime.io.network.buffer.Buffer)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 SnapshotType (org.apache.flink.runtime.checkpoint.SnapshotType)3 EndOfData (org.apache.flink.runtime.io.network.api.EndOfData)3 SingleInputGate (org.apache.flink.runtime.io.network.partition.consumer.SingleInputGate)3 SingleInputGateBuilder (org.apache.flink.runtime.io.network.partition.consumer.SingleInputGateBuilder)3 StreamConfig (org.apache.flink.streaming.api.graph.StreamConfig)3 ByteBuffer (java.nio.ByteBuffer)2