[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user rmetzger commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r182155763 --- Diff: docs/dev/stream/state/checkpointing.md --- @@ -118,6 +120,9 @@ env.getCheckpointConfig.setMinPauseBetweenCheckpoints(500) // checkpoints have to complete within one minute, or are discarded env.getCheckpointConfig.setCheckpointTimeout(6) +// prevent the tasks from failing if an error happens in their checkpointing, the checkpoint will just be declined. +env.getCheckpointConfig.setFailTasksOnCheckpointingErrors(false) --- End diff -- This line is missing from the Java tab. ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/4883 ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user StefanRRichter commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r151948416 --- Diff: flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java --- @@ -150,6 +150,9 @@ /** This flag defines if we use compression for the state snapshot data or not. Default: false */ private boolean useSnapshotCompression = false; + /** Determines if a task fails or not if there is an error in writing its checkpoint data. Default: true */ --- End diff -- After discussions with @aljoscha, we decided to keep this because it is the current way that Flink forwards the configuration. We add some `@Internal` and `@Deprecated` annotations to the methods in `ExecutionConfig` so that the user will use the proper calls on `CheckpointingConfig` instead. ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user StefanRRichter commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r151940619 --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java --- @@ -1041,27 +1065,27 @@ public void executeCheckpointing() throws Exception { checkpointMetrics.getAlignmentDurationNanos() / 1_000_000, checkpointMetrics.getSyncDurationMillis()); } - } finally { - if (failed) { - // Cleanup to release resources - for (OperatorSnapshotResult operatorSnapshotResult : operatorSnapshotsInProgress.values()) { - if (null != operatorSnapshotResult) { - try { - operatorSnapshotResult.cancel(); - } catch (Exception e) { - LOG.warn("Could not properly cancel an operator snapshot result.", e); - } + } catch (Exception ex) { + // Cleanup to release resources --- End diff -- Because this was moved from the `finally`-block into a `catch`-block where it is clear that the code failed. ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r146543822 --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/CheckpointExceptionHandlerFactory.java --- @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.streaming.runtime.tasks; + +import org.apache.flink.runtime.checkpoint.CheckpointMetaData; +import org.apache.flink.runtime.execution.Environment; +import org.apache.flink.util.Preconditions; + +/** + * This factory produces exception handles that handle exceptions during checkpointing in a {@link StreamTask}. --- End diff -- nit: "exception handles" ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r146544396 --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java --- @@ -1041,27 +1065,27 @@ public void executeCheckpointing() throws Exception { checkpointMetrics.getAlignmentDurationNanos() / 1_000_000, checkpointMetrics.getSyncDurationMillis()); } - } finally { - if (failed) { - // Cleanup to release resources - for (OperatorSnapshotResult operatorSnapshotResult : operatorSnapshotsInProgress.values()) { - if (null != operatorSnapshotResult) { - try { - operatorSnapshotResult.cancel(); - } catch (Exception e) { - LOG.warn("Could not properly cancel an operator snapshot result.", e); - } + } catch (Exception ex) { + // Cleanup to release resources --- End diff -- Why don't we check for `failed` anymore? ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r146543421 --- Diff: flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java --- @@ -150,6 +150,9 @@ /** This flag defines if we use compression for the state snapshot data or not. Default: false */ private boolean useSnapshotCompression = false; + /** Determines if a task fails or not if there is an error in writing its checkpoint data. Default: true */ --- End diff -- Duplicate option in `ExecutionConfig` and `CheckpointingConfig`. ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/4883#discussion_r146543640 --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/CheckpointConfig.java --- @@ -231,6 +234,23 @@ public void setForceCheckpointing(boolean forceCheckpointing) { } /** +* This determines the behaviour of tasks if there is an error in their checkpointing. If this returns true, +* tasks will fail as a reaction. If this returns false, task will only decline the failed checkpoint. +*/ + public boolean isFailTasksOnCheckpointingErrors() { --- End diff -- I think we typically don't talk about tasks in the user facing APIs. This could be `isFailOnCheckpointingErrors()`, for example. ---
[GitHub] flink pull request #4883: [FLINK-4809] Operators should tolerate checkpoint ...
GitHub user StefanRRichter opened a pull request: https://github.com/apache/flink/pull/4883 [FLINK-4809] Operators should tolerate checkpoint failures. ## What is the purpose of the change This PR implements FLINK-4809 and allows tasks to tolerate errors that happen in their checkpointing procedure. This tolerance is optional and can activated through `CheckpointOptions`, the default behaviour is to fail the task, as before this PR. When fault tolerance is activated, an error will not fail the task. Instead, the task will decline the checkpoint to the checkpoint coordinator. ## Brief change log - *Feature configuration through `CheckpointOptions` and `ExecutionConfig`.* - *Introduced `CheckpointExceptionHandler` and integrated with StreamTask. This handler will either transform the exception to a `declineCheckpoint` or rethrow to fail the task. * - *Tests for configuration forwarding and functionality.* ## Verifying this change This change added tests and can be verified as follows: - *`CheckpointExceptionHandlerTest`: Unit test for the implementations of `CheckpointExceptionHandlerTest` and their factory.* - *`TaskCheckpointingBehaviourTest`: Tests the functionality to either fail tasks or only decline checkpoints in case of failure.* - *`CheckpointExceptionHandlerConfigurationTest`: Checks everything about configuration and configuration forwarding for the feature.* ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes) - The serializers: (no) - The runtime per-record code paths (performance sensitive): (no) - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes) ## Documentation - Does this pull request introduce a new feature? (yes) - If yes, how is the feature documented? (docs and JavaDocs) You can merge this pull request into a Git repository by running: $ git pull https://github.com/StefanRRichter/flink decline-on-checkpoint-exception Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/4883.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4883 commit 9156a70319f4227b2a07edd9b07dae5fcfbaa01c Author: Stefan RichterDate: 2017-10-20T08:59:45Z [FLINK-4809] Operators should tolerate checkpoint failures. ---