use of org.apache.flink.runtime.state.CheckpointStorageLocationReference in project flink by apache.
the class CheckpointSerializationTest method testCheckpointBarrierSerialization.
@Test
public void testCheckpointBarrierSerialization() throws Exception {
CheckpointOptions checkpointToSerialize = new CheckpointOptions(CheckpointType.CHECKPOINT, new CheckpointStorageLocationReference(STORAGE_LOCATION_REF));
testCheckpointBarrierSerialization(checkpointToSerialize);
}
use of org.apache.flink.runtime.state.CheckpointStorageLocationReference in project flink by apache.
the class CheckpointSerializationTest method testFullCheckpointBarrierSerialization.
@Test
public void testFullCheckpointBarrierSerialization() throws Exception {
CheckpointOptions checkpointToSerialize = new CheckpointOptions(CheckpointType.FULL_CHECKPOINT, new CheckpointStorageLocationReference(STORAGE_LOCATION_REF));
testCheckpointBarrierSerialization(checkpointToSerialize);
}
use of org.apache.flink.runtime.state.CheckpointStorageLocationReference in project flink by apache.
the class AbstractStreamOperatorTestHarness method snapshotWithLocalState.
/**
* Calls {@link StreamOperator#snapshotState(long, long, CheckpointOptions,
* org.apache.flink.runtime.state.CheckpointStreamFactory)}.
*/
public OperatorSnapshotFinalizer snapshotWithLocalState(long checkpointId, long timestamp, SnapshotType checkpointType) throws Exception {
CheckpointStorageLocationReference locationReference = CheckpointStorageLocationReference.getDefault();
OperatorSnapshotFutures operatorStateResult = operator.snapshotState(checkpointId, timestamp, new CheckpointOptions(checkpointType, locationReference), checkpointStorageAccess.resolveCheckpointStorageLocation(checkpointId, locationReference));
return new OperatorSnapshotFinalizer(operatorStateResult);
}
use of org.apache.flink.runtime.state.CheckpointStorageLocationReference in project flink by apache.
the class LocalInputChannelTest method testCheckpointingInflightData.
@Test
public void testCheckpointingInflightData() throws Exception {
SingleInputGate inputGate = new SingleInputGateBuilder().build();
PipelinedResultPartition parent = (PipelinedResultPartition) PartitionTestUtils.createPartition(ResultPartitionType.PIPELINED, NoOpFileChannelManager.INSTANCE);
ResultSubpartition subpartition = parent.getAllPartitions()[0];
ResultSubpartitionView subpartitionView = subpartition.createReadView(() -> {
});
TestingResultPartitionManager partitionManager = new TestingResultPartitionManager(subpartitionView);
final RecordingChannelStateWriter stateWriter = new RecordingChannelStateWriter();
LocalInputChannel channel = createLocalInputChannel(inputGate, partitionManager, 0, 0, b -> b.setStateWriter(stateWriter));
inputGate.setInputChannels(channel);
channel.requestSubpartition();
final CheckpointStorageLocationReference location = getDefault();
CheckpointOptions options = CheckpointOptions.unaligned(CheckpointType.CHECKPOINT, location);
stateWriter.start(0, options);
final CheckpointBarrier barrier = new CheckpointBarrier(0, 123L, options);
channel.checkpointStarted(barrier);
// add 1 buffer before barrier and 1 buffer afterwards. Only the first buffer should be
// written.
subpartition.add(createFilledFinishedBufferConsumer(1));
assertTrue(channel.getNextBuffer().isPresent());
subpartition.add(EventSerializer.toBufferConsumer(barrier, true));
assertTrue(channel.getNextBuffer().isPresent());
subpartition.add(createFilledFinishedBufferConsumer(2));
assertTrue(channel.getNextBuffer().isPresent());
assertArrayEquals(stateWriter.getAddedInput().get(channel.getChannelInfo()).stream().mapToInt(Buffer::getSize).toArray(), new int[] { 1 });
}
use of org.apache.flink.runtime.state.CheckpointStorageLocationReference in project flink by apache.
the class SubtaskCheckpointCoordinatorTest method initCheckpoint.
private boolean initCheckpoint(boolean unalignedCheckpointEnabled, SnapshotType checkpointType) throws IOException, CheckpointException {
class MockWriter extends ChannelStateWriterImpl.NoOpChannelStateWriter {
private boolean started;
@Override
public void start(long checkpointId, CheckpointOptions checkpointOptions) {
started = true;
}
}
MockWriter writer = new MockWriter();
SubtaskCheckpointCoordinator coordinator = coordinator(unalignedCheckpointEnabled, writer);
CheckpointStorageLocationReference locationReference = CheckpointStorageLocationReference.getDefault();
coordinator.initInputsCheckpoint(1L, unalignedCheckpointEnabled ? CheckpointOptions.unaligned(CheckpointType.CHECKPOINT, locationReference) : CheckpointOptions.alignedNoTimeout(checkpointType, locationReference));
return writer.started;
}
Aggregations