Search in sources :

Example 1 with Savepoint

use of org.apache.flink.runtime.checkpoint.savepoint.Savepoint in project flink by apache.

the class PendingCheckpoint method finalizeCheckpointExternalized.

public CompletedCheckpoint finalizeCheckpointExternalized() throws IOException {
    synchronized (lock) {
        checkState(isFullyAcknowledged(), "Pending checkpoint has not been fully acknowledged yet.");
        // make sure we fulfill the promise with an exception if something fails
        try {
            // externalize the metadata
            final Savepoint savepoint = new SavepointV1(checkpointId, taskStates.values());
            // This should be unified as part of the JobManager metadata stream factories.
            if (props.isSavepoint()) {
                final FileStateHandle metadataHandle = SavepointStore.storeSavepointToHandle(targetDirectory, savepoint);
                final String externalPointer = metadataHandle.getFilePath().getParent().toString();
                return finalizeInternal(metadataHandle, externalPointer);
            } else {
                final FileStateHandle metadataHandle = SavepointStore.storeExternalizedCheckpointToHandle(targetDirectory, savepoint);
                final String externalPointer = metadataHandle.getFilePath().toString();
                return finalizeInternal(metadataHandle, externalPointer);
            }
        } catch (Throwable t) {
            onCompletionPromise.completeExceptionally(t);
            ExceptionUtils.rethrowIOException(t);
            // silence the compiler
            return null;
        }
    }
}
Also used : SavepointV1(org.apache.flink.runtime.checkpoint.savepoint.SavepointV1) FileStateHandle(org.apache.flink.runtime.state.filesystem.FileStateHandle) Savepoint(org.apache.flink.runtime.checkpoint.savepoint.Savepoint)

Aggregations

Savepoint (org.apache.flink.runtime.checkpoint.savepoint.Savepoint)1 SavepointV1 (org.apache.flink.runtime.checkpoint.savepoint.SavepointV1)1 FileStateHandle (org.apache.flink.runtime.state.filesystem.FileStateHandle)1