@PublicEvolving public class JobManagerCheckpointStorage extends Object implements CheckpointStorage, ConfigurableCheckpointStorage
CheckpointStorage
checkpoints state directly to the JobManager's memory (hence the
name), but savepoints will be persisted to a file system.
This checkpoint storage is primarily for experimentation, quick local setups, or for streaming
applications that have very small state: Because it requires checkpoints to go through the
JobManager's memory, larger state will occupy larger portions of the JobManager's main memory,
reducing operational stability. For any other setup, the FileSystemCheckpointStorage
should be used. The FileSystemCheckpointStorage
but checkpoints state directly to files
rather than to the JobManager's memory, thus supporting larger state sizes and more highly
available recovery.
State checkpointing with this storage is subject to the following conditions:
getMaxStateSize()
.
For the use cases where the state sizes can be handled by this checkpoint storage, the storage does guarantee persistence for savepoints, externalized checkpoints (if configured), and checkpoints (when high-availability is configured).
As for all checkpoint storage, this storage policy can either be configured within the application (by creating the storage with the respective constructor parameters and setting it on the execution environment) or by specifying it in the Flink configuration.
If the checkpoint storage was specified in the application, it may pick up additional
configuration parameters from the Flink configuration. For example, if the storage if configured
in the application without a default savepoint directory, it will pick up a default savepoint
directory specified in the Flink configuration of the running job/cluster. That behavior is
implemented via the configure(ReadableConfig, ClassLoader)
method.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_STATE_SIZE
The default maximal size that the snapshotted memory state may have (5 MiBytes).
|
Constructor and Description |
---|
JobManagerCheckpointStorage()
Creates a new job manager checkpoint storage that accepts states whose serialized forms are
up to the default state size (5 MB).
|
JobManagerCheckpointStorage(int maxStateSize)
Creates a new JobManagerCheckpointStorage, setting optionally the paths to persist checkpoint
metadata and savepoints to, as well as configuring state thresholds and asynchronous
operations.
|
JobManagerCheckpointStorage(Path checkpointPath,
int maxStateSize)
Creates a new JobManagerCheckpointStorage, setting optionally the paths to persist checkpoint
metadata and savepoints to, as well as configuring state thresholds and asynchronous
operations.
|
JobManagerCheckpointStorage(String checkpointPath)
Creates a new JobManagerCheckpointStorage, setting optionally the paths to persist checkpoint
metadata and savepoints to, as well as configuring state thresholds and asynchronous
operations.
|
Modifier and Type | Method and Description |
---|---|
JobManagerCheckpointStorage |
configure(ReadableConfig config,
ClassLoader classLoader)
Creates a copy of this checkpoint storage that uses the values defined in the configuration
for fields where that were not specified in this checkpoint storage.
|
CheckpointStorageAccess |
createCheckpointStorage(JobID jobId)
Creates a storage for checkpoints for the given job.
|
static JobManagerCheckpointStorage |
createFromConfig(ReadableConfig config,
ClassLoader classLoader)
Creates a new
JobManagerCheckpointStorage using the given configuration. |
Path |
getCheckpointPath() |
int |
getMaxStateSize()
Gets the maximum size that an individual state can have, as configured in the constructor (by
default 5242880).
|
Path |
getSavepointPath() |
CompletedCheckpointStorageLocation |
resolveCheckpoint(String pointer)
Resolves the given pointer to a checkpoint/savepoint into a checkpoint location.
|
String |
toString() |
public static final int DEFAULT_MAX_STATE_SIZE
public JobManagerCheckpointStorage()
Checkpoint and default savepoint locations are used as specified in the runtime configuration.
public JobManagerCheckpointStorage(int maxStateSize)
WARNING: Increasing the size of this value beyond the default value (5242880) should be done with care. The checkpointed state needs to be send to the JobManager via limited size RPC messages, and there and the JobManager needs to be able to hold all aggregated state in its memory.
maxStateSize
- The maximal size of the serialized state.public JobManagerCheckpointStorage(String checkpointPath)
WARNING: Increasing the size of this value beyond the default value (5242880) should be done with care. The checkpointed state needs to be send to the JobManager via limited size RPC messages, and there and the JobManager needs to be able to hold all aggregated state in its memory.
checkpointPath
- path to write checkpoint metadata to. If null, the value from the
runtime configuration will be used.public JobManagerCheckpointStorage(Path checkpointPath, int maxStateSize)
WARNING: Increasing the size of this value beyond the default value (5242880) should be done with care. The checkpointed state needs to be send to the JobManager via limited size RPC messages, and there and the JobManager needs to be able to hold all aggregated state in its memory.
maxStateSize
- The maximal size of the serialized state.public int getMaxStateSize()
@Nullable public Path getCheckpointPath()
@Nullable public Path getSavepointPath()
public JobManagerCheckpointStorage configure(ReadableConfig config, ClassLoader classLoader)
configure
in interface ConfigurableCheckpointStorage
config
- The configurationclassLoader
- The class loader that should be used to load the checkpoint storage.public static JobManagerCheckpointStorage createFromConfig(ReadableConfig config, ClassLoader classLoader) throws IllegalConfigurationException
JobManagerCheckpointStorage
using the given configuration.config
- The Flink configuration (loaded by the TaskManager).classLoader
- The clsas loader that should be used to load the checkpoint storage.IllegalConfigurationException
- If the configuration misses critical values, or
specifies invalid valuespublic CompletedCheckpointStorageLocation resolveCheckpoint(String pointer) throws IOException
CheckpointStorage
resolveCheckpoint
in interface CheckpointStorage
pointer
- 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 CheckpointStorageAccess createCheckpointStorage(JobID jobId) throws IOException
CheckpointStorage
createCheckpointStorage
in interface CheckpointStorage
jobId
- The job to store checkpoint data for.IOException
- Thrown if the checkpoint storage cannot be initialized.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.