Class HashMapStateBackend
- java.lang.Object
-
- org.apache.flink.runtime.state.AbstractStateBackend
-
- org.apache.flink.runtime.state.hashmap.HashMapStateBackend
-
- All Implemented Interfaces:
Serializable,ConfigurableStateBackend,StateBackend
@PublicEvolving public class HashMapStateBackend extends AbstractStateBackend implements ConfigurableStateBackend
This state backend holds the working state in the memory (JVM heap) of the TaskManagers and checkpoints based on the configuredCheckpointStorage.State Size Considerations
Working state is kept on the TaskManager heap. If a TaskManager executes multiple tasks concurrently (if the TaskManager has multiple slots, or if slot-sharing is used) then the aggregate state of all tasks needs to fit into that TaskManager's memory.
Configuration
As for all state backends, this backend can either be configured within the application (by creating the backend with the respective constructor parameters and setting it on the execution environment) or by specifying it in the Flink configuration.
If the state backend was specified in the application, it may pick up additional configuration parameters from the Flink configuration. For example, if the backend 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.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.state.StateBackend
StateBackend.CustomInitializationMetrics, StateBackend.KeyedStateBackendParameters<K>, StateBackend.OperatorStateBackendParameters
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.state.AbstractStateBackend
latencyTrackingConfigBuilder, sizeTrackingConfigBuilder
-
-
Constructor Summary
Constructors Constructor Description HashMapStateBackend()Creates a new state backend.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HashMapStateBackendconfigure(org.apache.flink.configuration.ReadableConfig config, ClassLoader classLoader)Creates a variant of the state backend that applies additional configuration parameters.<K> AbstractKeyedStateBackend<K>createKeyedStateBackend(StateBackend.KeyedStateBackendParameters<K> parameters)Creates a newCheckpointableKeyedStateBackendthat is responsible for holding keyed state and checkpointing it.OperatorStateBackendcreateOperatorStateBackend(StateBackend.OperatorStateBackendParameters parameters)Creates a newOperatorStateBackendthat can be used for storing operator state.booleansupportsNoClaimRestoreMode()Tells if a state backend supports theRecoveryClaimMode.NO_CLAIMmode.booleansupportsSavepointFormat(org.apache.flink.core.execution.SavepointFormatType formatType)-
Methods inherited from class org.apache.flink.runtime.state.AbstractStateBackend
getCompressionDecorator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.state.StateBackend
createAsyncKeyedStateBackend, getName, supportsAsyncKeyedStateBackend, useManagedMemory
-
-
-
-
Method Detail
-
configure
public HashMapStateBackend configure(org.apache.flink.configuration.ReadableConfig config, ClassLoader classLoader) throws org.apache.flink.configuration.IllegalConfigurationException
Description copied from interface:ConfigurableStateBackendCreates a variant of the state backend that applies additional configuration parameters.Settings that were directly done on the original state backend object in the application program typically have precedence over setting picked up from the configuration.
If no configuration is applied, or if the method directly applies configuration values to the (mutable) state backend object, this method may return the original state backend object. Otherwise it typically returns a modified copy.
- Specified by:
configurein interfaceConfigurableStateBackend- Parameters:
config- The configuration to pick the values from.classLoader- The class loader that should be used to load the state backend.- Returns:
- A reconfigured state backend.
- Throws:
org.apache.flink.configuration.IllegalConfigurationException- Thrown if the configuration contained invalid entries.
-
supportsNoClaimRestoreMode
public boolean supportsNoClaimRestoreMode()
Description copied from interface:StateBackendTells if a state backend supports theRecoveryClaimMode.NO_CLAIMmode.If a state backend supports
NO_CLAIMmode, it should create an independent snapshot when it receivesCheckpointType.FULL_CHECKPOINTinSnapshotable.snapshot(long, long, CheckpointStreamFactory, CheckpointOptions).- Specified by:
supportsNoClaimRestoreModein interfaceStateBackend- Returns:
- If the state backend supports
RecoveryClaimMode.NO_CLAIMmode.
-
supportsSavepointFormat
public boolean supportsSavepointFormat(org.apache.flink.core.execution.SavepointFormatType formatType)
- Specified by:
supportsSavepointFormatin interfaceStateBackend
-
createKeyedStateBackend
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(StateBackend.KeyedStateBackendParameters<K> parameters) throws IOException
Description copied from interface:StateBackendCreates a newCheckpointableKeyedStateBackendthat is responsible for holding keyed state and checkpointing it.Keyed State is state where each value is bound to a key.
- Specified by:
createKeyedStateBackendin interfaceStateBackend- Specified by:
createKeyedStateBackendin classAbstractStateBackend- Type Parameters:
K- The type of the keys by which the state is organized.- Parameters:
parameters- The arguments bundle for creatingCheckpointableKeyedStateBackend.- Returns:
- The Keyed State Backend for the given job, operator, and key group range.
- Throws:
IOException
-
createOperatorStateBackend
public OperatorStateBackend createOperatorStateBackend(StateBackend.OperatorStateBackendParameters parameters) throws BackendBuildingException
Description copied from interface:StateBackendCreates a newOperatorStateBackendthat can be used for storing operator state.Operator state is state that is associated with parallel operator (or function) instances, rather than with keys.
- Specified by:
createOperatorStateBackendin interfaceStateBackend- Specified by:
createOperatorStateBackendin classAbstractStateBackend- Parameters:
parameters- The arguments bundle for creatingOperatorStateBackend.- Returns:
- The OperatorStateBackend for operator identified by the job and operator identifier.
- Throws:
BackendBuildingException
-
-