public class StateBackendLoader extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HASHMAP_STATE_BACKEND_NAME
The shortcut configuration name of the HashMap state backend.
|
static String |
MEMORY_STATE_BACKEND_NAME
Deprecated.
|
static String |
ROCKSDB_STATE_BACKEND_NAME
The shortcut configuration name for the RocksDB State Backend.
|
Modifier and Type | Method and Description |
---|---|
static StateBackend |
fromApplicationOrConfigOrDefault(StateBackend fromApplication,
Configuration jobConfig,
Configuration clusterConfig,
ClassLoader classLoader,
org.slf4j.Logger logger)
This is the state backend loader that loads a
DelegatingStateBackend wrapping the
state backend loaded from loadFromApplicationOrConfigOrDefaultInternal(org.apache.flink.runtime.state.StateBackend, org.apache.flink.configuration.Configuration, org.apache.flink.configuration.Configuration, java.lang.ClassLoader, org.slf4j.Logger) when delegation is enabled. |
static boolean |
isChangelogStateBackend(StateBackend backend) |
static StateBackend |
loadStateBackendFromConfig(ReadableConfig config,
ClassLoader classLoader,
org.slf4j.Logger logger)
Loads the unwrapped state backend from the configuration, from the parameter 'state.backend',
as defined in
StateBackendOptions.STATE_BACKEND . |
static StateBackend |
loadStateBackendFromKeyedStateHandles(StateBackend originalStateBackend,
ClassLoader classLoader,
Collection<KeyedStateHandle> keyedStateHandles)
Load state backend which may wrap the original state backend for recovery.
|
static boolean |
stateBackendFromApplicationOrConfigOrDefaultUseManagedMemory(Configuration config,
Optional<Boolean> stateBackendFromApplicationUsesManagedMemory,
ClassLoader classLoader)
Checks whether state backend uses managed memory, without having to deserialize or load the
state backend.
|
public static final String HASHMAP_STATE_BACKEND_NAME
@Deprecated public static final String MEMORY_STATE_BACKEND_NAME
public static final String ROCKSDB_STATE_BACKEND_NAME
@Nonnull public static StateBackend loadStateBackendFromConfig(ReadableConfig config, ClassLoader classLoader, @Nullable org.slf4j.Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException
StateBackendOptions.STATE_BACKEND
.
The state backends can be specified either via their shortcut name, or via the class name
of a StateBackendFactory
. If a StateBackendFactory class name is specified, the
factory is instantiated (via its zero-argument constructor) and its StateBackendFactory.createFromConfig(ReadableConfig, ClassLoader)
method is called.
Recognized shortcut names are '', '' and '' (Deprecated)
config
- The configuration to load the state backend fromclassLoader
- The class loader that should be used to load the state backendlogger
- Optionally, a logger to log actions to (may be null)DynamicCodeLoadingException
- Thrown if a state backend factory is configured and the
factory class was not found or the factory could not be instantiatedIllegalConfigurationException
- May be thrown by the StateBackendFactory when creating
/ configuring the state backend in the factoryIOException
- May be thrown by the StateBackendFactory when instantiating the state
backendpublic static StateBackend fromApplicationOrConfigOrDefault(@Nullable StateBackend fromApplication, Configuration jobConfig, Configuration clusterConfig, ClassLoader classLoader, @Nullable org.slf4j.Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException
DelegatingStateBackend
wrapping the
state backend loaded from loadFromApplicationOrConfigOrDefaultInternal(org.apache.flink.runtime.state.StateBackend, org.apache.flink.configuration.Configuration, org.apache.flink.configuration.Configuration, java.lang.ClassLoader, org.slf4j.Logger)
when delegation is enabled.
If delegation is not enabled, the underlying wrapped state backend is returned instead.fromApplication
- StateBackend defined from applicationjobConfig
- The job level configuration to load the state backend fromclusterConfig
- The cluster level configuration to load the state backend fromclassLoader
- The class loader that should be used to load the state backendlogger
- Optionally, a logger to log actions to (may be null)DynamicCodeLoadingException
- Thrown if a state backend (factory) is configured and the
(factory) class was not found or could not be instantiatedIllegalConfigurationException
- May be thrown by the StateBackendFactory when creating
/ configuring the state backend in the factoryIOException
- May be thrown by the StateBackendFactory when instantiating the state
backendpublic static boolean stateBackendFromApplicationOrConfigOrDefaultUseManagedMemory(Configuration config, Optional<Boolean> stateBackendFromApplicationUsesManagedMemory, ClassLoader classLoader)
config
- configuration to load the state backend from.stateBackendFromApplicationUsesManagedMemory
- Whether the application-defined backend
uses Flink's managed memory. Empty if application has not defined a backend.classLoader
- User code classloader.public static StateBackend loadStateBackendFromKeyedStateHandles(StateBackend originalStateBackend, ClassLoader classLoader, Collection<KeyedStateHandle> keyedStateHandles) throws DynamicCodeLoadingException
originalStateBackend
- StateBackend loaded from application or config.classLoader
- User code classloader.keyedStateHandles
- The state handles for restore.DynamicCodeLoadingException
- Thrown if keyed state handles of wrapped state backend
are found and the class was not found or could not be instantiated.public static boolean isChangelogStateBackend(StateBackend backend)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.