use of org.apache.flink.runtime.state.memory.MemoryStateBackend in project flink by apache.
the class JobSnapshottingSettingsTest method testIsJavaSerializable.
/**
* Tests that the settings are actually serializable.
*/
@Test
public void testIsJavaSerializable() throws Exception {
JobSnapshottingSettings settings = new JobSnapshottingSettings(Arrays.asList(new JobVertexID(), new JobVertexID()), Arrays.asList(new JobVertexID(), new JobVertexID()), Arrays.asList(new JobVertexID(), new JobVertexID()), 1231231, 1231, 112, 12, ExternalizedCheckpointSettings.externalizeCheckpoints(true), new MemoryStateBackend(), false);
JobSnapshottingSettings copy = CommonTestUtils.createCopySerializable(settings);
assertEquals(settings.getVerticesToAcknowledge(), copy.getVerticesToAcknowledge());
assertEquals(settings.getVerticesToConfirm(), copy.getVerticesToConfirm());
assertEquals(settings.getVerticesToTrigger(), copy.getVerticesToTrigger());
assertEquals(settings.getCheckpointInterval(), copy.getCheckpointInterval());
assertEquals(settings.getCheckpointTimeout(), copy.getCheckpointTimeout());
assertEquals(settings.getMinPauseBetweenCheckpoints(), copy.getMinPauseBetweenCheckpoints());
assertEquals(settings.getMaxConcurrentCheckpoints(), copy.getMaxConcurrentCheckpoints());
assertEquals(settings.getExternalizedCheckpointSettings().externalizeCheckpoints(), copy.getExternalizedCheckpointSettings().externalizeCheckpoints());
assertEquals(settings.getExternalizedCheckpointSettings().deleteOnCancellation(), copy.getExternalizedCheckpointSettings().deleteOnCancellation());
assertEquals(settings.isExactlyOnce(), copy.isExactlyOnce());
assertNotNull(copy.getDefaultStateBackend());
assertTrue(copy.getDefaultStateBackend().getClass() == MemoryStateBackend.class);
}
use of org.apache.flink.runtime.state.memory.MemoryStateBackend in project flink by apache.
the class ManualWindowSpeedITCase method testTumblingIngestionTimeWindowsWithRocksDBBackendWithLateness.
@Test
public void testTumblingIngestionTimeWindowsWithRocksDBBackendWithLateness() throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.IngestionTime);
env.setParallelism(1);
env.setStateBackend(new RocksDBStateBackend(new MemoryStateBackend()));
env.addSource(new InfiniteTupleSource(10_000)).keyBy(0).timeWindow(Time.seconds(3)).allowedLateness(Time.seconds(1)).reduce(new ReduceFunction<Tuple2<String, Integer>>() {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1, Tuple2<String, Integer> value2) throws Exception {
return Tuple2.of(value1.f0, value1.f1 + value2.f1);
}
}).filter(new FilterFunction<Tuple2<String, Integer>>() {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(Tuple2<String, Integer> value) throws Exception {
return value.f0.startsWith("Tuple 0");
}
}).print();
env.execute();
}
use of org.apache.flink.runtime.state.memory.MemoryStateBackend in project beam by apache.
the class PipelineOptionsTest method testIgnoredFieldSerialization.
@Test
public void testIgnoredFieldSerialization() {
FlinkPipelineOptions options = PipelineOptionsFactory.as(FlinkPipelineOptions.class);
options.setStateBackend(new MemoryStateBackend());
FlinkPipelineOptions deserialized = new SerializedPipelineOptions(options).getPipelineOptions().as(FlinkPipelineOptions.class);
assertNull(deserialized.getStateBackend());
}
Aggregations