Java Code Examples for org.apache.flink.streaming.api.environment.CheckpointConfig#setFailOnCheckpointingErrors()

The following examples show how to use org.apache.flink.streaming.api.environment.CheckpointConfig#setFailOnCheckpointingErrors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckpointExceptionHandlerConfigurationTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testSetCheckpointConfig() {
	StreamExecutionEnvironment streamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
	CheckpointConfig checkpointConfig = streamExecutionEnvironment.getCheckpointConfig();

	// use deprecated API to set not fail on checkpoint errors
	checkpointConfig.setFailOnCheckpointingErrors(false);
	Assert.assertFalse(checkpointConfig.isFailOnCheckpointingErrors());
	Assert.assertEquals(CheckpointFailureManager.UNLIMITED_TOLERABLE_FAILURE_NUMBER, checkpointConfig.getTolerableCheckpointFailureNumber());

	// use new API to set tolerable declined checkpoint number
	checkpointConfig.setTolerableCheckpointFailureNumber(5);
	Assert.assertEquals(5, checkpointConfig.getTolerableCheckpointFailureNumber());

	// after we configure the tolerable declined checkpoint number, deprecated API would not take effect
	checkpointConfig.setFailOnCheckpointingErrors(true);
	Assert.assertEquals(5, checkpointConfig.getTolerableCheckpointFailureNumber());
}
 
Example 2
Source File: CheckpointExceptionHandlerConfigurationTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testSetCheckpointConfig() {
	StreamExecutionEnvironment streamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
	CheckpointConfig checkpointConfig = streamExecutionEnvironment.getCheckpointConfig();

	// use deprecated API to set not fail on checkpoint errors
	checkpointConfig.setFailOnCheckpointingErrors(false);
	Assert.assertFalse(checkpointConfig.isFailOnCheckpointingErrors());
	Assert.assertEquals(CheckpointFailureManager.UNLIMITED_TOLERABLE_FAILURE_NUMBER, checkpointConfig.getTolerableCheckpointFailureNumber());

	// use new API to set tolerable declined checkpoint number
	checkpointConfig.setTolerableCheckpointFailureNumber(5);
	Assert.assertEquals(5, checkpointConfig.getTolerableCheckpointFailureNumber());

	// after we configure the tolerable declined checkpoint number, deprecated API would not take effect
	checkpointConfig.setFailOnCheckpointingErrors(true);
	Assert.assertEquals(5, checkpointConfig.getTolerableCheckpointFailureNumber());
}