public abstract class AbstractFsCheckpointStorageAccess extends Object implements CheckpointStorageAccess
The checkpoint storage is configured with a base directory and persists the checkpoint data of
specific checkpoints in specific subdirectories. For example, if the base directory was set to
hdfs://namenode:port/flink-checkpoints/, the state backend will create a subdirectory
with the job's ID that will contain the actual checkpoints: (hdfs://namenode:port/flink-checkpoints/1b080b6e710aabbef8993ab18c6de98b)
Each checkpoint individually will store all its files in a subdirectory that includes the
checkpoint number, such as hdfs://namenode:port/flink-checkpoints/1b080b6e710aabbef8993ab18c6de98b/chk-17/.
A savepoint that is set to be stored in path hdfs://namenode:port/flink-savepoints/,
will create a subdirectory savepoint-jobId(0, 6)-randomDigits in which it stores all
savepoint data. The random digits are added as "entropy" to avoid directory collisions.
A completed checkpoint writes its metadata into a file ''.
| Modifier and Type | Field and Description |
|---|---|
static String |
CHECKPOINT_DIR_PREFIX
The prefix of the directory containing the data exclusive to a checkpoint.
|
static String |
CHECKPOINT_SHARED_STATE_DIR
The name of the directory for shared checkpoint state.
|
static String |
CHECKPOINT_TASK_OWNED_STATE_DIR
The name of the directory for state not owned/released by the master, but by the
TaskManagers.
|
static String |
METADATA_FILE_NAME
The name of the metadata files in checkpoints / savepoints.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFsCheckpointStorageAccess(org.apache.flink.api.common.JobID jobId,
org.apache.flink.core.fs.Path defaultSavepointDirectory)
Creates a new checkpoint storage.
|
| Modifier and Type | Method and Description |
|---|---|
protected static org.apache.flink.core.fs.Path |
createCheckpointDirectory(org.apache.flink.core.fs.Path baseDirectory,
long checkpointId)
Creates the directory path for the data exclusive to a specific checkpoint.
|
protected abstract CheckpointStorageLocation |
createSavepointLocation(org.apache.flink.core.fs.FileSystem fs,
org.apache.flink.core.fs.Path location) |
static org.apache.flink.core.fs.Path |
decodePathFromReference(CheckpointStorageLocationReference reference)
Decodes the given reference into a path.
|
static CheckpointStorageLocationReference |
encodePathAsReference(org.apache.flink.core.fs.Path path)
Encodes the given path as a reference in bytes.
|
protected static org.apache.flink.core.fs.Path |
getCheckpointDirectoryForJob(org.apache.flink.core.fs.Path baseCheckpointPath,
org.apache.flink.api.common.JobID jobId)
Builds directory into which a specific job checkpoints, meaning the directory inside which it
creates the checkpoint-specific subdirectories.
|
org.apache.flink.core.fs.Path |
getDefaultSavepointDirectory()
Gets the default directory for savepoints.
|
boolean |
hasDefaultSavepointLocation()
Checks whether the storage has a default savepoint location configured.
|
CheckpointStorageLocation |
initializeLocationForSavepoint(long checkpointId,
String externalLocationPointer)
Creates a file system based storage location for a savepoint.
|
CompletedCheckpointStorageLocation |
resolveCheckpoint(String checkpointPointer)
Resolves the given pointer to a checkpoint/savepoint into a checkpoint location.
|
static FsCompletedCheckpointStorageLocation |
resolveCheckpointPointer(String checkpointPointer)
Takes the given string (representing a pointer to a checkpoint) and resolves it to a file
status for the checkpoint's metadata file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeBaseLocationsForCheckpoint, initializeLocationForCheckpoint, supportsHighlyAvailableStoragecreateTaskOwnedCheckpointStateToolset, createTaskOwnedStateStream, resolveCheckpointStorageLocationpublic static final String CHECKPOINT_DIR_PREFIX
public static final String CHECKPOINT_SHARED_STATE_DIR
public static final String CHECKPOINT_TASK_OWNED_STATE_DIR
public static final String METADATA_FILE_NAME
protected AbstractFsCheckpointStorageAccess(org.apache.flink.api.common.JobID jobId,
@Nullable
org.apache.flink.core.fs.Path defaultSavepointDirectory)
jobId - The ID of the job that writes the checkpoints.defaultSavepointDirectory - The default location for savepoints, or null, if none is
set.@Nullable public org.apache.flink.core.fs.Path getDefaultSavepointDirectory()
public boolean hasDefaultSavepointLocation()
CheckpointStorageCoordinatorViewhasDefaultSavepointLocation in interface CheckpointStorageCoordinatorViewpublic CompletedCheckpointStorageLocation resolveCheckpoint(String checkpointPointer) throws IOException
CheckpointStorageCoordinatorViewIf the state backend cannot understand the format of the pointer (for example because it
was created by a different state backend) this method should throw an IOException.
resolveCheckpoint in interface CheckpointStorageCoordinatorViewcheckpointPointer - The external checkpoint pointer to resolve.IOException - Thrown, if the state backend does not understand the pointer, or if the
pointer could not be resolved due to an I/O error.public CheckpointStorageLocation initializeLocationForSavepoint(long checkpointId, @Nullable String externalLocationPointer) throws IOException
This methods implements the logic that decides which location to use (given optional parameters for a configured location and a location passed for this specific savepoint) and how to name and initialize the savepoint directory.
initializeLocationForSavepoint in interface CheckpointStorageCoordinatorViewexternalLocationPointer - The target location pointer for the savepoint. Must be a valid
URI. Null, if not supplied.checkpointId - The checkpoint ID of the savepoint.IOException - Thrown if the target directory could not be created.protected abstract CheckpointStorageLocation createSavepointLocation(org.apache.flink.core.fs.FileSystem fs, org.apache.flink.core.fs.Path location) throws IOException
IOExceptionprotected static org.apache.flink.core.fs.Path getCheckpointDirectoryForJob(org.apache.flink.core.fs.Path baseCheckpointPath,
org.apache.flink.api.common.JobID jobId)
This method only succeeds if a base checkpoint directory has been set; otherwise the method fails with an exception.
jobId - The ID of the jobUnsupportedOperationException - Thrown, if no base checkpoint directory has been set.protected static org.apache.flink.core.fs.Path createCheckpointDirectory(org.apache.flink.core.fs.Path baseDirectory,
long checkpointId)
baseDirectory - The base directory into which the job checkpoints.checkpointId - The ID (logical timestamp) of the checkpoint.@Internal public static FsCompletedCheckpointStorageLocation resolveCheckpointPointer(String checkpointPointer) throws IOException
checkpointPointer - The pointer to resolve.IOException - Thrown, if the pointer cannot be resolved, the file system not accessed,
or the pointer points to a location that does not seem to be a checkpoint/savepoint.public static CheckpointStorageLocationReference encodePathAsReference(org.apache.flink.core.fs.Path path)
path - The path to encode.public static org.apache.flink.core.fs.Path decodePathFromReference(CheckpointStorageLocationReference reference)
encodePathAsReference(Path)) and
converts the remaining bytes back to a proper path.reference - The bytes representing the reference.IllegalArgumentException - Thrown, if the bytes do not represent a proper reference.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.