StefanRRichter commented on a change in pull request #8322: [FLINK-12364] Introduce a CheckpointFailureManager to centralized manage checkpoint failure URL: https://github.com/apache/flink/pull/8322#discussion_r280328692
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointFailureManager.java ########## @@ -0,0 +1,95 @@ +/* + * 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.runtime.checkpoint; + +import org.apache.flink.util.Preconditions; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * The checkpoint failure manager which centralized manage checkpoint failure processing logic. + */ +public class CheckpointFailureManager { + + private final AtomicInteger continuousFailureCounter; + private final int tolerableCpFailureNumber; + + public CheckpointFailureManager(int tolerableCpFailureNumber) { + Preconditions.checkArgument(tolerableCpFailureNumber > 0, + "The tolerable checkpoint failure number must be larger than 0."); + this.tolerableCpFailureNumber = tolerableCpFailureNumber; + this.continuousFailureCounter = new AtomicInteger(0); + } + + /** + * Handle checkpoint exception with a handler callback. + * + * @param exception the checkpoint exception. + * @param callback the handler callback which defines the process logic. + */ + public void handleCheckpointException(CheckpointException exception, FailureHandlerCallback callback) { Review comment: This method is not used anywhere except for tests. Maybe it would have ben better this time to also include the usages into this PR, because otherwise it is hard to imagine how the callback is supposed to be used later if we continue with the refactoring. It also is different from the design doc which was passing a pending checkpoint, and does not talk about this. So I am having a hard time now imagining what the callback does. The danger of a PR that just adds an unused class is that we cannot yet see if this integrates well later. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
