Class BackendRestorerProcedure<T extends Closeable & org.apache.flink.util.Disposable,​S extends StateObject>

  • Type Parameters:
    T - type of the restored backend.
    S - type of the supplied snapshots from which the backend restores.

    public class BackendRestorerProcedure<T extends Closeable & org.apache.flink.util.Disposable,​S extends StateObject>
    extends Object
    This class implements the logic that creates (and potentially restores) a state backend. The restore logic considers multiple, prioritized options of snapshots to restore from, where all of the options should recreate the same state for the backend. When we fail to restore from the snapshot with the highest priority (typically the "fastest" to restore), we fallback to the next snapshot with the next highest priority. We also take care of cleaning up from failed restore attempts. We only reattempt when the problem occurs during the restore call and will only stop after all snapshot alternatives are exhausted and all failed.
    • Constructor Detail

      • BackendRestorerProcedure

        public BackendRestorerProcedure​(@Nonnull
                                        org.apache.flink.util.function.FunctionWithException<Collection<S>,​T,​Exception> instanceSupplier,
                                        @Nonnull
                                        org.apache.flink.core.fs.CloseableRegistry backendCloseableRegistry,
                                        @Nonnull
                                        String logDescription)
        Creates a new backend restorer using the given backend supplier and the closeable registry.
        Parameters:
        instanceSupplier - factory function for new, empty backend instances.
        backendCloseableRegistry - registry to allow participation in task lifecycle, e.g. react to cancel.
    • Method Detail

      • createAndRestore

        @Nonnull
        public T createAndRestore​(@Nonnull
                                  List<? extends Collection<S>> restoreOptions,
                                  @Nonnull
                                  StateObject.StateObjectSizeStatsCollector stats)
                           throws Exception
        Creates a new state backend and restores it from the provided set of state snapshot alternatives.
        Parameters:
        restoreOptions - list of prioritized state snapshot alternatives for recovery.
        Returns:
        the created (and restored) state backend.
        Throws:
        Exception - if the backend could not be created or restored.