public abstract class AbstractFsCheckpointStorage extends Object implements CheckpointStorage
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 |
AbstractFsCheckpointStorage(JobID jobId,
Path defaultSavepointDirectory)
Creates a new checkpoint storage.
|
Modifier and Type | Method and Description |
---|---|
protected static Path |
createCheckpointDirectory(Path baseDirectory,
long checkpointId)
Creates the directory path for the data exclusive to a specific checkpoint.
|
protected abstract CheckpointStorageLocation |
createSavepointLocation(FileSystem fs,
Path location) |
static Path |
decodePathFromReference(CheckpointStorageLocationReference reference)
Decodes the given reference into a path.
|
static CheckpointStorageLocationReference |
encodePathAsReference(Path path)
Encodes the given path as a reference in bytes.
|
protected static Path |
getCheckpointDirectoryForJob(Path baseCheckpointPath,
JobID jobId)
Builds directory into which a specific job checkpoints, meaning the directory inside which
it creates the checkpoint-specific subdirectories.
|
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 CompletedCheckpointStorageLocation |
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, wait
initializeBaseLocations, initializeLocationForCheckpoint, supportsHighlyAvailableStorage
createTaskOwnedStateStream, resolveCheckpointStorageLocation
public 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 AbstractFsCheckpointStorage(JobID jobId, @Nullable 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 Path getDefaultSavepointDirectory()
public boolean hasDefaultSavepointLocation()
CheckpointStorageCoordinatorView
hasDefaultSavepointLocation
in interface CheckpointStorageCoordinatorView
public CompletedCheckpointStorageLocation resolveCheckpoint(String checkpointPointer) throws IOException
CheckpointStorageCoordinatorView
If 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 CheckpointStorageCoordinatorView
checkpointPointer
- 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 CheckpointStorageCoordinatorView
externalLocationPointer
- 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(FileSystem fs, Path location) throws IOException
IOException
protected static Path getCheckpointDirectoryForJob(Path baseCheckpointPath, 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 Path createCheckpointDirectory(Path baseDirectory, long checkpointId)
baseDirectory
- The base directory into which the job checkpoints.checkpointId
- The ID (logical timestamp) of the checkpoint.@Internal public static CompletedCheckpointStorageLocation 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(Path path)
path
- The path to encode.public static 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–2020 The Apache Software Foundation. All rights reserved.