Class RocksDBResourceContainer

java.lang.Object
org.apache.flink.state.rocksdb.RocksDBResourceContainer
All Implemented Interfaces:
AutoCloseable

public final class RocksDBResourceContainer extends Object implements AutoCloseable
The container for RocksDB resources, including predefined options, option factory and shared resource among instances.

This should be the only entrance for EmbeddedRocksDBStateBackend to get RocksDB options, and should be properly (and necessarily) closed to prevent resource leak.

  • Constructor Details

    • RocksDBResourceContainer

      @VisibleForTesting public RocksDBResourceContainer()
    • RocksDBResourceContainer

      @VisibleForTesting public RocksDBResourceContainer(PredefinedOptions predefinedOptions, @Nullable RocksDBOptionsFactory optionsFactory)
    • RocksDBResourceContainer

      @VisibleForTesting public RocksDBResourceContainer(PredefinedOptions predefinedOptions, @Nullable RocksDBOptionsFactory optionsFactory, @Nullable org.apache.flink.runtime.memory.OpaqueMemoryResource<org.apache.flink.state.rocksdb.RocksDBSharedResources> sharedResources)
    • RocksDBResourceContainer

      public RocksDBResourceContainer(org.apache.flink.configuration.ReadableConfig configuration, PredefinedOptions predefinedOptions, @Nullable RocksDBOptionsFactory optionsFactory, @Nullable org.apache.flink.runtime.memory.OpaqueMemoryResource<org.apache.flink.state.rocksdb.RocksDBSharedResources> sharedResources, @Nullable File instanceBasePath, boolean enableStatistics)
  • Method Details

    • getDbOptions

      public org.rocksdb.DBOptions getDbOptions()
      Gets the RocksDB DBOptions to be used for RocksDB instances.
    • getWriteBufferManagerCapacity

      public Long getWriteBufferManagerCapacity()
      Gets write buffer manager capacity.
      Returns:
      the capacity of the write buffer manager, or null if write buffer manager is not enabled.
    • getQueryTimeAfterNumEntries

      public Long getQueryTimeAfterNumEntries()
      Gets the "queryTimeAfterNumEntries" parameter from the configuration.
    • getPeriodicCompactionTime

      public Duration getPeriodicCompactionTime()
      Gets the "getPeriodicCompactionTime" parameter from the configuration.
    • getColumnOptions

      public org.rocksdb.ColumnFamilyOptions getColumnOptions()
      Gets the RocksDB ColumnFamilyOptions to be used for all RocksDB instances.
    • getWriteOptions

      public org.rocksdb.WriteOptions getWriteOptions()
      Gets the RocksDB WriteOptions to be used for write operations.
    • getReadOptions

      public org.rocksdb.ReadOptions getReadOptions()
      Gets the RocksDB ReadOptions to be used for read operations.
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception