All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.flink.runtime.checkpoint.OperatorCoordinatorCheckpointContext Maven / Gradle / Ivy

There is a newer version: 1.19.0
Show newest version
/*
 * 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.api.common.state.CheckpointListener;
import org.apache.flink.runtime.operators.coordination.OperatorCoordinator;
import org.apache.flink.runtime.operators.coordination.OperatorInfo;

import javax.annotation.Nullable;

import java.util.concurrent.CompletableFuture;

/**
 * This context is the interface through which the {@link CheckpointCoordinator} interacts with an
 * {@link OperatorCoordinator} during checkpointing and checkpoint restoring.
 */
public interface OperatorCoordinatorCheckpointContext extends OperatorInfo, CheckpointListener {

    void checkpointCoordinator(long checkpointId, CompletableFuture result)
            throws Exception;

    void abortCurrentTriggering();

    /**
     * We override the method here to remove the checked exception. Please check the Java docs of
     * {@link CheckpointListener#notifyCheckpointComplete(long)} for more detail semantic of the
     * method.
     */
    @Override
    void notifyCheckpointComplete(long checkpointId);

    /**
     * We override the method here to remove the checked exception. Please check the Java docs of
     * {@link CheckpointListener#notifyCheckpointAborted(long)} for more detail semantic of the
     * method.
     */
    @Override
    default void notifyCheckpointAborted(long checkpointId) {}

    /**
     * Resets the coordinator to the checkpoint with the given state.
     *
     * 

This method is called with a null state argument in the following situations: * *

    *
  • There is a recovery and there was no completed checkpoint yet. *
  • There is a recovery from a completed checkpoint/savepoint but it contained no state for * the coordinator. *
* *

In both cases, the coordinator should reset to an empty (new) state. */ void resetToCheckpoint(long checkpointId, @Nullable byte[] checkpointData) throws Exception; /** * Called if a task is recovered as part of a partial failover, meaning a failover * handled by the scheduler's failover strategy (by default recovering a pipelined region). The * method is invoked for each subtask involved in that partial failover. * *

In contrast to this method, the {@link #resetToCheckpoint(long, byte[])} method is called * in the case of a global failover, which is the case when the coordinator (JobManager) is * recovered. */ void subtaskReset(int subtask, long checkpointId); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy