Class DistributeStateHandlerHelper

  • All Implemented Interfaces:
    AutoCloseable

    public class DistributeStateHandlerHelper
    extends Object
    implements AutoCloseable
    Helper class for distributing state handle data during RocksDB incremental restore. This class encapsulates the logic for processing a single state handle.
    • Constructor Summary

      Constructors 
      Constructor Description
      DistributeStateHandlerHelper​(org.apache.flink.runtime.state.IncrementalLocalKeyedStateHandle stateHandle, List<org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot> stateMetaInfoSnapshots, Function<String,​org.rocksdb.ColumnFamilyOptions> columnFamilyOptionsFactory, org.rocksdb.DBOptions dbOptions, RocksDbTtlCompactFiltersManager ttlCompactFiltersManager, Long writeBufferManagerCapacity, int keyGroupPrefixBytes, org.apache.flink.runtime.state.KeyGroupRange keyGroupRange, String operatorIdentifier, int index)
      Creates a helper for processing a single state handle.
    • Constructor Detail

      • DistributeStateHandlerHelper

        public DistributeStateHandlerHelper​(org.apache.flink.runtime.state.IncrementalLocalKeyedStateHandle stateHandle,
                                            List<org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot> stateMetaInfoSnapshots,
                                            Function<String,​org.rocksdb.ColumnFamilyOptions> columnFamilyOptionsFactory,
                                            org.rocksdb.DBOptions dbOptions,
                                            RocksDbTtlCompactFiltersManager ttlCompactFiltersManager,
                                            Long writeBufferManagerCapacity,
                                            int keyGroupPrefixBytes,
                                            org.apache.flink.runtime.state.KeyGroupRange keyGroupRange,
                                            String operatorIdentifier,
                                            int index)
                                     throws Exception
        Creates a helper for processing a single state handle. The database instance is created in the constructor to enable proper resource management and separation of concerns.
        Parameters:
        stateHandle - the state handle to process
        columnFamilyOptionsFactory - factory for creating column family options
        dbOptions - database options
        ttlCompactFiltersManager - TTL compact filters manager (can be null)
        writeBufferManagerCapacity - write buffer manager capacity (can be null)
        keyGroupPrefixBytes - number of key group prefix bytes for SST file range checking
        keyGroupRange - target key group range (for logging)
        operatorIdentifier - operator identifier (for logging)
        index - current processing index (for logging)
        Throws:
        Exception - on any database opening error
    • Method Detail

      • tryDistribute

        public org.apache.flink.types.Either<org.apache.flink.runtime.state.KeyGroupRange,​org.apache.flink.runtime.state.IncrementalLocalKeyedStateHandle> tryDistribute​(Path exportCfBasePath,
                                                                                                                                                                               Map<org.apache.flink.runtime.state.RegisteredStateMetaInfoBase.Key,​List<org.rocksdb.ExportImportFilesMetaData>> exportedColumnFamiliesOut)
                                                                                                                                                                        throws Exception
        Distributes state handle data by checking SST file ranges and exporting column families. Returns Left if successfully exported, Right if the handle was skipped.
        Parameters:
        exportCfBasePath - base path for export
        exportedColumnFamiliesOut - output parameter for exported column families
        Returns:
        Either.Left containing key group range if successfully exported, Either.Right containing the skipped state handle otherwise
        Throws:
        Exception - on any export error