use of org.apache.flink.runtime.checkpoint.CheckpointOptions 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.checkpoint.CheckpointOptions in project flink by apache.
the class CheckpointSerializationTest method testCheckpointWithDefaultLocationSerialization.
@Test
public void testCheckpointWithDefaultLocationSerialization() throws Exception {
CheckpointOptions checkpointToSerialize = CheckpointOptions.forCheckpointWithDefaultLocation();
testCheckpointBarrierSerialization(checkpointToSerialize);
}
use of org.apache.flink.runtime.checkpoint.CheckpointOptions 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.checkpoint.CheckpointOptions in project flink by apache.
the class AlternatingCheckpointsTest method testHasInflightDataBeforeProcessBarrier.
@Test
public void testHasInflightDataBeforeProcessBarrier() throws Exception {
SingleInputGate inputGate = new SingleInputGateBuilder().setNumberOfChannels(2).build();
inputGate.setInputChannels(new TestInputChannel(inputGate, 0), new TestInputChannel(inputGate, 1));
ValidatingCheckpointHandler target = new ValidatingCheckpointHandler();
SingleCheckpointBarrierHandler barrierHandler = getTestBarrierHandlerFactory(target).create(inputGate);
final long id = 1;
barrierHandler.processBarrier(new CheckpointBarrier(id, clock.relativeTimeMillis(), new CheckpointOptions(CHECKPOINT, getDefault())), new InputChannelInfo(0, 0), false);
assertFalse(barrierHandler.getAllBarriersReceivedFuture(id).isDone());
}
use of org.apache.flink.runtime.checkpoint.CheckpointOptions in project flink by apache.
the class AlternatingCheckpointsTest method testPreviousHandlerReset.
@Test
public void testPreviousHandlerReset() throws Exception {
SingleInputGate inputGate = new SingleInputGateBuilder().setNumberOfChannels(2).build();
TestInputChannel[] channels = { new TestInputChannel(inputGate, 0), new TestInputChannel(inputGate, 1) };
inputGate.setInputChannels(channels);
ValidatingCheckpointHandler target = new ValidatingCheckpointHandler();
SingleCheckpointBarrierHandler barrierHandler = getTestBarrierHandlerFactory(target).create(inputGate);
for (int i = 0; i < 4; i++) {
int channel = i % 2;
SnapshotType type = channel == 0 ? SavepointType.savepoint(SavepointFormatType.CANONICAL) : CHECKPOINT;
target.setNextExpectedCheckpointId(-1);
if (type.isSavepoint()) {
channels[channel].setBlocked(true);
}
barrierHandler.processBarrier(new CheckpointBarrier(i, clock.relativeTimeMillis(), new CheckpointOptions(type, getDefault())), new InputChannelInfo(0, channel), false);
if (type.isSavepoint()) {
assertTrue(channels[channel].isBlocked());
assertFalse(channels[(channel + 1) % 2].isBlocked());
} else {
assertFalse(channels[0].isBlocked());
assertFalse(channels[1].isBlocked());
}
assertTrue(barrierHandler.isCheckpointPending());
assertFalse(barrierHandler.getAllBarriersReceivedFuture(i).isDone());
channels[0].setBlocked(false);
channels[1].setBlocked(false);
}
}
Aggregations