Class ForStStateBackend

  • All Implemented Interfaces:
    Serializable, org.apache.flink.runtime.state.ConfigurableStateBackend, org.apache.flink.runtime.state.StateBackend

    @Experimental
    public class ForStStateBackend
    extends org.apache.flink.runtime.state.AbstractManagedMemoryStateBackend
    implements org.apache.flink.runtime.state.ConfigurableStateBackend
    A StateBackend that stores its state in a ForSt instance. This state backend can store very large state that exceeds memory even disk and spills to remote storage.

    The behavior of the ForSt instances can be parametrized by setting ForSt Options using the methods setForStOptions(ForStOptionsFactory).

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.flink.runtime.state.StateBackend

        org.apache.flink.runtime.state.StateBackend.CustomInitializationMetrics, org.apache.flink.runtime.state.StateBackend.KeyedStateBackendParameters<K extends Object>, org.apache.flink.runtime.state.StateBackend.OperatorStateBackendParameters
    • Field Summary

      • Fields inherited from class org.apache.flink.runtime.state.AbstractStateBackend

        latencyTrackingConfigBuilder
    • Constructor Summary

      Constructors 
      Constructor Description
      ForStStateBackend()
      Creates a new ForStStateBackend for storing state.
    • Constructor Detail

      • ForStStateBackend

        public ForStStateBackend()
        Creates a new ForStStateBackend for storing state.
    • Method Detail

      • configure

        public ForStStateBackend configure​(org.apache.flink.configuration.ReadableConfig config,
                                           ClassLoader classLoader)
        Creates a copy of this state backend that uses the values defined in the configuration for fields where that were not yet specified in this state backend.
        Specified by:
        configure in interface org.apache.flink.runtime.state.ConfigurableStateBackend
        Parameters:
        config - The configuration.
        classLoader - The class loader.
        Returns:
        The re-configured variant of the state backend
      • supportsAsyncKeyedStateBackend

        public boolean supportsAsyncKeyedStateBackend()
        Specified by:
        supportsAsyncKeyedStateBackend in interface org.apache.flink.runtime.state.StateBackend
      • createAsyncKeyedStateBackend

        public <K> ForStKeyedStateBackend<K> createAsyncKeyedStateBackend​(org.apache.flink.runtime.state.StateBackend.KeyedStateBackendParameters<K> parameters)
                                                                   throws IOException
        Specified by:
        createAsyncKeyedStateBackend in interface org.apache.flink.runtime.state.StateBackend
        Throws:
        IOException
      • createKeyedStateBackend

        public <K> org.apache.flink.runtime.state.AbstractKeyedStateBackend<K> createKeyedStateBackend​(org.apache.flink.runtime.state.StateBackend.KeyedStateBackendParameters<K> parameters)
        Specified by:
        createKeyedStateBackend in interface org.apache.flink.runtime.state.StateBackend
        Specified by:
        createKeyedStateBackend in class org.apache.flink.runtime.state.AbstractManagedMemoryStateBackend
      • createOperatorStateBackend

        public org.apache.flink.runtime.state.OperatorStateBackend createOperatorStateBackend​(org.apache.flink.runtime.state.StateBackend.OperatorStateBackendParameters parameters)
                                                                                       throws Exception
        Specified by:
        createOperatorStateBackend in interface org.apache.flink.runtime.state.StateBackend
        Specified by:
        createOperatorStateBackend in class org.apache.flink.runtime.state.AbstractStateBackend
        Throws:
        Exception
      • setLocalDbStoragePath

        public void setLocalDbStoragePath​(String path)
        Sets the path where the ForSt local files should be stored on the local file system. Setting this path overrides the default behavior, where the files are stored across the configured temp directories.

        Passing null to this function restores the default behavior, where the configured temp directories will be used.

        Parameters:
        path - The path where the local ForSt database files are stored.
      • setLocalDbStoragePaths

        public void setLocalDbStoragePaths​(String... paths)
        Sets the local directories in which the ForSt database puts some files (like metadata files). These directories do not need to be persistent, they can be ephemeral, meaning that they are lost on a machine failure, because state in ForSt is persisted in checkpoints.

        If nothing is configured, these directories default to the TaskManager's local temporary file directories.

        Each distinct state will be stored in one path, but when the state backend creates multiple states, they will store their files on different paths.

        Passing null to this function restores the default behavior, where the configured temp directories will be used.

        Parameters:
        paths - The paths across which the local ForSt database files will be spread.
      • getLocalDbStoragePaths

        public String[] getLocalDbStoragePaths()
        Gets the configured local DB storage paths, or null, if none were configured.

        Under these directories on the TaskManager, ForSt stores some metadata files. These directories do not need to be persistent, they can be ephermeral, meaning that they are lost on a machine failure, because state in ForSt is persisted in checkpoints.

        If nothing is configured, these directories default to the TaskManager's local temporary file directories.

      • setForStOptions

        public void setForStOptions​(ForStOptionsFactory optionsFactory)
        Sets Options for the ForSt instances. Because the options are not serializable and hold native code references, they must be specified through a factory.

        The options created by the factory here are applied on top of user-configured options from configuration set by configure(ReadableConfig, ClassLoader) with keys in ForStConfigurableOptions.

        Parameters:
        optionsFactory - The options factory that lazily creates the ForSt options.