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;
}
}
}
Aggregations