Package org.rocksdb

Class Options

All Implemented Interfaces:
AutoCloseable, AdvancedColumnFamilyOptionsInterface<Options>, AdvancedMutableColumnFamilyOptionsInterface<Options>, ColumnFamilyOptionsInterface<Options>, DBOptionsInterface<Options>, MutableColumnFamilyOptionsInterface<Options>, MutableDBOptionsInterface<Options>

Options to control the behavior of a database. It will be used during the creation of a RocksDB (i.e., RocksDB.open()).

As a descendent of AbstractNativeReference, this class is AutoCloseable and will be automatically released if opened in the preamble of a try with resources block.

  • Constructor Details

    • Options

      public Options()
      Construct options for opening a RocksDB.

      This constructor will create (by allocating a block of memory) an rocksdb::Options in the c++ side.

    • Options

      public Options(DBOptions dbOptions, ColumnFamilyOptions columnFamilyOptions)
      Construct options for opening a RocksDB. Reusing database options and column family options.
      Parameters:
      dbOptions - DBOptions instance
      columnFamilyOptions - ColumnFamilyOptions instance
    • Options

      public Options(Options other)
      Copy constructor for ColumnFamilyOptions.

      NOTE: This does a shallow copy, which means comparator, merge_operator and other pointers will be cloned!

      Parameters:
      other - The Options to copy.
  • Method Details

    • getOptionStringFromProps

      public static String getOptionStringFromProps(Properties properties)
      Converts the input properties into a Options-style formatted string
      Parameters:
      properties - The set of properties to convert
      Returns:
      The Options-style representation of those properties.
    • setIncreaseParallelism

      public Options setIncreaseParallelism(int totalThreads)
      Description copied from interface: DBOptionsInterface

      By default, RocksDB uses only one background thread for flush and compaction. Calling this function will set it up such that total of `total_threads` is used.

      You almost definitely want to call this function if your system is bottlenecked by RocksDB.

      Specified by:
      setIncreaseParallelism in interface DBOptionsInterface<Options>
      Parameters:
      totalThreads - The total number of threads to be used by RocksDB. A good value is the number of cores.
      Returns:
      the instance of the current Options
    • setCreateIfMissing

      public Options setCreateIfMissing(boolean flag)
      Description copied from interface: DBOptionsInterface
      If this value is set to true, then the database will be created if it is missing during RocksDB.open(). Default: false
      Specified by:
      setCreateIfMissing in interface DBOptionsInterface<Options>
      Parameters:
      flag - a flag indicating whether to create a database the specified database in RocksDB.open(org.rocksdb.Options, String) operation is missing.
      Returns:
      the instance of the current Options
      See Also:
    • setCreateMissingColumnFamilies

      public Options setCreateMissingColumnFamilies(boolean flag)
      Description copied from interface: DBOptionsInterface

      If true, missing column families will be automatically created

      Default: false

      Specified by:
      setCreateMissingColumnFamilies in interface DBOptionsInterface<Options>
      Parameters:
      flag - a flag indicating if missing column families shall be created automatically.
      Returns:
      true if missing column families shall be created automatically on open.
    • setEnv

      public Options setEnv(Env env)
      Description copied from interface: DBOptionsInterface
      Use the specified object to interact with the environment, e.g. to read/write files, schedule background work, etc. Default: Env.getDefault()
      Specified by:
      setEnv in interface DBOptionsInterface<Options>
      Parameters:
      env - Env instance.
      Returns:
      the instance of the current Options.
    • getEnv

      public Env getEnv()
      Description copied from interface: DBOptionsInterface
      Returns the set RocksEnv instance.
      Specified by:
      getEnv in interface DBOptionsInterface<Options>
      Returns:
      RocksEnv instance set in the options.
    • prepareForBulkLoad

      public Options prepareForBulkLoad()

      Set appropriate parameters for bulk loading. The reason that this is a function that returns "this" instead of a constructor is to enable chaining of multiple similar calls in the future.

      All data will be in level 0 without any automatic compaction. It's recommended to manually call CompactRange(NULL, NULL) before reading from the database, because otherwise the read can be very slow.

      Returns:
      the instance of the current Options.
    • createIfMissing

      public boolean createIfMissing()
      Description copied from interface: DBOptionsInterface
      Return true if the create_if_missing flag is set to true. If true, the database will be created if it is missing.
      Specified by:
      createIfMissing in interface DBOptionsInterface<Options>
      Returns:
      true if the createIfMissing option is set to true.
      See Also:
    • createMissingColumnFamilies

      public boolean createMissingColumnFamilies()
      Description copied from interface: DBOptionsInterface
      Return true if the create_missing_column_families flag is set to true. If true column families be created if missing.
      Specified by:
      createMissingColumnFamilies in interface DBOptionsInterface<Options>
      Returns:
      true if the createMissingColumnFamilies is set to true.
      See Also:
    • oldDefaults

      public Options oldDefaults(int majorVersion, int minorVersion)
      Description copied from interface: ColumnFamilyOptionsInterface
      The function recovers options to a previous version. Only 4.6 or later versions are supported.
      Specified by:
      oldDefaults in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      majorVersion - The major version to recover default values of options
      minorVersion - The minor version to recover default values of options
      Returns:
      the instance of the current object.
    • optimizeForSmallDb

      public Options optimizeForSmallDb()
      Description copied from interface: DBOptionsInterface
      Use this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables.
      Specified by:
      optimizeForSmallDb in interface ColumnFamilyOptionsInterface<Options>
      Specified by:
      optimizeForSmallDb in interface DBOptionsInterface<Options>
      Returns:
      the instance of the current object.
    • optimizeForSmallDb

      public Options optimizeForSmallDb(Cache cache)
      Description copied from interface: ColumnFamilyOptionsInterface
      Some functions that make it easier to optimize RocksDB Use this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables.
      Specified by:
      optimizeForSmallDb in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      cache - An optional cache object is passed in to be used as the block cache
      Returns:
      the instance of the current object.
    • optimizeForPointLookup

      public Options optimizeForPointLookup(long blockCacheSizeMb)
      Description copied from interface: ColumnFamilyOptionsInterface
      Use this if you don't need to keep the data sorted, i.e. you'll never use an iterator, only Put() and Get() API calls
      Specified by:
      optimizeForPointLookup in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      blockCacheSizeMb - Block cache size in MB
      Returns:
      the instance of the current object.
    • optimizeLevelStyleCompaction

      public Options optimizeLevelStyleCompaction()
      Description copied from interface: ColumnFamilyOptionsInterface

      Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for level style compaction.

      Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.

      Note: we might use more memory than memtable_memory_budget during high write rate period

      Specified by:
      optimizeLevelStyleCompaction in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the instance of the current object.
    • optimizeLevelStyleCompaction

      public Options optimizeLevelStyleCompaction(long memtableMemoryBudget)
      Description copied from interface: ColumnFamilyOptionsInterface

      Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for level style compaction.

      Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.

      Note: we might use more memory than memtable_memory_budget during high write rate period

      Specified by:
      optimizeLevelStyleCompaction in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      memtableMemoryBudget - memory budget in bytes
      Returns:
      the instance of the current object.
    • optimizeUniversalStyleCompaction

      public Options optimizeUniversalStyleCompaction()
      Description copied from interface: ColumnFamilyOptionsInterface

      Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for universal style compaction.

      Universal style compaction is focused on reducing Write Amplification Factor for big data sets, but increases Space Amplification.

      Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.

      Note: we might use more memory than memtable_memory_budget during high write rate period

      Specified by:
      optimizeUniversalStyleCompaction in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the instance of the current object.
    • optimizeUniversalStyleCompaction

      public Options optimizeUniversalStyleCompaction(long memtableMemoryBudget)
      Description copied from interface: ColumnFamilyOptionsInterface

      Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for universal style compaction.

      Universal style compaction is focused on reducing Write Amplification Factor for big data sets, but increases Space Amplification.

      Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.

      Note: we might use more memory than memtable_memory_budget during high write rate period

      Specified by:
      optimizeUniversalStyleCompaction in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      memtableMemoryBudget - memory budget in bytes
      Returns:
      the instance of the current object.
    • setComparator

      public Options setComparator(BuiltinComparator builtinComparator)
      Description copied from interface: ColumnFamilyOptionsInterface
      Set BuiltinComparator to be used with RocksDB.

      Note: Comparator can be set once upon database creation.

      Default: BytewiseComparator.

      Specified by:
      setComparator in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      builtinComparator - a BuiltinComparator type.
      Returns:
      the instance of the current object.
    • setComparator

      public Options setComparator(AbstractComparator comparator)
      Description copied from interface: ColumnFamilyOptionsInterface
      Use the specified comparator for key ordering.

      Comparator should not be disposed before options instances using this comparator is disposed. If dispose() function is not called, then comparator object will be GC'd automatically.

      Comparator instance can be re-used in multiple options instances.

      Specified by:
      setComparator in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      comparator - java instance.
      Returns:
      the instance of the current object.
    • setMergeOperatorName

      public Options setMergeOperatorName(String name)
      Description copied from interface: ColumnFamilyOptionsInterface

      Set the merge operator to be used for merging two merge operands of the same key. The merge function is invoked during compaction and at lookup time, if multiple key/value pairs belonging to the same key are found in the database.

      Specified by:
      setMergeOperatorName in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      name - the name of the merge function, as defined by the MergeOperators factory (see utilities/MergeOperators.h) The merge function is specified by name and must be one of the standard merge operators provided by RocksDB. The available operators are "put", "uint64add", "stringappend" and "stringappendtest".
      Returns:
      the instance of the current object.
    • setMergeOperator

      public Options setMergeOperator(MergeOperator mergeOperator)
      Description copied from interface: ColumnFamilyOptionsInterface

      Set the merge operator to be used for merging two different key/value pairs that share the same key. The merge function is invoked during compaction and at lookup time, if multiple key/value pairs belonging to the same key are found in the database.

      Specified by:
      setMergeOperator in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      mergeOperator - MergeOperator instance.
      Returns:
      the instance of the current object.
    • setCompactionFilter

      public Options setCompactionFilter(AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter)
      Description copied from interface: ColumnFamilyOptionsInterface
      A single CompactionFilter instance to call into during compaction. Allows an application to modify/delete a key-value during background compaction.

      If the client requires a new compaction filter to be used for different compaction runs, it can specify call ColumnFamilyOptionsInterface.setCompactionFilterFactory(AbstractCompactionFilterFactory) instead.

      The client should specify only set one of the two. {#setCompactionFilter(AbstractCompactionFilter)} takes precedence over ColumnFamilyOptionsInterface.setCompactionFilterFactory(AbstractCompactionFilterFactory) if the client specifies both.

      If multithreaded compaction is being used, the supplied CompactionFilter instance may be used from different threads concurrently and so should be thread-safe.

      Specified by:
      setCompactionFilter in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionFilter - AbstractCompactionFilter instance.
      Returns:
      the instance of the current object.
    • compactionFilter

      public AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter()
      Description copied from interface: ColumnFamilyOptionsInterface
      Accessor for the CompactionFilter instance in use.
      Specified by:
      compactionFilter in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      Reference to the CompactionFilter, or null if one hasn't been set.
    • setCompactionFilterFactory

      public Options setCompactionFilterFactory(AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory)
      Description copied from interface: ColumnFamilyOptionsInterface
      This is a factory that provides AbstractCompactionFilter objects which allow an application to modify/delete a key-value during background compaction.

      A new filter will be created on each compaction run. If multithreaded compaction is being used, each created CompactionFilter will only be used from a single thread and so does not need to be thread-safe.

      Specified by:
      setCompactionFilterFactory in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionFilterFactory - AbstractCompactionFilterFactory instance.
      Returns:
      the instance of the current object.
    • compactionFilterFactory

      public AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory()
      Description copied from interface: ColumnFamilyOptionsInterface
      Accessor for the CompactionFilterFactory instance in use.
      Specified by:
      compactionFilterFactory in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      Reference to the CompactionFilterFactory, or null if one hasn't been set.
    • setWriteBufferSize

      public Options setWriteBufferSize(long writeBufferSize)
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Amount of data to build up in memory (backed by an unsorted log on disk) before converting to a sorted on-disk file.

      Larger values increase performance, especially during bulk loads. Up to max_write_buffer_number write buffers may be held in memory at the same time, so you may wish to adjust this parameter to control memory usage.

      Also, a larger write buffer will result in a longer recovery time the next time the database is opened.

      Default: 64MB

      Specified by:
      setWriteBufferSize in interface MutableColumnFamilyOptionsInterface<Options>
      Parameters:
      writeBufferSize - the size of write buffer.
      Returns:
      the instance of the current object.
    • writeBufferSize

      public long writeBufferSize()
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Return size of write buffer size.
      Specified by:
      writeBufferSize in interface MutableColumnFamilyOptionsInterface<Options>
      Returns:
      size of write buffer.
      See Also:
    • setMaxWriteBufferNumber

      public Options setMaxWriteBufferNumber(int maxWriteBufferNumber)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      The maximum number of write buffers that are built up in memory. The default is 2, so that when 1 write buffer is being flushed to storage, new writes can continue to the other write buffer. Default: 2
      Specified by:
      setMaxWriteBufferNumber in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      maxWriteBufferNumber - maximum number of write buffers.
      Returns:
      the instance of the current options.
    • maxWriteBufferNumber

      public int maxWriteBufferNumber()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Returns maximum number of write buffers.
      Specified by:
      maxWriteBufferNumber in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      maximum number of write buffers.
      See Also:
    • errorIfExists

      public boolean errorIfExists()
      Description copied from interface: DBOptionsInterface
      If true, an error will be thrown during RocksDB.open() if the database already exists.
      Specified by:
      errorIfExists in interface DBOptionsInterface<Options>
      Returns:
      if true, an error is raised when the specified database already exists before open.
    • setErrorIfExists

      public Options setErrorIfExists(boolean errorIfExists)
      Description copied from interface: DBOptionsInterface
      If true, an error will be thrown during RocksDB.open() if the database already exists. Default: false
      Specified by:
      setErrorIfExists in interface DBOptionsInterface<Options>
      Parameters:
      errorIfExists - if true, an exception will be thrown during RocksDB.open() if the database already exists.
      Returns:
      the reference to the current option.
      See Also:
    • paranoidChecks

      public boolean paranoidChecks()
      Description copied from interface: DBOptionsInterface
      If true, the implementation will do aggressive checking of the data it is processing and will stop early if it detects any errors. This may have unforeseen ramifications: for example, a corruption of one DB entry may cause a large number of entries to become unreadable or for the entire DB to become unopenable. If any of the writes to the database fails (Put, Delete, Merge, Write), the database will switch to read-only mode and fail all other Write operations.
      Specified by:
      paranoidChecks in interface DBOptionsInterface<Options>
      Returns:
      a boolean indicating whether paranoid-check is on.
    • setParanoidChecks

      public Options setParanoidChecks(boolean paranoidChecks)
      Description copied from interface: DBOptionsInterface
      If true, the implementation will do aggressive checking of the data it is processing and will stop early if it detects any errors. This may have unforeseen ramifications: for example, a corruption of one DB entry may cause a large number of entries to become unreadable or for the entire DB to become unopenable. If any of the writes to the database fails (Put, Delete, Merge, Write), the database will switch to read-only mode and fail all other Write operations. Default: true
      Specified by:
      setParanoidChecks in interface DBOptionsInterface<Options>
      Parameters:
      paranoidChecks - a flag to indicate whether paranoid-check is on.
      Returns:
      the reference to the current option.
    • maxOpenFiles

      public int maxOpenFiles()
      Description copied from interface: MutableDBOptionsInterface
      Number of open files that can be used by the DB. You may need to increase this if your database has a large working set. Value -1 means files opened are always kept open. You can estimate number of files based on target_file_size_base and target_file_size_multiplier for level-based compaction. For universal-style compaction, you can usually set it to -1. Default: -1
      Specified by:
      maxOpenFiles in interface MutableDBOptionsInterface<Options>
      Returns:
      the maximum number of open files.
    • setMaxFileOpeningThreads

      public Options setMaxFileOpeningThreads(int maxFileOpeningThreads)
      Description copied from interface: DBOptionsInterface
      If MutableDBOptionsInterface.maxOpenFiles() is -1, DB will open all files on DB::Open(). You can use this option to increase the number of threads used to open the files. Default: 16
      Specified by:
      setMaxFileOpeningThreads in interface DBOptionsInterface<Options>
      Parameters:
      maxFileOpeningThreads - the maximum number of threads to use to open files
      Returns:
      the reference to the current options.
    • maxFileOpeningThreads

      public int maxFileOpeningThreads()
      Description copied from interface: DBOptionsInterface
      If MutableDBOptionsInterface.maxOpenFiles() is -1, DB will open all files on DB::Open(). You can use this option to increase the number of threads used to open the files. Default: 16
      Specified by:
      maxFileOpeningThreads in interface DBOptionsInterface<Options>
      Returns:
      the maximum number of threads to use to open files
    • setMaxTotalWalSize

      public Options setMaxTotalWalSize(long maxTotalWalSize)
      Description copied from interface: MutableDBOptionsInterface

      Set the max total write-ahead log size. Once write-ahead logs exceed this size, we will start forcing the flush of column families whose memtables are backed by the oldest live WAL file

      The oldest WAL files are the ones that are causing all the space amplification.

      For example, with 15 column families, each with write_buffer_size = 128 MB max_write_buffer_number = 6 max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 = 45GB

      The RocksDB wiki has some discussion about how the WAL interacts with memtables and flushing of column families, at ...

      If set to 0 (default), we will dynamically choose the WAL size limit to be [sum of all write_buffer_size * max_write_buffer_number] * 4

      This option takes effect only when there are more than one column family as otherwise the wal size is dictated by the write_buffer_size.

      Default: 0

      Specified by:
      setMaxTotalWalSize in interface MutableDBOptionsInterface<Options>
      Parameters:
      maxTotalWalSize - max total wal size.
      Returns:
      the instance of the current object.
    • maxTotalWalSize

      public long maxTotalWalSize()
      Description copied from interface: MutableDBOptionsInterface

      Returns the max total write-ahead log size. Once write-ahead logs exceed this size, we will start forcing the flush of column families whose memtables are backed by the oldest live WAL file.

      The oldest WAL files are the ones that are causing all the space amplification.

      For example, with 15 column families, each with write_buffer_size = 128 MB max_write_buffer_number = 6 max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 = 45GB

      The RocksDB wiki has some discussion about how the WAL interacts with memtables and flushing of column families, at ...

      If set to 0 (default), we will dynamically choose the WAL size limit to be [sum of all write_buffer_size * max_write_buffer_number] * 4

      This option takes effect only when there are more than one column family as otherwise the wal size is dictated by the write_buffer_size.

      Default: 0

      If set to 0 (default), we will dynamically choose the WAL size limit to be [sum of all write_buffer_size * max_write_buffer_number] * 4

      Specified by:
      maxTotalWalSize in interface MutableDBOptionsInterface<Options>
      Returns:
      max total wal size
    • setMaxOpenFiles

      public Options setMaxOpenFiles(int maxOpenFiles)
      Description copied from interface: MutableDBOptionsInterface
      Number of open files that can be used by the DB. You may need to increase this if your database has a large working set. Value -1 means files opened are always kept open. You can estimate number of files based on target_file_size_base and target_file_size_multiplier for level-based compaction. For universal-style compaction, you can usually set it to -1. Default: -1
      Specified by:
      setMaxOpenFiles in interface MutableDBOptionsInterface<Options>
      Parameters:
      maxOpenFiles - the maximum number of open files.
      Returns:
      the instance of the current object.
    • useFsync

      public boolean useFsync()
      Description copied from interface: DBOptionsInterface

      If true, then every store to stable storage will issue a fsync.

      If false, then every store to stable storage will issue a fdatasync. This parameter should be set to true while storing data to filesystem like ext3 that can lose files after a reboot.

      Specified by:
      useFsync in interface DBOptionsInterface<Options>
      Returns:
      boolean value indicating if fsync is used.
    • setUseFsync

      public Options setUseFsync(boolean useFsync)
      Description copied from interface: DBOptionsInterface

      If true, then every store to stable storage will issue a fsync.

      If false, then every store to stable storage will issue a fdatasync. This parameter should be set to true while storing data to filesystem like ext3 that can lose files after a reboot.

      Default: false

      Specified by:
      setUseFsync in interface DBOptionsInterface<Options>
      Parameters:
      useFsync - a boolean flag to specify whether to use fsync
      Returns:
      the instance of the current object.
    • setDbPaths

      public Options setDbPaths(Collection<DbPath> dbPaths)
      Description copied from interface: DBOptionsInterface
      A list of paths where SST files can be put into, with its target size. Newer data is placed into paths specified earlier in the vector while older data gradually moves to paths specified later in the vector. For example, you have a flash device with 10GB allocated for the DB, as well as a hard drive of 2TB, you should config it to be: [{"/flash_path", 10GB}, {"/hard_drive", 2TB}] The system will try to guarantee data under each path is close to but not larger than the target size. But current and future file sizes used by determining where to place a file are based on best-effort estimation, which means there is a chance that the actual size under the directory is slightly more than target size under some workloads. User should give some buffer room for those cases. If none of the paths has sufficient room to place a file, the file will be placed to the last path anyway, despite to the target size. Placing newer data to earlier paths is also best-efforts. User should expect user files to be placed in higher levels in some extreme cases. If left empty, only one path will be used, which is db_name passed when opening the DB. Default: empty
      Specified by:
      setDbPaths in interface DBOptionsInterface<Options>
      Parameters:
      dbPaths - the paths and target sizes
      Returns:
      the reference to the current options
    • dbPaths

      public List<DbPath> dbPaths()
      Description copied from interface: DBOptionsInterface
      A list of paths where SST files can be put into, with its target size. Newer data is placed into paths specified earlier in the vector while older data gradually moves to paths specified later in the vector. For example, you have a flash device with 10GB allocated for the DB, as well as a hard drive of 2TB, you should config it to be: [{"/flash_path", 10GB}, {"/hard_drive", 2TB}] The system will try to guarantee data under each path is close to but not larger than the target size. But current and future file sizes used by determining where to place a file are based on best-effort estimation, which means there is a chance that the actual size under the directory is slightly more than target size under some workloads. User should give some buffer room for those cases. If none of the paths has sufficient room to place a file, the file will be placed to the last path anyway, despite to the target size. Placing newer data to earlier paths is also best-efforts. User should expect user files to be placed in higher levels in some extreme cases. If left empty, only one path will be used, which is db_name passed when opening the DB. Default: Collections.emptyList()
      Specified by:
      dbPaths in interface DBOptionsInterface<Options>
      Returns:
      dbPaths the paths and target sizes
    • dbLogDir

      public String dbLogDir()
      Description copied from interface: DBOptionsInterface
      Returns the directory of info log. If it is empty, the log files will be in the same dir as data. If it is non empty, the log files will be in the specified dir, and the db data dir's absolute path will be used as the log file name's prefix.
      Specified by:
      dbLogDir in interface DBOptionsInterface<Options>
      Returns:
      the path to the info log directory
    • setDbLogDir

      public Options setDbLogDir(String dbLogDir)
      Description copied from interface: DBOptionsInterface
      This specifies the info LOG dir. If it is empty, the log files will be in the same dir as data. If it is non empty, the log files will be in the specified dir, and the db data dir's absolute path will be used as the log file name's prefix.
      Specified by:
      setDbLogDir in interface DBOptionsInterface<Options>
      Parameters:
      dbLogDir - the path to the info log directory
      Returns:
      the instance of the current object.
    • walDir

      public String walDir()
      Description copied from interface: DBOptionsInterface
      Returns the path to the write-ahead-logs (WAL) directory. If it is empty, the log files will be in the same dir as data, dbname is used as the data dir by default If it is non empty, the log files will be in kept the specified dir. When destroying the db, all log files in wal_dir and the dir itself is deleted
      Specified by:
      walDir in interface DBOptionsInterface<Options>
      Returns:
      the path to the write-ahead-logs (WAL) directory.
    • setWalDir

      public Options setWalDir(String walDir)
      Description copied from interface: DBOptionsInterface
      This specifies the absolute dir path for write-ahead logs (WAL). If it is empty, the log files will be in the same dir as data, dbname is used as the data dir by default If it is non empty, the log files will be in kept the specified dir. When destroying the db, all log files in wal_dir and the dir itself is deleted
      Specified by:
      setWalDir in interface DBOptionsInterface<Options>
      Parameters:
      walDir - the path to the write-ahead-log directory.
      Returns:
      the instance of the current object.
    • deleteObsoleteFilesPeriodMicros

      public long deleteObsoleteFilesPeriodMicros()
      Description copied from interface: DBOptionsInterface
      The periodicity when obsolete files get deleted. The default value is 6 hours. The files that get out of scope by compaction process will still get automatically delete on every compaction, regardless of this setting
      Specified by:
      deleteObsoleteFilesPeriodMicros in interface DBOptionsInterface<Options>
      Specified by:
      deleteObsoleteFilesPeriodMicros in interface MutableDBOptionsInterface<Options>
      Returns:
      the time interval in micros when obsolete files will be deleted.
    • setDeleteObsoleteFilesPeriodMicros

      public Options setDeleteObsoleteFilesPeriodMicros(long micros)
      Description copied from interface: DBOptionsInterface
      The periodicity when obsolete files get deleted. The default value is 6 hours. The files that get out of scope by compaction process will still get automatically delete on every compaction, regardless of this setting
      Specified by:
      setDeleteObsoleteFilesPeriodMicros in interface DBOptionsInterface<Options>
      Specified by:
      setDeleteObsoleteFilesPeriodMicros in interface MutableDBOptionsInterface<Options>
      Parameters:
      micros - the time interval in micros
      Returns:
      the instance of the current object.
    • maxBackgroundCompactions

      @Deprecated public int maxBackgroundCompactions()
      Deprecated.
      Description copied from interface: MutableDBOptionsInterface
      NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes` (we replace -1 by 1 in case one option is unset).

      Returns the maximum number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. When increasing this number, we may also want to consider increasing number of threads in LOW priority thread pool. Default: -1

      Specified by:
      maxBackgroundCompactions in interface MutableDBOptionsInterface<Options>
      Returns:
      the maximum number of concurrent background compaction jobs.
      See Also:
    • setStatistics

      public Options setStatistics(Statistics statistics)
      Description copied from interface: DBOptionsInterface

      Sets the statistics object which collects metrics about database operations. Statistics objects should not be shared between DB instances as it does not use any locks to prevent concurrent updates.

      Specified by:
      setStatistics in interface DBOptionsInterface<Options>
      Parameters:
      statistics - The statistics to set
      Returns:
      the instance of the current object.
      See Also:
    • statistics

      public Statistics statistics()
      Description copied from interface: DBOptionsInterface

      Returns statistics object.

      Specified by:
      statistics in interface DBOptionsInterface<Options>
      Returns:
      the instance of the statistics object or null if there is no statistics object.
      See Also:
    • setMaxBackgroundCompactions

      @Deprecated public Options setMaxBackgroundCompactions(int maxBackgroundCompactions)
      Deprecated.
      Description copied from interface: MutableDBOptionsInterface
      NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes` (we replace -1 by 1 in case one option is unset).

      Specifies the maximum number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. If you're increasing this, also consider increasing number of threads in LOW priority thread pool. For more information, see Default: -1

      Specified by:
      setMaxBackgroundCompactions in interface MutableDBOptionsInterface<Options>
      Parameters:
      maxBackgroundCompactions - the maximum number of background compaction jobs.
      Returns:
      the instance of the current object.
      See Also:
    • setMaxSubcompactions

      public Options setMaxSubcompactions(int maxSubcompactions)
      Description copied from interface: DBOptionsInterface
      This value represents the maximum number of threads that will concurrently perform a compaction job by breaking it into multiple, smaller ones that are run simultaneously. Default: 1 (i.e. no subcompactions)
      Specified by:
      setMaxSubcompactions in interface DBOptionsInterface<Options>
      Parameters:
      maxSubcompactions - The maximum number of threads that will concurrently perform a compaction job
      Returns:
      the instance of the current object.
    • maxSubcompactions

      public int maxSubcompactions()
      Description copied from interface: DBOptionsInterface
      This value represents the maximum number of threads that will concurrently perform a compaction job by breaking it into multiple, smaller ones that are run simultaneously. Default: 1 (i.e. no subcompactions)
      Specified by:
      maxSubcompactions in interface DBOptionsInterface<Options>
      Returns:
      The maximum number of threads that will concurrently perform a compaction job
    • maxBackgroundFlushes

      @Deprecated public int maxBackgroundFlushes()
      Deprecated.
      Description copied from interface: DBOptionsInterface
      NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes`. Returns the maximum number of concurrent background flush jobs. If you're increasing this, also consider increasing number of threads in HIGH priority thread pool. For more information, see Default: -1
      Specified by:
      maxBackgroundFlushes in interface DBOptionsInterface<Options>
      Returns:
      the maximum number of concurrent background flush jobs.
      See Also:
    • setMaxBackgroundFlushes

      @Deprecated public Options setMaxBackgroundFlushes(int maxBackgroundFlushes)
      Deprecated.
      Description copied from interface: DBOptionsInterface
      NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes`. Specifies the maximum number of concurrent background flush jobs. If you're increasing this, also consider increasing number of threads in HIGH priority thread pool. For more information, see Default: -1
      Specified by:
      setMaxBackgroundFlushes in interface DBOptionsInterface<Options>
      Parameters:
      maxBackgroundFlushes - number of max concurrent flush jobs
      Returns:
      the instance of the current object.
      See Also:
    • maxBackgroundJobs

      public int maxBackgroundJobs()
      Description copied from interface: MutableDBOptionsInterface
      Returns the maximum number of concurrent background jobs (both flushes and compactions combined). Default: 2
      Specified by:
      maxBackgroundJobs in interface MutableDBOptionsInterface<Options>
      Returns:
      the maximum number of concurrent background jobs.
    • setMaxBackgroundJobs

      public Options setMaxBackgroundJobs(int maxBackgroundJobs)
      Description copied from interface: MutableDBOptionsInterface
      Specifies the maximum number of concurrent background jobs (both flushes and compactions combined). Default: 2
      Specified by:
      setMaxBackgroundJobs in interface MutableDBOptionsInterface<Options>
      Parameters:
      maxBackgroundJobs - number of max concurrent background jobs
      Returns:
      the instance of the current object.
    • maxLogFileSize

      public long maxLogFileSize()
      Description copied from interface: DBOptionsInterface
      Returns the maximum size of a info log file. If the current log file is larger than this size, a new info log file will be created. If 0, all logs will be written to one log file.
      Specified by:
      maxLogFileSize in interface DBOptionsInterface<Options>
      Returns:
      the maximum size of the info log file.
    • setMaxLogFileSize

      public Options setMaxLogFileSize(long maxLogFileSize)
      Description copied from interface: DBOptionsInterface
      Specifies the maximum size of a info log file. If the current log file is larger than `max_log_file_size`, a new info log file will be created. If 0, all logs will be written to one log file.
      Specified by:
      setMaxLogFileSize in interface DBOptionsInterface<Options>
      Parameters:
      maxLogFileSize - the maximum size of a info log file.
      Returns:
      the instance of the current object.
    • logFileTimeToRoll

      public long logFileTimeToRoll()
      Description copied from interface: DBOptionsInterface
      Returns the time interval for the info log file to roll (in seconds). If specified with non-zero value, log file will be rolled if it has been active longer than `log_file_time_to_roll`. Default: 0 (disabled)
      Specified by:
      logFileTimeToRoll in interface DBOptionsInterface<Options>
      Returns:
      the time interval in seconds.
    • setLogFileTimeToRoll

      public Options setLogFileTimeToRoll(long logFileTimeToRoll)
      Description copied from interface: DBOptionsInterface
      Specifies the time interval for the info log file to roll (in seconds). If specified with non-zero value, log file will be rolled if it has been active longer than `log_file_time_to_roll`. Default: 0 (disabled)
      Specified by:
      setLogFileTimeToRoll in interface DBOptionsInterface<Options>
      Parameters:
      logFileTimeToRoll - the time interval in seconds.
      Returns:
      the instance of the current object.
    • keepLogFileNum

      public long keepLogFileNum()
      Description copied from interface: DBOptionsInterface
      Returns the maximum number of info log files to be kept. Default: 1000
      Specified by:
      keepLogFileNum in interface DBOptionsInterface<Options>
      Returns:
      the maximum number of info log files to be kept.
    • setKeepLogFileNum

      public Options setKeepLogFileNum(long keepLogFileNum)
      Description copied from interface: DBOptionsInterface
      Specifies the maximum number of info log files to be kept. Default: 1000
      Specified by:
      setKeepLogFileNum in interface DBOptionsInterface<Options>
      Parameters:
      keepLogFileNum - the maximum number of info log files to be kept.
      Returns:
      the instance of the current object.
    • setRecycleLogFileNum

      public Options setRecycleLogFileNum(long recycleLogFileNum)
      Description copied from interface: DBOptionsInterface
      Recycle log files. If non-zero, we will reuse previously written log files for new logs, overwriting the old data. The value indicates how many such files we will keep around at any point in time for later use. This is more efficient because the blocks are already allocated and fdatasync does not need to update the inode after each write. Default: 0
      Specified by:
      setRecycleLogFileNum in interface DBOptionsInterface<Options>
      Parameters:
      recycleLogFileNum - the number of log files to keep for recycling
      Returns:
      the reference to the current options
    • recycleLogFileNum

      public long recycleLogFileNum()
      Description copied from interface: DBOptionsInterface
      Recycle log files. If non-zero, we will reuse previously written log files for new logs, overwriting the old data. The value indicates how many such files we will keep around at any point in time for later use. This is more efficient because the blocks are already allocated and fdatasync does not need to update the inode after each write. Default: 0
      Specified by:
      recycleLogFileNum in interface DBOptionsInterface<Options>
      Returns:
      the number of log files kept for recycling
    • maxManifestFileSize

      public long maxManifestFileSize()
      Description copied from interface: DBOptionsInterface
      Manifest file is rolled over on reaching this limit. The older manifest file be deleted. The default value is 1GB so that the manifest file can grow, but not reach the limit of storage capacity.
      Specified by:
      maxManifestFileSize in interface DBOptionsInterface<Options>
      Returns:
      the size limit of a manifest file.
    • setMaxManifestFileSize

      public Options setMaxManifestFileSize(long maxManifestFileSize)
      Description copied from interface: DBOptionsInterface
      Manifest file is rolled over on reaching this limit. The older manifest file be deleted. The default value is 1GB so that the manifest file can grow, but not reach the limit of storage capacity.
      Specified by:
      setMaxManifestFileSize in interface DBOptionsInterface<Options>
      Parameters:
      maxManifestFileSize - the size limit of a manifest file.
      Returns:
      the instance of the current object.
    • setMaxTableFilesSizeFIFO

      public Options setMaxTableFilesSizeFIFO(long maxTableFilesSize)
      Description copied from interface: ColumnFamilyOptionsInterface
      FIFO compaction option. The oldest table file will be deleted once the sum of table files reaches this size. The default value is 1GB (1 * 1024 * 1024 * 1024).
      Specified by:
      setMaxTableFilesSizeFIFO in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      maxTableFilesSize - the size limit of the total sum of table files.
      Returns:
      the instance of the current object.
    • maxTableFilesSizeFIFO

      public long maxTableFilesSizeFIFO()
      Description copied from interface: ColumnFamilyOptionsInterface
      FIFO compaction option. The oldest table file will be deleted once the sum of table files reaches this size. The default value is 1GB (1 * 1024 * 1024 * 1024).
      Specified by:
      maxTableFilesSizeFIFO in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the size limit of the total sum of table files.
    • tableCacheNumshardbits

      public int tableCacheNumshardbits()
      Description copied from interface: DBOptionsInterface
      Number of shards used for table cache.
      Specified by:
      tableCacheNumshardbits in interface DBOptionsInterface<Options>
      Returns:
      the number of shards used for table cache.
    • setTableCacheNumshardbits

      public Options setTableCacheNumshardbits(int tableCacheNumshardbits)
      Description copied from interface: DBOptionsInterface
      Number of shards used for table cache.
      Specified by:
      setTableCacheNumshardbits in interface DBOptionsInterface<Options>
      Parameters:
      tableCacheNumshardbits - the number of chards
      Returns:
      the instance of the current object.
    • walTtlSeconds

      public long walTtlSeconds()
      Description copied from interface: DBOptionsInterface
      WalTtlSeconds() and walSizeLimitMB() affect when WALs will be archived and deleted. When both are zero, obsolete WALs will not be archived and will be deleted immediately. Otherwise, obsolete WALs will be archived prior to deletion. When `WAL_size_limit_MB` is nonzero, archived WALs starting with the earliest will be deleted until the total size of the archive falls below this limit. All empty WALs will be deleted. When `WAL_ttl_seconds` is nonzero, archived WALs older than `WAL_ttl_seconds` will be deleted. When only `WAL_ttl_seconds` is nonzero, the frequency at which archived WALs are deleted is every `WAL_ttl_seconds / 2` seconds. When only `WAL_size_limit_MB` is nonzero, the deletion frequency is every ten minutes. When both are nonzero, the deletion frequency is the minimum of those two values.
      Specified by:
      walTtlSeconds in interface DBOptionsInterface<Options>
      Returns:
      the wal-ttl seconds
      See Also:
    • setWalTtlSeconds

      public Options setWalTtlSeconds(long walTtlSeconds)
      Description copied from interface: DBOptionsInterface
      DBOptionsInterface.walTtlSeconds() and DBOptionsInterface.walSizeLimitMB() affect when WALs will be archived and deleted. When both are zero, obsolete WALs will not be archived and will be deleted immediately. Otherwise, obsolete WALs will be archived prior to deletion. When `WAL_size_limit_MB` is nonzero, archived WALs starting with the earliest will be deleted until the total size of the archive falls below this limit. All empty WALs will be deleted. When `WAL_ttl_seconds` is nonzero, archived WALs older than `WAL_ttl_seconds` will be deleted. When only `WAL_ttl_seconds` is nonzero, the frequency at which archived WALs are deleted is every `WAL_ttl_seconds / 2` seconds. When only `WAL_size_limit_MB` is nonzero, the deletion frequency is every ten minutes. When both are nonzero, the deletion frequency is the minimum of those two values.
      Specified by:
      setWalTtlSeconds in interface DBOptionsInterface<Options>
      Parameters:
      walTtlSeconds - the ttl seconds
      Returns:
      the instance of the current object.
      See Also:
    • walSizeLimitMB

      public long walSizeLimitMB()
      Description copied from interface: DBOptionsInterface
      WalTtlSeconds() and walSizeLimitMB() affect when WALs will be archived and deleted. When both are zero, obsolete WALs will not be archived and will be deleted immediately. Otherwise, obsolete WALs will be archived prior to deletion. When `WAL_size_limit_MB` is nonzero, archived WALs starting with the earliest will be deleted until the total size of the archive falls below this limit. All empty WALs will be deleted. When `WAL_ttl_seconds` is nonzero, archived WALs older than `WAL_ttl_seconds` will be deleted. When only `WAL_ttl_seconds` is nonzero, the frequency at which archived WALs are deleted is every `WAL_ttl_seconds / 2` seconds. When only `WAL_size_limit_MB` is nonzero, the deletion frequency is every ten minutes. When both are nonzero, the deletion frequency is the minimum of those two values.
      Specified by:
      walSizeLimitMB in interface DBOptionsInterface<Options>
      Returns:
      size limit in mega-bytes.
      See Also:
    • setMaxWriteBatchGroupSizeBytes

      public Options setMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)
      Description copied from interface: DBOptionsInterface
      The maximum limit of number of bytes that are written in a single batch of WAL or memtable write. It is followed when the leader write size is larger than 1/8 of this limit. Default: 1 MB
      Specified by:
      setMaxWriteBatchGroupSizeBytes in interface DBOptionsInterface<Options>
      Parameters:
      maxWriteBatchGroupSizeBytes - the maximum limit of number of bytes, see description.
      Returns:
      the instance of the current object.
    • maxWriteBatchGroupSizeBytes

      public long maxWriteBatchGroupSizeBytes()
      Description copied from interface: DBOptionsInterface
      The maximum limit of number of bytes that are written in a single batch of WAL or memtable write. It is followed when the leader write size is larger than 1/8 of this limit. Default: 1 MB
      Specified by:
      maxWriteBatchGroupSizeBytes in interface DBOptionsInterface<Options>
      Returns:
      the maximum limit of number of bytes, see description.
    • setWalSizeLimitMB

      public Options setWalSizeLimitMB(long sizeLimitMB)
      Description copied from interface: DBOptionsInterface
      WalTtlSeconds() and walSizeLimitMB() affect how archived logs will be deleted. When both are zero, obsolete WALs will not be archived and will be deleted immediately. Otherwise, obsolete WALs will be archived prior to deletion. When `WAL_size_limit_MB` is nonzero, archived WALs starting with the earliest will be deleted until the total size of the archive falls below this limit. All empty WALs will be deleted. When `WAL_ttl_seconds` is nonzero, archived WALs older than `WAL_ttl_seconds` will be deleted. When only `WAL_ttl_seconds` is nonzero, the frequency at which archived WALs are deleted is every `WAL_ttl_seconds / 2` seconds. When only `WAL_size_limit_MB` is nonzero, the deletion frequency is every ten minutes. When both are nonzero, the deletion frequency is the minimum of those two values.
      Specified by:
      setWalSizeLimitMB in interface DBOptionsInterface<Options>
      Parameters:
      sizeLimitMB - size limit in mega-bytes.
      Returns:
      the instance of the current object.
      See Also:
    • manifestPreallocationSize

      public long manifestPreallocationSize()
      Description copied from interface: DBOptionsInterface
      Number of bytes to preallocate (via fallocate) the manifest files. Default is 4mb, which is reasonable to reduce random IO as well as prevent overallocation for mounts that preallocate large amounts of data (such as xfs's allocsize option).
      Specified by:
      manifestPreallocationSize in interface DBOptionsInterface<Options>
      Returns:
      size in bytes.
    • setManifestPreallocationSize

      public Options setManifestPreallocationSize(long size)
      Description copied from interface: DBOptionsInterface
      Number of bytes to preallocate (via fallocate) the manifest files. Default is 4mb, which is reasonable to reduce random IO as well as prevent overallocation for mounts that preallocate large amounts of data (such as xfs's allocsize option).
      Specified by:
      setManifestPreallocationSize in interface DBOptionsInterface<Options>
      Parameters:
      size - the size in byte
      Returns:
      the instance of the current object.
    • setUseDirectReads

      public Options setUseDirectReads(boolean useDirectReads)
      Description copied from interface: DBOptionsInterface
      Enable the OS to use direct I/O for reading sst tables. Default: false
      Specified by:
      setUseDirectReads in interface DBOptionsInterface<Options>
      Parameters:
      useDirectReads - if true, then direct read is enabled
      Returns:
      the instance of the current object.
    • useDirectReads

      public boolean useDirectReads()
      Description copied from interface: DBOptionsInterface
      Enable the OS to use direct I/O for reading sst tables. Default: false
      Specified by:
      useDirectReads in interface DBOptionsInterface<Options>
      Returns:
      if true, then direct reads are enabled
    • setUseDirectIoForFlushAndCompaction

      public Options setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
      Description copied from interface: DBOptionsInterface
      Enable the OS to use direct reads and writes in flush and compaction Default: false
      Specified by:
      setUseDirectIoForFlushAndCompaction in interface DBOptionsInterface<Options>
      Parameters:
      useDirectIoForFlushAndCompaction - if true, then direct I/O will be enabled for background flush and compactions
      Returns:
      the instance of the current object.
    • useDirectIoForFlushAndCompaction

      public boolean useDirectIoForFlushAndCompaction()
      Description copied from interface: DBOptionsInterface
      Enable the OS to use direct reads and writes in flush and compaction
      Specified by:
      useDirectIoForFlushAndCompaction in interface DBOptionsInterface<Options>
      Returns:
      if true, then direct I/O is enabled for flush and compaction
    • setAllowFAllocate

      public Options setAllowFAllocate(boolean allowFAllocate)
      Description copied from interface: DBOptionsInterface
      Whether fallocate calls are allowed
      Specified by:
      setAllowFAllocate in interface DBOptionsInterface<Options>
      Parameters:
      allowFAllocate - false if fallocate() calls are bypassed
      Returns:
      the reference to the current options.
    • allowFAllocate

      public boolean allowFAllocate()
      Description copied from interface: DBOptionsInterface
      Whether fallocate calls are allowed
      Specified by:
      allowFAllocate in interface DBOptionsInterface<Options>
      Returns:
      false if fallocate() calls are bypassed
    • allowMmapReads

      public boolean allowMmapReads()
      Description copied from interface: DBOptionsInterface
      Allow the OS to mmap file for reading sst tables. Default: false
      Specified by:
      allowMmapReads in interface DBOptionsInterface<Options>
      Returns:
      true if mmap reads are allowed.
    • setAllowMmapReads

      public Options setAllowMmapReads(boolean allowMmapReads)
      Description copied from interface: DBOptionsInterface
      Allow the OS to mmap file for reading sst tables. Default: false
      Specified by:
      setAllowMmapReads in interface DBOptionsInterface<Options>
      Parameters:
      allowMmapReads - true if mmap reads are allowed.
      Returns:
      the instance of the current object.
    • allowMmapWrites

      public boolean allowMmapWrites()
      Description copied from interface: DBOptionsInterface
      Allow the OS to mmap file for writing. Default: false
      Specified by:
      allowMmapWrites in interface DBOptionsInterface<Options>
      Returns:
      true if mmap writes are allowed.
    • setAllowMmapWrites

      public Options setAllowMmapWrites(boolean allowMmapWrites)
      Description copied from interface: DBOptionsInterface
      Allow the OS to mmap file for writing. Default: false
      Specified by:
      setAllowMmapWrites in interface DBOptionsInterface<Options>
      Parameters:
      allowMmapWrites - true if mmap writes are allowd.
      Returns:
      the instance of the current object.
    • isFdCloseOnExec

      public boolean isFdCloseOnExec()
      Description copied from interface: DBOptionsInterface
      Disable child process inherit open files. Default: true
      Specified by:
      isFdCloseOnExec in interface DBOptionsInterface<Options>
      Returns:
      true if child process inheriting open files is disabled.
    • setIsFdCloseOnExec

      public Options setIsFdCloseOnExec(boolean isFdCloseOnExec)
      Description copied from interface: DBOptionsInterface
      Disable child process inherit open files. Default: true
      Specified by:
      setIsFdCloseOnExec in interface DBOptionsInterface<Options>
      Parameters:
      isFdCloseOnExec - true if child process inheriting open files is disabled.
      Returns:
      the instance of the current object.
    • statsDumpPeriodSec

      public int statsDumpPeriodSec()
      Description copied from interface: MutableDBOptionsInterface
      If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)
      Specified by:
      statsDumpPeriodSec in interface MutableDBOptionsInterface<Options>
      Returns:
      time interval in seconds.
    • setStatsDumpPeriodSec

      public Options setStatsDumpPeriodSec(int statsDumpPeriodSec)
      Description copied from interface: MutableDBOptionsInterface
      if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)
      Specified by:
      setStatsDumpPeriodSec in interface MutableDBOptionsInterface<Options>
      Parameters:
      statsDumpPeriodSec - time interval in seconds.
      Returns:
      the instance of the current object.
    • setStatsPersistPeriodSec

      public Options setStatsPersistPeriodSec(int statsPersistPeriodSec)
      Description copied from interface: MutableDBOptionsInterface
      If not zero, dump rocksdb.stats to RocksDB every statsPersistPeriodSec Default: 600
      Specified by:
      setStatsPersistPeriodSec in interface MutableDBOptionsInterface<Options>
      Parameters:
      statsPersistPeriodSec - time interval in seconds.
      Returns:
      the instance of the current object.
    • statsPersistPeriodSec

      public int statsPersistPeriodSec()
      Description copied from interface: MutableDBOptionsInterface
      If not zero, dump rocksdb.stats to RocksDB every statsPersistPeriodSec
      Specified by:
      statsPersistPeriodSec in interface MutableDBOptionsInterface<Options>
      Returns:
      time interval in seconds.
    • setStatsHistoryBufferSize

      public Options setStatsHistoryBufferSize(long statsHistoryBufferSize)
      Description copied from interface: MutableDBOptionsInterface
      If not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped at statsHistoryBufferSize Default: 1MB
      Specified by:
      setStatsHistoryBufferSize in interface MutableDBOptionsInterface<Options>
      Parameters:
      statsHistoryBufferSize - the size of the buffer.
      Returns:
      the instance of the current object.
    • statsHistoryBufferSize

      public long statsHistoryBufferSize()
      Description copied from interface: MutableDBOptionsInterface
      If not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped at statsHistoryBufferSize
      Specified by:
      statsHistoryBufferSize in interface MutableDBOptionsInterface<Options>
      Returns:
      the size of the buffer.
    • adviseRandomOnOpen

      public boolean adviseRandomOnOpen()
      Description copied from interface: DBOptionsInterface
      If set true, will hint the underlying file system that the file access pattern is random, when a sst file is opened. Default: true
      Specified by:
      adviseRandomOnOpen in interface DBOptionsInterface<Options>
      Returns:
      true if hinting random access is on.
    • setAdviseRandomOnOpen

      public Options setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
      Description copied from interface: DBOptionsInterface
      If set true, will hint the underlying file system that the file access pattern is random, when a sst file is opened. Default: true
      Specified by:
      setAdviseRandomOnOpen in interface DBOptionsInterface<Options>
      Parameters:
      adviseRandomOnOpen - true if hinting random access is on.
      Returns:
      the instance of the current object.
    • setDbWriteBufferSize

      public Options setDbWriteBufferSize(long dbWriteBufferSize)
      Description copied from interface: DBOptionsInterface
      Amount of data to build up in memtables across all column families before writing to disk. This is distinct from ColumnFamilyOptions.writeBufferSize(), which enforces a limit for a single memtable. This feature is disabled by default. Specify a non-zero value to enable it. Default: 0 (disabled)
      Specified by:
      setDbWriteBufferSize in interface DBOptionsInterface<Options>
      Parameters:
      dbWriteBufferSize - the size of the write buffer
      Returns:
      the reference to the current options.
    • setWriteBufferManager

      public Options setWriteBufferManager(WriteBufferManager writeBufferManager)
      Description copied from interface: DBOptionsInterface
      Use passed WriteBufferManager to control memory usage across multiple column families and/or DB instances. Check https://github.com/facebook/rocksdb/wiki/Write-Buffer-Manager for more details on when to use it
      Specified by:
      setWriteBufferManager in interface DBOptionsInterface<Options>
      Parameters:
      writeBufferManager - The WriteBufferManager to use
      Returns:
      the reference of the current options.
    • writeBufferManager

      public WriteBufferManager writeBufferManager()
      Description copied from interface: DBOptionsInterface
      Reference to WriteBufferManager used by it.
      Default: null (Disabled)
      Specified by:
      writeBufferManager in interface DBOptionsInterface<Options>
      Returns:
      a reference to WriteBufferManager
    • dbWriteBufferSize

      public long dbWriteBufferSize()
      Description copied from interface: DBOptionsInterface
      Amount of data to build up in memtables across all column families before writing to disk. This is distinct from ColumnFamilyOptions.writeBufferSize(), which enforces a limit for a single memtable. This feature is disabled by default. Specify a non-zero value to enable it. Default: 0 (disabled)
      Specified by:
      dbWriteBufferSize in interface DBOptionsInterface<Options>
      Returns:
      the size of the write buffer
    • setCompactionReadaheadSize

      public Options setCompactionReadaheadSize(long compactionReadaheadSize)
      Description copied from interface: MutableDBOptionsInterface
      If non-zero, we perform bigger reads when doing compaction. If you're running RocksDB on spinning disks, you should set this to at least 2MB.

      That way RocksDB's compaction is doing sequential instead of random reads.

      Default: 2MB

      Specified by:
      setCompactionReadaheadSize in interface MutableDBOptionsInterface<Options>
      Parameters:
      compactionReadaheadSize - The compaction read-ahead size
      Returns:
      the reference to the current options.
    • compactionReadaheadSize

      public long compactionReadaheadSize()
      Description copied from interface: MutableDBOptionsInterface
      If non-zero, we perform bigger reads when doing compaction. If you're running RocksDB on spinning disks, you should set this to at least 2MB.

      That way RocksDB's compaction is doing sequential instead of random reads.

      Default: 0

      Specified by:
      compactionReadaheadSize in interface MutableDBOptionsInterface<Options>
      Returns:
      The compaction read-ahead size
    • setRandomAccessMaxBufferSize

      public Options setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
      Description copied from interface: DBOptionsInterface
      This is a maximum buffer size that is used by WinMmapReadableFile in unbuffered disk I/O mode. We need to maintain an aligned buffer for reads. We allow the buffer to grow until the specified value and then for bigger requests allocate one shot buffers. In unbuffered mode we always bypass read-ahead buffer at ReadaheadRandomAccessFile When read-ahead is required we then make use of MutableDBOptionsInterface.compactionReadaheadSize() value and always try to read ahead. With read-ahead we always pre-allocate buffer to the size instead of growing it up to a limit. This option is currently honored only on Windows Default: 1 Mb Special value: 0 - means do not maintain per instance buffer. Allocate per request buffer and avoid locking.
      Specified by:
      setRandomAccessMaxBufferSize in interface DBOptionsInterface<Options>
      Parameters:
      randomAccessMaxBufferSize - the maximum size of the random access buffer
      Returns:
      the reference to the current options.
    • randomAccessMaxBufferSize

      public long randomAccessMaxBufferSize()
      Description copied from interface: DBOptionsInterface
      This is a maximum buffer size that is used by WinMmapReadableFile in unbuffered disk I/O mode. We need to maintain an aligned buffer for reads. We allow the buffer to grow until the specified value and then for bigger requests allocate one shot buffers. In unbuffered mode we always bypass read-ahead buffer at ReadaheadRandomAccessFile When read-ahead is required we then make use of MutableDBOptionsInterface.compactionReadaheadSize() value and always try to read ahead. With read-ahead we always pre-allocate buffer to the size instead of growing it up to a limit. This option is currently honored only on Windows Default: 1 Mb Special value: 0 - means do not maintain per instance buffer. Allocate per request buffer and avoid locking.
      Specified by:
      randomAccessMaxBufferSize in interface DBOptionsInterface<Options>
      Returns:
      the maximum size of the random access buffer
    • setWritableFileMaxBufferSize

      public Options setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
      Description copied from interface: MutableDBOptionsInterface
      This is the maximum buffer size that is used by WritableFileWriter. On Windows, we need to maintain an aligned buffer for writes. We allow the buffer to grow until it's size hits the limit.

      Default: 1024 * 1024 (1 MB)

      Specified by:
      setWritableFileMaxBufferSize in interface MutableDBOptionsInterface<Options>
      Parameters:
      writableFileMaxBufferSize - the maximum buffer size
      Returns:
      the reference to the current options.
    • writableFileMaxBufferSize

      public long writableFileMaxBufferSize()
      Description copied from interface: MutableDBOptionsInterface
      This is the maximum buffer size that is used by WritableFileWriter. On Windows, we need to maintain an aligned buffer for writes. We allow the buffer to grow until it's size hits the limit.

      Default: 1024 * 1024 (1 MB)

      Specified by:
      writableFileMaxBufferSize in interface MutableDBOptionsInterface<Options>
      Returns:
      the maximum buffer size
    • useAdaptiveMutex

      public boolean useAdaptiveMutex()
      Description copied from interface: DBOptionsInterface
      Use adaptive mutex, which spins in the user space before resorting to kernel. This could reduce context switch when the mutex is not heavily contended. However, if the mutex is hot, we could end up wasting spin time. Default: false
      Specified by:
      useAdaptiveMutex in interface DBOptionsInterface<Options>
      Returns:
      true if adaptive mutex is used.
    • setUseAdaptiveMutex

      public Options setUseAdaptiveMutex(boolean useAdaptiveMutex)
      Description copied from interface: DBOptionsInterface
      Use adaptive mutex, which spins in the user space before resorting to kernel. This could reduce context switch when the mutex is not heavily contended. However, if the mutex is hot, we could end up wasting spin time. Default: false
      Specified by:
      setUseAdaptiveMutex in interface DBOptionsInterface<Options>
      Parameters:
      useAdaptiveMutex - true if adaptive mutex is used.
      Returns:
      the instance of the current object.
    • bytesPerSync

      public long bytesPerSync()
      Description copied from interface: MutableDBOptionsInterface
      Allows OS to incrementally sync files to disk while they are being written, asynchronously, in the background. Issue one request for every bytes_per_sync written. 0 turns it off. Default: 0
      Specified by:
      bytesPerSync in interface MutableDBOptionsInterface<Options>
      Returns:
      size in bytes
    • setBytesPerSync

      public Options setBytesPerSync(long bytesPerSync)
      Description copied from interface: MutableDBOptionsInterface
      Allows OS to incrementally sync files to disk while they are being written, asynchronously, in the background. Issue one request for every bytes_per_sync written. 0 turns it off. Default: 0
      Specified by:
      setBytesPerSync in interface MutableDBOptionsInterface<Options>
      Parameters:
      bytesPerSync - size in bytes
      Returns:
      the instance of the current object.
    • setWalBytesPerSync

      public Options setWalBytesPerSync(long walBytesPerSync)
      Description copied from interface: MutableDBOptionsInterface
      Same as MutableDBOptionsInterface.setBytesPerSync(long) , but applies to WAL files

      Default: 0, turned off

      Specified by:
      setWalBytesPerSync in interface MutableDBOptionsInterface<Options>
      Parameters:
      walBytesPerSync - size in bytes
      Returns:
      the instance of the current object.
    • walBytesPerSync

      public long walBytesPerSync()
      Description copied from interface: MutableDBOptionsInterface
      Same as MutableDBOptionsInterface.bytesPerSync() , but applies to WAL files

      Default: 0, turned off

      Specified by:
      walBytesPerSync in interface MutableDBOptionsInterface<Options>
      Returns:
      size in bytes
    • setStrictBytesPerSync

      public Options setStrictBytesPerSync(boolean strictBytesPerSync)
      Description copied from interface: MutableDBOptionsInterface
      When true, guarantees WAL files have at most MutableDBOptionsInterface.walBytesPerSync() bytes submitted for writeback at any given time, and SST files have at most MutableDBOptionsInterface.bytesPerSync() bytes pending writeback at any given time. This can be used to handle cases where processing speed exceeds I/O speed during file generation, which can lead to a huge sync when the file is finished, even with MutableDBOptionsInterface.bytesPerSync() / MutableDBOptionsInterface.walBytesPerSync() properly configured.

      - If `sync_file_range` is supported it achieves this by waiting for any prior `sync_file_range`s to finish before proceeding. In this way, processing (compression, etc.) can proceed uninhibited in the gap between `sync_file_range`s, and we block only when I/O falls behind. - Otherwise the `WritableFile::Sync` method is used. Note this mechanism always blocks, thus preventing the interleaving of I/O and processing.

      Note: Enabling this option does not provide any additional persistence guarantees, as it may use `sync_file_range`, which does not write out metadata.

      Default: false

      Specified by:
      setStrictBytesPerSync in interface MutableDBOptionsInterface<Options>
      Parameters:
      strictBytesPerSync - the bytes per sync
      Returns:
      the instance of the current object.
    • strictBytesPerSync

      public boolean strictBytesPerSync()
      Description copied from interface: MutableDBOptionsInterface
      Return the strict byte limit per sync.

      See MutableDBOptionsInterface.setStrictBytesPerSync(boolean)

      Specified by:
      strictBytesPerSync in interface MutableDBOptionsInterface<Options>
      Returns:
      the limit in bytes.
    • setListeners

      public Options setListeners(List<AbstractEventListener> listeners)
      Description copied from interface: DBOptionsInterface
      Sets the EventListeners whose callback functions will be called when specific RocksDB event happens. Note: the RocksJava API currently only supports EventListeners implemented in Java. It could be extended in future to also support adding/removing EventListeners implemented in C++.
      Specified by:
      setListeners in interface DBOptionsInterface<Options>
      Parameters:
      listeners - the listeners who should be notified on various events.
      Returns:
      the instance of the current object.
    • listeners

      public List<AbstractEventListener> listeners()
      Description copied from interface: DBOptionsInterface
      Sets the EventListeners whose callback functions will be called when specific RocksDB event happens. Note: the RocksJava API currently only supports EventListeners implemented in Java. It could be extended in future to also support adding/removing EventListeners implemented in C++.
      Specified by:
      listeners in interface DBOptionsInterface<Options>
      Returns:
      the instance of the current object.
    • setEnableThreadTracking

      public Options setEnableThreadTracking(boolean enableThreadTracking)
      Description copied from interface: DBOptionsInterface
      If true, then the status of the threads involved in this DB will be tracked and available via GetThreadList() API. Default: false
      Specified by:
      setEnableThreadTracking in interface DBOptionsInterface<Options>
      Parameters:
      enableThreadTracking - true to enable tracking
      Returns:
      the reference to the current options.
    • enableThreadTracking

      public boolean enableThreadTracking()
      Description copied from interface: DBOptionsInterface
      If true, then the status of the threads involved in this DB will be tracked and available via GetThreadList() API. Default: false
      Specified by:
      enableThreadTracking in interface DBOptionsInterface<Options>
      Returns:
      true if tracking is enabled
    • setDelayedWriteRate

      public Options setDelayedWriteRate(long delayedWriteRate)
      Description copied from interface: MutableDBOptionsInterface
      The limited write rate to DB if ColumnFamilyOptions.softPendingCompactionBytesLimit() or ColumnFamilyOptions.level0SlowdownWritesTrigger() is triggered, or we are writing to the last mem table allowed and we allow more than 3 mem tables. It is calculated using size of user write requests before compression. RocksDB may decide to slow down more if the compaction still gets behind further. If the value is 0, we will infer a value from `rater_limiter` value if it is not empty, or 16MB if `rater_limiter` is empty. Note that if users change the rate in `rate_limiter` after DB is opened, `delayed_write_rate` won't be adjusted.

      Unit: bytes per second.

      Default: 0

      Dynamically changeable through RocksDB.setDBOptions(MutableDBOptions).

      Specified by:
      setDelayedWriteRate in interface MutableDBOptionsInterface<Options>
      Parameters:
      delayedWriteRate - the rate in bytes per second
      Returns:
      the reference to the current options.
    • delayedWriteRate

      public long delayedWriteRate()
      Description copied from interface: MutableDBOptionsInterface
      The limited write rate to DB if ColumnFamilyOptions.softPendingCompactionBytesLimit() or ColumnFamilyOptions.level0SlowdownWritesTrigger() is triggered, or we are writing to the last mem table allowed and we allow more than 3 mem tables. It is calculated using size of user write requests before compression. RocksDB may decide to slow down more if the compaction still gets behind further. If the value is 0, we will infer a value from `rater_limiter` value if it is not empty, or 16MB if `rater_limiter` is empty. Note that if users change the rate in `rate_limiter` after DB is opened, `delayed_write_rate` won't be adjusted.

      Unit: bytes per second.

      Default: 0

      Dynamically changeable through RocksDB.setDBOptions(MutableDBOptions).

      Specified by:
      delayedWriteRate in interface MutableDBOptionsInterface<Options>
      Returns:
      the rate in bytes per second
    • setEnablePipelinedWrite

      public Options setEnablePipelinedWrite(boolean enablePipelinedWrite)
      Description copied from interface: DBOptionsInterface
      By default, a single write thread queue is maintained. The thread gets to the head of the queue becomes write batch group leader and responsible for writing to WAL and memtable for the batch group. If DBOptionsInterface.enablePipelinedWrite() is true, separate write thread queue is maintained for WAL write and memtable write. A write thread first enter WAL writer queue and then memtable writer queue. Pending thread on the WAL writer queue thus only have to wait for previous writers to finish their WAL writing but not the memtable writing. Enabling the feature may improve write throughput and reduce latency of the prepare phase of two-phase commit. Default: false
      Specified by:
      setEnablePipelinedWrite in interface DBOptionsInterface<Options>
      Parameters:
      enablePipelinedWrite - true to enabled pipelined writes
      Returns:
      the reference to the current options.
    • enablePipelinedWrite

      public boolean enablePipelinedWrite()
      Description copied from interface: DBOptionsInterface
      Returns true if pipelined writes are enabled. See DBOptionsInterface.setEnablePipelinedWrite(boolean).
      Specified by:
      enablePipelinedWrite in interface DBOptionsInterface<Options>
      Returns:
      true if pipelined writes are enabled, false otherwise.
    • setUnorderedWrite

      public Options setUnorderedWrite(boolean unorderedWrite)
      Description copied from interface: DBOptionsInterface
      Setting DBOptionsInterface.unorderedWrite() to true trades higher write throughput with relaxing the immutability guarantee of snapshots. This violates the repeatability one expects from ::Get from a snapshot, as well as ::MultiGet and Iterator's consistent-point-in-time view property. If the application cannot tolerate the relaxed guarantees, it can implement its own mechanisms to work around that and yet benefit from the higher throughput. Using TransactionDB with WRITE_PREPARED write policy and DBOptionsInterface.twoWriteQueues() true is one way to achieve immutable snapshots despite unordered_write. By default, i.e., when it is false, rocksdb does not advance the sequence number for new snapshots unless all the writes with lower sequence numbers are already finished. This provides the immutability that we except from snapshots. Moreover, since Iterator and MultiGet internally depend on snapshots, the snapshot immutability results into Iterator and MultiGet offering consistent-point-in-time view. If set to true, although Read-Your-Own-Write property is still provided, the snapshot immutability property is relaxed: the writes issued after the snapshot is obtained (with larger sequence numbers) will be still not visible to the reads from that snapshot, however, there still might be pending writes (with lower sequence number) that will change the state visible to the snapshot after they are landed to the memtable.
      Specified by:
      setUnorderedWrite in interface DBOptionsInterface<Options>
      Parameters:
      unorderedWrite - true to enabled unordered write
      Returns:
      the reference to the current options.
    • unorderedWrite

      public boolean unorderedWrite()
      Description copied from interface: DBOptionsInterface
      Returns true if unordered write are enabled. See DBOptionsInterface.setUnorderedWrite(boolean).
      Specified by:
      unorderedWrite in interface DBOptionsInterface<Options>
      Returns:
      true if unordered write are enabled, false otherwise.
    • setAllowConcurrentMemtableWrite

      public Options setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
      Description copied from interface: DBOptionsInterface
      If true, allow multi-writers to update mem tables in parallel. Only some memtable factorys support concurrent writes; currently it is implemented only for SkipListFactory. Concurrent memtable writes are not compatible with inplace_update_support or filter_deletes. It is strongly recommended to set DBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean) if you are going to use this feature. Default: true
      Specified by:
      setAllowConcurrentMemtableWrite in interface DBOptionsInterface<Options>
      Parameters:
      allowConcurrentMemtableWrite - true to enable concurrent writes for the memtable
      Returns:
      the reference to the current options.
    • allowConcurrentMemtableWrite

      public boolean allowConcurrentMemtableWrite()
      Description copied from interface: DBOptionsInterface
      If true, allow multi-writers to update mem tables in parallel. Only some memtable factorys support concurrent writes; currently it is implemented only for SkipListFactory. Concurrent memtable writes are not compatible with inplace_update_support or filter_deletes. It is strongly recommended to set DBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean) if you are going to use this feature. Default: true
      Specified by:
      allowConcurrentMemtableWrite in interface DBOptionsInterface<Options>
      Returns:
      true if concurrent writes are enabled for the memtable
    • setEnableWriteThreadAdaptiveYield

      public Options setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
      Description copied from interface: DBOptionsInterface
      If true, threads synchronizing with the write batch group leader will wait for up to DBOptionsInterface.writeThreadMaxYieldUsec() before blocking on a mutex. This can substantially improve throughput for concurrent workloads, regardless of whether DBOptionsInterface.allowConcurrentMemtableWrite() is enabled. Default: true
      Specified by:
      setEnableWriteThreadAdaptiveYield in interface DBOptionsInterface<Options>
      Parameters:
      enableWriteThreadAdaptiveYield - true to enable adaptive yield for the write threads
      Returns:
      the reference to the current options.
    • enableWriteThreadAdaptiveYield

      public boolean enableWriteThreadAdaptiveYield()
      Description copied from interface: DBOptionsInterface
      If true, threads synchronizing with the write batch group leader will wait for up to DBOptionsInterface.writeThreadMaxYieldUsec() before blocking on a mutex. This can substantially improve throughput for concurrent workloads, regardless of whether DBOptionsInterface.allowConcurrentMemtableWrite() is enabled. Default: true
      Specified by:
      enableWriteThreadAdaptiveYield in interface DBOptionsInterface<Options>
      Returns:
      true if adaptive yield is enabled for the writing threads
    • setWriteThreadMaxYieldUsec

      public Options setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
      Description copied from interface: DBOptionsInterface
      The maximum number of microseconds that a write operation will use a yielding spin loop to coordinate with other write threads before blocking on a mutex. (Assuming DBOptionsInterface.writeThreadSlowYieldUsec() is set properly) increasing this value is likely to increase RocksDB throughput at the expense of increased CPU usage. Default: 100
      Specified by:
      setWriteThreadMaxYieldUsec in interface DBOptionsInterface<Options>
      Parameters:
      writeThreadMaxYieldUsec - maximum number of microseconds
      Returns:
      the reference to the current options.
    • writeThreadMaxYieldUsec

      public long writeThreadMaxYieldUsec()
      Description copied from interface: DBOptionsInterface
      The maximum number of microseconds that a write operation will use a yielding spin loop to coordinate with other write threads before blocking on a mutex. (Assuming DBOptionsInterface.writeThreadSlowYieldUsec() is set properly) increasing this value is likely to increase RocksDB throughput at the expense of increased CPU usage. Default: 100
      Specified by:
      writeThreadMaxYieldUsec in interface DBOptionsInterface<Options>
      Returns:
      the maximum number of microseconds
    • setWriteThreadSlowYieldUsec

      public Options setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
      Description copied from interface: DBOptionsInterface
      The latency in microseconds after which a std::this_thread::yield call (sched_yield on Linux) is considered to be a signal that other processes or threads would like to use the current core. Increasing this makes writer threads more likely to take CPU by spinning, which will show up as an increase in the number of involuntary context switches. Default: 3
      Specified by:
      setWriteThreadSlowYieldUsec in interface DBOptionsInterface<Options>
      Parameters:
      writeThreadSlowYieldUsec - the latency in microseconds
      Returns:
      the reference to the current options.
    • writeThreadSlowYieldUsec

      public long writeThreadSlowYieldUsec()
      Description copied from interface: DBOptionsInterface
      The latency in microseconds after which a std::this_thread::yield call (sched_yield on Linux) is considered to be a signal that other processes or threads would like to use the current core. Increasing this makes writer threads more likely to take CPU by spinning, which will show up as an increase in the number of involuntary context switches. Default: 3
      Specified by:
      writeThreadSlowYieldUsec in interface DBOptionsInterface<Options>
      Returns:
      writeThreadSlowYieldUsec the latency in microseconds
    • setSkipStatsUpdateOnDbOpen

      public Options setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
      Description copied from interface: DBOptionsInterface
      If true, then DB::Open() will not update the statistics used to optimize compaction decision by loading table properties from many files. Turning off this feature will improve DBOpen time especially in disk environment. Default: false
      Specified by:
      setSkipStatsUpdateOnDbOpen in interface DBOptionsInterface<Options>
      Parameters:
      skipStatsUpdateOnDbOpen - true if updating stats will be skipped
      Returns:
      the reference to the current options.
    • skipStatsUpdateOnDbOpen

      public boolean skipStatsUpdateOnDbOpen()
      Description copied from interface: DBOptionsInterface
      If true, then DB::Open() will not update the statistics used to optimize compaction decision by loading table properties from many files. Turning off this feature will improve DBOpen time especially in disk environment. Default: false
      Specified by:
      skipStatsUpdateOnDbOpen in interface DBOptionsInterface<Options>
      Returns:
      true if updating stats will be skipped
    • setSkipCheckingSstFileSizesOnDbOpen

      public Options setSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)
      Description copied from interface: DBOptionsInterface
      If true, then RocksDB.open(String) will not fetch and check sizes of all sst files. This may significantly speed up startup if there are many sst files, especially when using non-default Env with expensive GetFileSize(). We'll still check that all required sst files exist. If paranoid_checks is false, this option is ignored, and sst files are not checked at all. Default: false
      Specified by:
      setSkipCheckingSstFileSizesOnDbOpen in interface DBOptionsInterface<Options>
      Parameters:
      skipCheckingSstFileSizesOnDbOpen - if true, then SST file sizes will not be checked when calling RocksDB.open(String).
      Returns:
      the reference to the current options.
    • skipCheckingSstFileSizesOnDbOpen

      public boolean skipCheckingSstFileSizesOnDbOpen()
      Description copied from interface: DBOptionsInterface
      If true, then RocksDB.open(String) will not fetch and check sizes of all sst files. This may significantly speed up startup if there are many sst files, especially when using non-default Env with expensive GetFileSize(). We'll still check that all required sst files exist. If paranoid_checks is false, this option is ignored, and sst files are not checked at all. Default: false
      Specified by:
      skipCheckingSstFileSizesOnDbOpen in interface DBOptionsInterface<Options>
      Returns:
      true, if file sizes will not be checked when calling RocksDB.open(String).
    • setWalRecoveryMode

      public Options setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
      Description copied from interface: DBOptionsInterface
      Recovery mode to control the consistency while replaying WAL Default: WALRecoveryMode.PointInTimeRecovery
      Specified by:
      setWalRecoveryMode in interface DBOptionsInterface<Options>
      Parameters:
      walRecoveryMode - The WAL recover mode
      Returns:
      the reference to the current options.
    • walRecoveryMode

      public WALRecoveryMode walRecoveryMode()
      Description copied from interface: DBOptionsInterface
      Recovery mode to control the consistency while replaying WAL Default: WALRecoveryMode.PointInTimeRecovery
      Specified by:
      walRecoveryMode in interface DBOptionsInterface<Options>
      Returns:
      The WAL recover mode
    • setAllow2pc

      public Options setAllow2pc(boolean allow2pc)
      Description copied from interface: DBOptionsInterface
      if set to false then recovery will fail when a prepared transaction is encountered in the WAL Default: false
      Specified by:
      setAllow2pc in interface DBOptionsInterface<Options>
      Parameters:
      allow2pc - true if two-phase-commit is enabled
      Returns:
      the reference to the current options.
    • allow2pc

      public boolean allow2pc()
      Description copied from interface: DBOptionsInterface
      if set to false then recovery will fail when a prepared transaction is encountered in the WAL Default: false
      Specified by:
      allow2pc in interface DBOptionsInterface<Options>
      Returns:
      true if two-phase-commit is enabled
    • setRowCache

      public Options setRowCache(Cache rowCache)
      Description copied from interface: DBOptionsInterface
      A global cache for table-level rows. Default: null (disabled)
      Specified by:
      setRowCache in interface DBOptionsInterface<Options>
      Parameters:
      rowCache - The global row cache
      Returns:
      the reference to the current options.
    • rowCache

      public Cache rowCache()
      Description copied from interface: DBOptionsInterface
      A global cache for table-level rows. Default: null (disabled)
      Specified by:
      rowCache in interface DBOptionsInterface<Options>
      Returns:
      The global row cache
    • setWalFilter

      public Options setWalFilter(AbstractWalFilter walFilter)
      Description copied from interface: DBOptionsInterface
      A filter object supplied to be invoked while processing write-ahead-logs (WALs) during recovery. The filter provides a way to inspect log records, ignoring a particular record or skipping replay. The filter is invoked at startup and is invoked from a single-thread currently.
      Specified by:
      setWalFilter in interface DBOptionsInterface<Options>
      Parameters:
      walFilter - the filter for processing WALs during recovery.
      Returns:
      the reference to the current options.
    • walFilter

      public WalFilter walFilter()
      Description copied from interface: DBOptionsInterface
      Get's the filter for processing WALs during recovery. See DBOptionsInterface.setWalFilter(AbstractWalFilter).
      Specified by:
      walFilter in interface DBOptionsInterface<Options>
      Returns:
      the filter used for processing WALs during recovery.
    • setFailIfOptionsFileError

      public Options setFailIfOptionsFileError(boolean failIfOptionsFileError)
      Description copied from interface: DBOptionsInterface
      If true, then DB::Open / CreateColumnFamily / DropColumnFamily / SetOptions will fail if options file is not detected or properly persisted. DEFAULT: false
      Specified by:
      setFailIfOptionsFileError in interface DBOptionsInterface<Options>
      Parameters:
      failIfOptionsFileError - true if we should fail if there is an error in the options file
      Returns:
      the reference to the current options.
    • failIfOptionsFileError

      public boolean failIfOptionsFileError()
      Description copied from interface: DBOptionsInterface
      If true, then DB::Open / CreateColumnFamily / DropColumnFamily / SetOptions will fail if options file is not detected or properly persisted. DEFAULT: false
      Specified by:
      failIfOptionsFileError in interface DBOptionsInterface<Options>
      Returns:
      true if we should fail if there is an error in the options file
    • setDumpMallocStats

      public Options setDumpMallocStats(boolean dumpMallocStats)
      Description copied from interface: DBOptionsInterface
      If true, then print malloc stats together with rocksdb.stats when printing to LOG. DEFAULT: false
      Specified by:
      setDumpMallocStats in interface DBOptionsInterface<Options>
      Parameters:
      dumpMallocStats - true if malloc stats should be printed to LOG
      Returns:
      the reference to the current options.
    • dumpMallocStats

      public boolean dumpMallocStats()
      Description copied from interface: DBOptionsInterface
      If true, then print malloc stats together with rocksdb.stats when printing to LOG. DEFAULT: false
      Specified by:
      dumpMallocStats in interface DBOptionsInterface<Options>
      Returns:
      true if malloc stats should be printed to LOG
    • setAvoidFlushDuringRecovery

      public Options setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
      Description copied from interface: DBOptionsInterface
      By default RocksDB replay WAL logs and flush them on DB open, which may create very small SST files. If this option is enabled, RocksDB will try to avoid (but not guarantee not to) flush during recovery. Also, existing WAL logs will be kept, so that if crash happened before flush, we still have logs to recover from. DEFAULT: false
      Specified by:
      setAvoidFlushDuringRecovery in interface DBOptionsInterface<Options>
      Parameters:
      avoidFlushDuringRecovery - true to try to avoid (but not guarantee not to) flush during recovery
      Returns:
      the reference to the current options.
    • avoidFlushDuringRecovery

      public boolean avoidFlushDuringRecovery()
      Description copied from interface: DBOptionsInterface
      By default RocksDB replay WAL logs and flush them on DB open, which may create very small SST files. If this option is enabled, RocksDB will try to avoid (but not guarantee not to) flush during recovery. Also, existing WAL logs will be kept, so that if crash happened before flush, we still have logs to recover from. DEFAULT: false
      Specified by:
      avoidFlushDuringRecovery in interface DBOptionsInterface<Options>
      Returns:
      true to try to avoid (but not guarantee not to) flush during recovery
    • setAvoidFlushDuringShutdown

      public Options setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
      Description copied from interface: MutableDBOptionsInterface
      By default RocksDB will flush all memtables on DB close if there are unpersisted data (i.e. with WAL disabled) The flush can be skip to speedup DB close. Unpersisted data WILL BE LOST.

      DEFAULT: false

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions) API.

      Specified by:
      setAvoidFlushDuringShutdown in interface MutableDBOptionsInterface<Options>
      Parameters:
      avoidFlushDuringShutdown - true if we should avoid flush during shutdown
      Returns:
      the reference to the current options.
    • avoidFlushDuringShutdown

      public boolean avoidFlushDuringShutdown()
      Description copied from interface: MutableDBOptionsInterface
      By default RocksDB will flush all memtables on DB close if there are unpersisted data (i.e. with WAL disabled) The flush can be skip to speedup DB close. Unpersisted data WILL BE LOST.

      DEFAULT: false

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions) API.

      Specified by:
      avoidFlushDuringShutdown in interface MutableDBOptionsInterface<Options>
      Returns:
      true if we should avoid flush during shutdown
    • setAllowIngestBehind

      public Options setAllowIngestBehind(boolean allowIngestBehind)
      Description copied from interface: DBOptionsInterface
      Set this option to true during creation of database if you want to be able to ingest behind (call IngestExternalFile() skipping keys that already exist, rather than overwriting matching keys). Setting this option to true will affect 2 things: 1) Disable some internal optimizations around SST file compression 2) Reserve bottom-most level for ingested files only. 3) Note that num_levels should be >= 3 if this option is turned on. DEFAULT: false
      Specified by:
      setAllowIngestBehind in interface DBOptionsInterface<Options>
      Parameters:
      allowIngestBehind - true to allow ingest behind, false to disallow.
      Returns:
      the reference to the current options.
    • allowIngestBehind

      public boolean allowIngestBehind()
      Description copied from interface: DBOptionsInterface
      Returns true if ingest behind is allowed. See DBOptionsInterface.setAllowIngestBehind(boolean).
      Specified by:
      allowIngestBehind in interface DBOptionsInterface<Options>
      Returns:
      true if ingest behind is allowed, false otherwise.
    • setTwoWriteQueues

      public Options setTwoWriteQueues(boolean twoWriteQueues)
      Description copied from interface: DBOptionsInterface
      If enabled it uses two queues for writes, one for the ones with disable_memtable and one for the ones that also write to memtable. This allows the memtable writes not to lag behind other writes. It can be used to optimize MySQL 2PC in which only the commits, which are serial, write to memtable. DEFAULT: false
      Specified by:
      setTwoWriteQueues in interface DBOptionsInterface<Options>
      Parameters:
      twoWriteQueues - true to enable two write queues, false otherwise.
      Returns:
      the reference to the current options.
    • twoWriteQueues

      public boolean twoWriteQueues()
      Description copied from interface: DBOptionsInterface
      Returns true if two write queues are enabled.
      Specified by:
      twoWriteQueues in interface DBOptionsInterface<Options>
      Returns:
      true if two write queues are enabled, false otherwise.
    • setManualWalFlush

      public Options setManualWalFlush(boolean manualWalFlush)
      Description copied from interface: DBOptionsInterface
      If true WAL is not flushed automatically after each write. Instead it relies on manual invocation of FlushWAL to write the WAL buffer to its file. DEFAULT: false
      Specified by:
      setManualWalFlush in interface DBOptionsInterface<Options>
      Parameters:
      manualWalFlush - true to set disable automatic WAL flushing, false otherwise.
      Returns:
      the reference to the current options.
    • manualWalFlush

      public boolean manualWalFlush()
      Description copied from interface: DBOptionsInterface
      Returns true if automatic WAL flushing is disabled. See DBOptionsInterface.setManualWalFlush(boolean).
      Specified by:
      manualWalFlush in interface DBOptionsInterface<Options>
      Returns:
      true if automatic WAL flushing is disabled, false otherwise.
    • memTableConfig

      public MemTableConfig memTableConfig()
      Description copied from interface: ColumnFamilyOptionsInterface
      Get the config for mem-table.
      Specified by:
      memTableConfig in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the mem-table config.
    • setMemTableConfig

      public Options setMemTableConfig(MemTableConfig config)
      Description copied from interface: ColumnFamilyOptionsInterface
      Set the config for mem-table.
      Specified by:
      setMemTableConfig in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      config - the mem-table config.
      Returns:
      the instance of the current object.
    • setRateLimiter

      public Options setRateLimiter(RateLimiter rateLimiter)
      Description copied from interface: DBOptionsInterface
      Use to control write rate of flush and compaction. Flush has higher priority than compaction. Rate limiting is disabled if nullptr. Default: nullptr
      Specified by:
      setRateLimiter in interface DBOptionsInterface<Options>
      Parameters:
      rateLimiter - RateLimiter instance.
      Returns:
      the instance of the current object.
    • setSstFileManager

      public Options setSstFileManager(SstFileManager sstFileManager)
      Description copied from interface: DBOptionsInterface
      Use to track SST files and control their file deletion rate. Features: - Throttle the deletion rate of the SST files. - Keep track the total size of all SST files. - Set a maximum allowed space limit for SST files that when reached the DB wont do any further flushes or compactions and will set the background error. - Can be shared between multiple dbs. Limitations: - Only track and throttle deletes of SST files in first db_path (db_name if db_paths is empty).
      Specified by:
      setSstFileManager in interface DBOptionsInterface<Options>
      Parameters:
      sstFileManager - The SST File Manager for the db.
      Returns:
      the instance of the current object.
    • setLogger

      public Options setLogger(LoggerInterface logger)
      Description copied from interface: DBOptionsInterface

      Any internal progress/error information generated by the db will be written to the Logger if it is non-nullptr, or to a file stored in the same directory as the DB contents if info_log is nullptr.

      Default: nullptr

      Specified by:
      setLogger in interface DBOptionsInterface<Options>
      Parameters:
      logger - LoggerInterface instance.
      Returns:
      the instance of the current object.
    • setInfoLogLevel

      public Options setInfoLogLevel(InfoLogLevel infoLogLevel)
      Description copied from interface: DBOptionsInterface

      Sets the RocksDB log level. Default level is INFO

      Specified by:
      setInfoLogLevel in interface DBOptionsInterface<Options>
      Parameters:
      infoLogLevel - log level to set.
      Returns:
      the instance of the current object.
    • infoLogLevel

      public InfoLogLevel infoLogLevel()
      Description copied from interface: DBOptionsInterface

      Returns currently set log level.

      Specified by:
      infoLogLevel in interface DBOptionsInterface<Options>
      Returns:
      InfoLogLevel instance.
    • memTableFactoryName

      public String memTableFactoryName()
      Description copied from interface: ColumnFamilyOptionsInterface
      Returns the name of the current mem table representation. Memtable format can be set using setTableFormatConfig.
      Specified by:
      memTableFactoryName in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the name of the currently-used memtable factory.
      See Also:
    • tableFormatConfig

      public TableFormatConfig tableFormatConfig()
      Description copied from interface: ColumnFamilyOptionsInterface
      Get the config for table format.
      Specified by:
      tableFormatConfig in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the table format config.
    • setTableFormatConfig

      public Options setTableFormatConfig(TableFormatConfig config)
      Description copied from interface: ColumnFamilyOptionsInterface
      Set the config for table format.
      Specified by:
      setTableFormatConfig in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      config - the table format config.
      Returns:
      the reference of the current options.
    • tableFactoryName

      public String tableFactoryName()
      Specified by:
      tableFactoryName in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the name of the currently used table factory.
    • setCfPaths

      public Options setCfPaths(Collection<DbPath> cfPaths)
      Description copied from interface: ColumnFamilyOptionsInterface
      A list of paths where SST files for this column family can be put into, with its target size. Similar to db_paths, newer data is placed into paths specified earlier in the vector while older data gradually moves to paths specified later in the vector. Note that, if a path is supplied to multiple column families, it would have files and total size from all the column families combined. User should provision for the total size(from all the column families) in such cases.

      If left empty, db_paths will be used. Default: empty

      Specified by:
      setCfPaths in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      cfPaths - collection of paths for SST files.
      Returns:
      the reference of the current options.
    • cfPaths

      public List<DbPath> cfPaths()
      Specified by:
      cfPaths in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      collection of paths for SST files.
    • useFixedLengthPrefixExtractor

      public Options useFixedLengthPrefixExtractor(int n)
      Description copied from interface: ColumnFamilyOptionsInterface
      This prefix-extractor uses the first n bytes of a key as its prefix.

      In some hash-based memtable representation such as HashLinkedList and HashSkipList, prefixes are used to partition the keys into several buckets. Prefix extractor is used to specify how to extract the prefix given a key.

      Specified by:
      useFixedLengthPrefixExtractor in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      n - use the first n bytes of a key as its prefix.
      Returns:
      the reference to the current option.
    • useCappedPrefixExtractor

      public Options useCappedPrefixExtractor(int n)
      Description copied from interface: ColumnFamilyOptionsInterface
      Same as fixed length prefix extractor, except that when slice is shorter than the fixed length, it will use the full key.
      Specified by:
      useCappedPrefixExtractor in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      n - use the first n bytes of a key as its prefix.
      Returns:
      the reference to the current option.
    • compressionType

      public CompressionType compressionType()
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Compress blocks using the specified compression algorithm. This parameter can be changed dynamically.

      Default: SNAPPY_COMPRESSION, which gives lightweight but fast compression.

      Specified by:
      compressionType in interface MutableColumnFamilyOptionsInterface<Options>
      Returns:
      Compression type.
    • setCompressionPerLevel

      public Options setCompressionPerLevel(List<CompressionType> compressionLevels)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface

      Different levels can have different compression policies. There are cases where most lower levels would like to use quick compression algorithms while the higher levels (which have more data) use compression algorithms that have better compression but could be slower. This array, if non-empty, should have an entry for each level of the database; these override the value specified in the previous field 'compression'.

      NOTICE

      If level_compaction_dynamic_level_bytes=true, compression_per_level[0] still determines L0, but other elements of the array are based on base level (the level L0 files are merged to), and may not match the level users see from info log for metadata.

      If L0 files are merged to level - n, then, for i&gt;0, compression_per_level[i] determines compaction type for level n+i-1.

      Example

      For example, if we have 5 levels, and we determine to merge L0 data to L4 (which means L1..L3 will be empty), then the new files go to L4 uses compression type compression_per_level[1].

      If now L0 is merged to L2. Data goes to L2 will be compressed according to compression_per_level[1], L3 using compression_per_level[2]and L4 using compression_per_level[3]. Compaction for each level can change when data grows.

      Default: empty

      Specified by:
      setCompressionPerLevel in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      compressionLevels - list of CompressionType instances.
      Returns:
      the reference to the current options.
    • compressionPerLevel

      public List<CompressionType> compressionPerLevel()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Specified by:
      compressionPerLevel in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      list of CompressionType instances.
    • setCompressionType

      public Options setCompressionType(CompressionType compressionType)
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Compress blocks using the specified compression algorithm. This parameter can be changed dynamically.

      Default: SNAPPY_COMPRESSION, which gives lightweight but fast compression.

      Specified by:
      setCompressionType in interface MutableColumnFamilyOptionsInterface<Options>
      Parameters:
      compressionType - Compression Type.
      Returns:
      the reference to the current option.
    • setBottommostCompressionType

      public Options setBottommostCompressionType(CompressionType bottommostCompressionType)
      Description copied from interface: ColumnFamilyOptionsInterface
      Compression algorithm that will be used for the bottommost level that contain files. If level-compaction is used, this option will only affect levels after base level.

      Default: CompressionType.DISABLE_COMPRESSION_OPTION

      Specified by:
      setBottommostCompressionType in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      bottommostCompressionType - The compression type to use for the bottommost level
      Returns:
      the reference of the current options.
    • bottommostCompressionType

      public CompressionType bottommostCompressionType()
      Description copied from interface: ColumnFamilyOptionsInterface
      Compression algorithm that will be used for the bottommost level that contain files. If level-compaction is used, this option will only affect levels after base level.

      Default: CompressionType.DISABLE_COMPRESSION_OPTION

      Specified by:
      bottommostCompressionType in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      The compression type used for the bottommost level
    • setBottommostCompressionOptions

      public Options setBottommostCompressionOptions(CompressionOptions bottommostCompressionOptions)
      Description copied from interface: ColumnFamilyOptionsInterface
      Set the options for compression algorithms used by ColumnFamilyOptionsInterface.bottommostCompressionType() if it is enabled.

      To enable it, please see the definition of CompressionOptions.

      Specified by:
      setBottommostCompressionOptions in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      bottommostCompressionOptions - the bottom most compression options.
      Returns:
      the reference of the current options.
    • bottommostCompressionOptions

      public CompressionOptions bottommostCompressionOptions()
      Description copied from interface: ColumnFamilyOptionsInterface
      Specified by:
      bottommostCompressionOptions in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the bottom most compression options.
    • setCompressionOptions

      public Options setCompressionOptions(CompressionOptions compressionOptions)
      Description copied from interface: ColumnFamilyOptionsInterface
      Set the different options for compression algorithms
      Specified by:
      setCompressionOptions in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      compressionOptions - The compression options
      Returns:
      the reference of the current options.
    • compressionOptions

      public CompressionOptions compressionOptions()
      Description copied from interface: ColumnFamilyOptionsInterface
      Get the different options for compression algorithms
      Specified by:
      compressionOptions in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      The compression options
    • compactionStyle

      public CompactionStyle compactionStyle()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Compaction style for DB.
      Specified by:
      compactionStyle in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      Compaction style.
    • setCompactionStyle

      public Options setCompactionStyle(CompactionStyle compactionStyle)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Set compaction style for DB.

      Default: LEVEL.

      Specified by:
      setCompactionStyle in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionStyle - Compaction style.
      Returns:
      the reference to the current options.
    • numLevels

      public int numLevels()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      If level-styled compaction is used, then this number determines the total number of levels.
      Specified by:
      numLevels in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      the number of levels.
    • setNumLevels

      public Options setNumLevels(int numLevels)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Set the number of levels for this database If level-styled compaction is used, then this number determines the total number of levels.
      Specified by:
      setNumLevels in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      numLevels - the number of levels.
      Returns:
      the reference to the current options.
    • levelZeroFileNumCompactionTrigger

      public int levelZeroFileNumCompactionTrigger()
      Description copied from interface: ColumnFamilyOptionsInterface
      The number of files in level 0 to trigger compaction from level-0 to level-1. A value < 0 means that level-0 compaction will not be triggered by number of files at all. Default: 4
      Specified by:
      levelZeroFileNumCompactionTrigger in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the number of files in level 0 to trigger compaction.
    • setLevelZeroFileNumCompactionTrigger

      public Options setLevelZeroFileNumCompactionTrigger(int numFiles)
      Description copied from interface: ColumnFamilyOptionsInterface
      Number of files to trigger level-0 compaction. A value < 0 means that level-0 compaction will not be triggered by number of files at all. Default: 4
      Specified by:
      setLevelZeroFileNumCompactionTrigger in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      numFiles - the number of files in level-0 to trigger compaction.
      Returns:
      the reference to the current option.
    • levelZeroSlowdownWritesTrigger

      public int levelZeroSlowdownWritesTrigger()
      Description copied from interface: ColumnFamilyOptionsInterface
      Soft limit on the number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.
      Specified by:
      levelZeroSlowdownWritesTrigger in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the soft limit on the number of level-0 files.
    • setLevelZeroSlowdownWritesTrigger

      public Options setLevelZeroSlowdownWritesTrigger(int numFiles)
      Description copied from interface: ColumnFamilyOptionsInterface
      Soft limit on number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.
      Specified by:
      setLevelZeroSlowdownWritesTrigger in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      numFiles - soft limit on number of level-0 files.
      Returns:
      the reference to the current option.
    • levelZeroStopWritesTrigger

      public int levelZeroStopWritesTrigger()
      Description copied from interface: ColumnFamilyOptionsInterface
      Maximum number of level-0 files. We stop writes at this point.
      Specified by:
      levelZeroStopWritesTrigger in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the hard limit of the number of level-0 file.
    • setLevelZeroStopWritesTrigger

      public Options setLevelZeroStopWritesTrigger(int numFiles)
      Description copied from interface: ColumnFamilyOptionsInterface
      Maximum number of level-0 files. We stop writes at this point.
      Specified by:
      setLevelZeroStopWritesTrigger in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      numFiles - the hard limit of the number of level-0 files.
      Returns:
      the reference to the current option.
    • targetFileSizeBase

      public long targetFileSizeBase()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      The target file size for compaction. This targetFileSizeBase determines a level-1 file size. Target file size for level L can be calculated by targetFileSizeBase * (targetFileSizeMultiplier ^ (L-1)) For example, if targetFileSizeBase is 2MB and target_file_size_multiplier is 10, then each file on level-1 will be 2MB, and each file on level 2 will be 20MB, and each file on level-3 will be 200MB. by default targetFileSizeBase is 64MB.
      Specified by:
      targetFileSizeBase in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the target size of a level-0 file.
      See Also:
    • setTargetFileSizeBase

      public Options setTargetFileSizeBase(long targetFileSizeBase)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      The target file size for compaction. This targetFileSizeBase determines a level-1 file size. Target file size for level L can be calculated by targetFileSizeBase * (targetFileSizeMultiplier ^ (L-1)) For example, if targetFileSizeBase is 2MB and target_file_size_multiplier is 10, then each file on level-1 will be 2MB, and each file on level 2 will be 20MB, and each file on level-3 will be 200MB. by default targetFileSizeBase is 64MB.
      Specified by:
      setTargetFileSizeBase in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      targetFileSizeBase - the target size of a level-0 file.
      Returns:
      the reference to the current options.
      See Also:
    • targetFileSizeMultiplier

      public int targetFileSizeMultiplier()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      targetFileSizeMultiplier defines the size ratio between a level-(L+1) file and level-L file. By default targetFileSizeMultiplier is 1, meaning files in different levels have the same target.
      Specified by:
      targetFileSizeMultiplier in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the size ratio between a level-(L+1) file and level-L file.
    • setTargetFileSizeMultiplier

      public Options setTargetFileSizeMultiplier(int multiplier)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      targetFileSizeMultiplier defines the size ratio between a level-L file and level-(L+1) file. By default target_file_size_multiplier is 1, meaning files in different levels have the same target.
      Specified by:
      setTargetFileSizeMultiplier in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      multiplier - the size ratio between a level-(L+1) file and level-L file.
      Returns:
      the reference to the current options.
    • setMaxBytesForLevelBase

      public Options setMaxBytesForLevelBase(long maxBytesForLevelBase)
      Description copied from interface: MutableColumnFamilyOptionsInterface
      The upper-bound of the total size of level-1 files in bytes. Maximum number of bytes for level L can be calculated as (maxBytesForLevelBase) * (maxBytesForLevelMultiplier ^ (L-1)) For example, if maxBytesForLevelBase is 20MB, and if max_bytes_for_level_multiplier is 10, total data size for level-1 will be 200MB, total file size for level-2 will be 2GB, and total file size for level-3 will be 20GB. by default 'maxBytesForLevelBase' is 256MB.
      Specified by:
      setMaxBytesForLevelBase in interface MutableColumnFamilyOptionsInterface<Options>
      Parameters:
      maxBytesForLevelBase - maximum bytes for level base.
      Returns:
      the reference to the current option.

      See AdvancedMutableColumnFamilyOptionsInterface.setMaxBytesForLevelMultiplier(double)

    • maxBytesForLevelBase

      public long maxBytesForLevelBase()
      Description copied from interface: MutableColumnFamilyOptionsInterface
      The upper-bound of the total size of level-1 files in bytes. Maximum number of bytes for level L can be calculated as (maxBytesForLevelBase) * (maxBytesForLevelMultiplier ^ (L-1)) For example, if maxBytesForLevelBase is 20MB, and if max_bytes_for_level_multiplier is 10, total data size for level-1 will be 200MB, total file size for level-2 will be 2GB, and total file size for level-3 will be 20GB. by default 'maxBytesForLevelBase' is 256MB.
      Specified by:
      maxBytesForLevelBase in interface MutableColumnFamilyOptionsInterface<Options>
      Returns:
      the upper-bound of the total size of level-1 files in bytes.

      See AdvancedMutableColumnFamilyOptionsInterface.maxBytesForLevelMultiplier()

    • setLevelCompactionDynamicLevelBytes

      public Options setLevelCompactionDynamicLevelBytes(boolean enableLevelCompactionDynamicLevelBytes)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface

      If true, RocksDB will pick target size of each level dynamically. We will pick a base level b >= 1. L0 will be directly merged into level b, instead of always into level 1. Level 1 to b-1 need to be empty. We try to pick b and its target size so that

      1. target size is in the range of (max_bytes_for_level_base / max_bytes_for_level_multiplier, max_bytes_for_level_base]
      2. target size of the last level (level num_levels-1) equals to extra size of the level.

      At the same time max_bytes_for_level_multiplier and max_bytes_for_level_multiplier_additional are still satisfied.

      With this option on, from an empty DB, we make last level the base level, which means merging L0 data into the last level, until it exceeds max_bytes_for_level_base. And then we make the second last level to be base level, to start to merge L0 data to second last level, with its target size to be 1/max_bytes_for_level_multiplier of the last levels extra size. After the data accumulates more so that we need to move the base level to the third last one, and so on.

      Example

      For example, assume max_bytes_for_level_multiplier=10, num_levels=6, and max_bytes_for_level_base=10MB.

      Target sizes of level 1 to 5 starts with:

      [- - - - 10MB]

      with base level is level. Target sizes of level 1 to 4 are not applicable because they will not be used. Until the size of Level 5 grows to more than 10MB, say 11MB, we make base target to level 4 and now the targets looks like:

      [- - - 1.1MB 11MB]

      While data are accumulated, size targets are tuned based on actual data of level 5. When level 5 has 50MB of data, the target is like:

      [- - - 5MB 50MB]

      Until level 5's actual size is more than 100MB, say 101MB. Now if we keep level 4 to be the base level, its target size needs to be 10.1MB, which doesn't satisfy the target size range. So now we make level 3 the target size and the target sizes of the levels look like:

      [- - 1.01MB 10.1MB 101MB]

      In the same way, while level 5 further grows, all levels' targets grow, like

      [- - 5MB 50MB 500MB]

      Until level 5 exceeds 1000MB and becomes 1001MB, we make level 2 the base level and make levels' target sizes like this:

      [- 1.001MB 10.01MB 100.1MB 1001MB]

      and go on...

      By doing it, we give max_bytes_for_level_multiplier a priority against max_bytes_for_level_base, for a more predictable LSM tree shape. It is useful to limit worse case space amplification.

      max_bytes_for_level_multiplier_additional is ignored with this flag on.

      Turning this feature on or off for an existing DB can cause unexpected LSM tree structure so it's not recommended.

      Caution: this option is experimental

      Default: false

      Specified by:
      setLevelCompactionDynamicLevelBytes in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      enableLevelCompactionDynamicLevelBytes - boolean value indicating if LevelCompactionDynamicLevelBytes shall be enabled.
      Returns:
      the reference to the current options.
    • levelCompactionDynamicLevelBytes

      public boolean levelCompactionDynamicLevelBytes()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface

      Return if LevelCompactionDynamicLevelBytes is enabled.

      For further information see AdvancedColumnFamilyOptionsInterface.setLevelCompactionDynamicLevelBytes(boolean)

      Specified by:
      levelCompactionDynamicLevelBytes in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      boolean value indicating if levelCompactionDynamicLevelBytes is enabled.
    • maxBytesForLevelMultiplier

      public double maxBytesForLevelMultiplier()
      Description copied from interface: ColumnFamilyOptionsInterface
      The ratio between the total size of level-(L+1) files and the total size of level-L files for all L. DEFAULT: 10
      Specified by:
      maxBytesForLevelMultiplier in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Specified by:
      maxBytesForLevelMultiplier in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      the ratio between the total size of level-(L+1) files and the total size of level-L files for all L.
    • setMaxBytesForLevelMultiplier

      public Options setMaxBytesForLevelMultiplier(double multiplier)
      Description copied from interface: ColumnFamilyOptionsInterface
      The ratio between the total size of level-(L+1) files and the total size of level-L files for all L. DEFAULT: 10
      Specified by:
      setMaxBytesForLevelMultiplier in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Specified by:
      setMaxBytesForLevelMultiplier in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      multiplier - the ratio between the total size of level-(L+1) files and the total size of level-L files for all L.
      Returns:
      the reference to the current option.
    • maxCompactionBytes

      public long maxCompactionBytes()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Control maximum size of each compaction (not guaranteed)
      Specified by:
      maxCompactionBytes in interface AdvancedColumnFamilyOptionsInterface<Options>
      Specified by:
      maxCompactionBytes in interface MutableColumnFamilyOptionsInterface<Options>
      Returns:
      compaction size threshold
      See Also:
    • setMaxCompactionBytes

      public Options setMaxCompactionBytes(long maxCompactionBytes)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Maximum size of each compaction (not guarantee)
      Specified by:
      setMaxCompactionBytes in interface AdvancedColumnFamilyOptionsInterface<Options>
      Specified by:
      setMaxCompactionBytes in interface MutableColumnFamilyOptionsInterface<Options>
      Parameters:
      maxCompactionBytes - the compaction size limit
      Returns:
      the reference to the current options.
      See Also:
    • arenaBlockSize

      public long arenaBlockSize()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      The size of one block in arena memory allocation. If ≤ 0, a proper value is automatically calculated (usually 1/10 of writer_buffer_size).

      There are two additional restriction of the specified size: (1) size should be in the range of [4096, 2 << 30] and (2) be the multiple of the CPU word (which helps with the memory alignment).

      We'll automatically check and adjust the size number to make sure it conforms to the restrictions. Default: 0

      Specified by:
      arenaBlockSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the size of an arena block
    • setArenaBlockSize

      public Options setArenaBlockSize(long arenaBlockSize)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      The size of one block in arena memory allocation. If ≤ 0, a proper value is automatically calculated (usually 1/10 of writer_buffer_size).

      There are two additional restriction of the specified size: (1) size should be in the range of [4096, 2 << 30] and (2) be the multiple of the CPU word (which helps with the memory alignment).

      We'll automatically check and adjust the size number to make sure it conforms to the restrictions. Default: 0

      Specified by:
      setArenaBlockSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      arenaBlockSize - the size of an arena block
      Returns:
      the reference to the current options.
    • disableAutoCompactions

      public boolean disableAutoCompactions()
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Disable automatic compactions. Manual compactions can still be issued on this column family
      Specified by:
      disableAutoCompactions in interface MutableColumnFamilyOptionsInterface<Options>
      Returns:
      true if auto-compactions are disabled.
    • setDisableAutoCompactions

      public Options setDisableAutoCompactions(boolean disableAutoCompactions)
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Disable automatic compactions. Manual compactions can still be issued on this column family
      Specified by:
      setDisableAutoCompactions in interface MutableColumnFamilyOptionsInterface<Options>
      Parameters:
      disableAutoCompactions - true if auto-compactions are disabled.
      Returns:
      the reference to the current option.
    • maxSequentialSkipInIterations

      public long maxSequentialSkipInIterations()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      An iteration->Next() sequentially skips over keys with the same user-key unless this option is set. This number specifies the number of keys (with the same userkey) that will be sequentially skipped before a reseek is issued. Default: 8
      Specified by:
      maxSequentialSkipInIterations in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the number of keys could be skipped in an iteration.
    • setMaxSequentialSkipInIterations

      public Options setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      An iteration->Next() sequentially skips over keys with the same user-key unless this option is set. This number specifies the number of keys (with the same userkey) that will be sequentially skipped before a reseek is issued. Default: 8
      Specified by:
      setMaxSequentialSkipInIterations in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      maxSequentialSkipInIterations - the number of keys could be skipped in an iteration.
      Returns:
      the reference to the current options.
    • inplaceUpdateSupport

      public boolean inplaceUpdateSupport()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Allows thread-safe inplace updates. If inplace_callback function is not set, Put(key, new_value) will update inplace the existing_value iff * key exists in current memtable * new sizeof(new_value) ≤ sizeof(existing_value) * existing_value for that key is a put i.e. kTypeValue If inplace_callback function is set, check doc for inplace_callback. Default: false.
      Specified by:
      inplaceUpdateSupport in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      true if thread-safe inplace updates are allowed.
    • setInplaceUpdateSupport

      public Options setInplaceUpdateSupport(boolean inplaceUpdateSupport)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Allows thread-safe inplace updates. If inplace_callback function is not set, Put(key, new_value) will update inplace the existing_value iff * key exists in current memtable * new sizeof(new_value) ≤ sizeof(existing_value) * existing_value for that key is a put i.e. kTypeValue If inplace_callback function is set, check doc for inplace_callback. Default: false.
      Specified by:
      setInplaceUpdateSupport in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      inplaceUpdateSupport - true if thread-safe inplace updates are allowed.
      Returns:
      the reference to the current options.
    • inplaceUpdateNumLocks

      public long inplaceUpdateNumLocks()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Number of locks used for inplace update Default: 10000, if inplace_update_support = true, else 0.
      Specified by:
      inplaceUpdateNumLocks in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the number of locks used for inplace update.
    • setInplaceUpdateNumLocks

      public Options setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Number of locks used for inplace update Default: 10000, if inplace_update_support = true, else 0.
      Specified by:
      setInplaceUpdateNumLocks in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      inplaceUpdateNumLocks - the number of locks used for inplace updates.
      Returns:
      the reference to the current options.
    • memtablePrefixBloomSizeRatio

      public double memtablePrefixBloomSizeRatio()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      if prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0, create prefix bloom for memtable with the size of write_buffer_size * memtable_prefix_bloom_size_ratio. If it is larger than 0.25, it is sanitized to 0.25.

      Default: 0 (disabled)

      Specified by:
      memtablePrefixBloomSizeRatio in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the ratio of memtable used by the bloom filter
    • setMemtablePrefixBloomSizeRatio

      public Options setMemtablePrefixBloomSizeRatio(double memtablePrefixBloomSizeRatio)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      if prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0, create prefix bloom for memtable with the size of write_buffer_size * memtable_prefix_bloom_size_ratio. If it is larger than 0.25, it is sanitized to 0.25.

      Default: 0 (disabled)

      Specified by:
      setMemtablePrefixBloomSizeRatio in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      memtablePrefixBloomSizeRatio - the ratio of memtable used by the bloom filter, 0 means no bloom filter
      Returns:
      the reference to the current options.
    • experimentalMempurgeThreshold

      public double experimentalMempurgeThreshold()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Threshold used in the MemPurge (memtable garbage collection) feature. A value of 0.0 corresponds to no MemPurge, a value of 1.0 will trigger a MemPurge as often as possible.

      Default: 0 (disabled)

      Specified by:
      experimentalMempurgeThreshold in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the threshold used by the MemPurge decider
    • setExperimentalMempurgeThreshold

      public Options setExperimentalMempurgeThreshold(double experimentalMempurgeThreshold)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Threshold used in the MemPurge (memtable garbage collection) feature. A value of 0.0 corresponds to no MemPurge, a value of 1.0 will trigger a MemPurge as often as possible.

      Default: 0.0 (disabled)

      Specified by:
      setExperimentalMempurgeThreshold in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      experimentalMempurgeThreshold - the threshold used by the MemPurge decider.
      Returns:
      the reference to the current options.
    • memtableWholeKeyFiltering

      public boolean memtableWholeKeyFiltering()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Returns whether whole key bloom filter is enabled in memtable
      Specified by:
      memtableWholeKeyFiltering in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      true if whole key bloom filter is enabled in memtable
    • setMemtableWholeKeyFiltering

      public Options setMemtableWholeKeyFiltering(boolean memtableWholeKeyFiltering)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Enable whole key bloom filter in memtable. Note this will only take effect if memtable_prefix_bloom_size_ratio is not 0. Enabling whole key filtering can potentially reduce CPU usage for point-look-ups.

      Default: false (disabled)

      Specified by:
      setMemtableWholeKeyFiltering in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      memtableWholeKeyFiltering - true if whole key bloom filter is enabled in memtable
      Returns:
      the reference to the current options.
    • bloomLocality

      public int bloomLocality()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Control locality of bloom filter probes to improve cache miss rate. This option only applies to memtable prefix bloom and plaintable prefix bloom. It essentially limits the max number of cache lines each bloom filter check can touch. This optimization is turned off when set to 0. The number should never be greater than number of probes. This option can boost performance for in-memory workload but should use with care since it can cause higher false positive rate. Default: 0
      Specified by:
      bloomLocality in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      the level of locality of bloom-filter probes.
      See Also:
    • setBloomLocality

      public Options setBloomLocality(int bloomLocality)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Control locality of bloom filter probes to improve cache miss rate. This option only applies to memtable prefix bloom and plaintable prefix bloom. It essentially limits the max number of cache lines each bloom filter check can touch. This optimization is turned off when set to 0. The number should never be greater than number of probes. This option can boost performance for in-memory workload but should use with care since it can cause higher false positive rate. Default: 0
      Specified by:
      setBloomLocality in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      bloomLocality - the level of locality of bloom-filter probes.
      Returns:
      the reference to the current options.
    • maxSuccessiveMerges

      public long maxSuccessiveMerges()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Maximum number of successive merge operations on a key in the memtable.

      When a merge operation is added to the memtable and the maximum number of successive merges is reached, the value of the key will be calculated and inserted into the memtable instead of the merge operation. This will ensure that there are never more than max_successive_merges merge operations in the memtable.

      Default: 0 (disabled)

      Specified by:
      maxSuccessiveMerges in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the maximum number of successive merges.
    • setMaxSuccessiveMerges

      public Options setMaxSuccessiveMerges(long maxSuccessiveMerges)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Maximum number of successive merge operations on a key in the memtable.

      When a merge operation is added to the memtable and the maximum number of successive merges is reached, the value of the key will be calculated and inserted into the memtable instead of the merge operation. This will ensure that there are never more than max_successive_merges merge operations in the memtable.

      Default: 0 (disabled)

      Specified by:
      setMaxSuccessiveMerges in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      maxSuccessiveMerges - the maximum number of successive merges.
      Returns:
      the reference to the current options.
    • minWriteBufferNumberToMerge

      public int minWriteBufferNumberToMerge()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The minimum number of write buffers that will be merged together before writing to storage. If set to 1, then all write buffers are flushed to L0 as individual files and this increases read amplification because a get request has to check in all of these files. Also, an in-memory merge may result in writing lesser data to storage if there are duplicate records in each of these individual write buffers. Default: 1
      Specified by:
      minWriteBufferNumberToMerge in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      the minimum number of write buffers that will be merged together.
    • setMinWriteBufferNumberToMerge

      public Options setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The minimum number of write buffers that will be merged together before writing to storage. If set to 1, then all write buffers are flushed to L0 as individual files and this increases read amplification because a get request has to check in all of these files. Also, an in-memory merge may result in writing lesser data to storage if there are duplicate records in each of these individual write buffers. Default: 1
      Specified by:
      setMinWriteBufferNumberToMerge in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      minWriteBufferNumberToMerge - the minimum number of write buffers that will be merged together.
      Returns:
      the reference to the current options.
    • setOptimizeFiltersForHits

      public Options setOptimizeFiltersForHits(boolean optimizeFiltersForHits)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface

      This flag specifies that the implementation should optimize the filters mainly for cases where keys are found rather than also optimize for keys missed. This would be used in cases where the application knows that there are very few misses or the performance in the case of misses is not important.

      For now, this flag allows us to not store filters for the last level i.e the largest level which contains data of the LSM store. For keys which are hits, the filters in this level are not useful because we will search for the data anyway.

      NOTE: the filters in other levels are still useful even for key hit because they tell us whether to look in that level or go to the higher level.

      Default: false

      Specified by:
      setOptimizeFiltersForHits in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      optimizeFiltersForHits - boolean value indicating if this flag is set.
      Returns:
      the reference to the current options.
    • optimizeFiltersForHits

      public boolean optimizeFiltersForHits()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface

      Returns the current state of the optimize_filters_for_hits setting.

      Specified by:
      optimizeFiltersForHits in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      boolean value indicating if the flag optimize_filters_for_hits was set.
    • setMemtableHugePageSize

      public Options setMemtableHugePageSize(long memtableHugePageSize)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Page size for huge page TLB for bloom in memtable. If ≤ 0, not allocate from huge page TLB but from malloc. Need to reserve huge pages for it to be allocated. For example: sysctl -w vm.nr_hugepages=20 See linux doc Documentation/vm/hugetlbpage.txt
      Specified by:
      setMemtableHugePageSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      memtableHugePageSize - The page size of the huge page tlb
      Returns:
      the reference to the current options.
    • memtableHugePageSize

      public long memtableHugePageSize()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Page size for huge page TLB for bloom in memtable. If ≤ 0, not allocate from huge page TLB but from malloc. Need to reserve huge pages for it to be allocated. For example: sysctl -w vm.nr_hugepages=20 See linux doc Documentation/vm/hugetlbpage.txt
      Specified by:
      memtableHugePageSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      The page size of the huge page tlb
    • setSoftPendingCompactionBytesLimit

      public Options setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      All writes will be slowed down to at least delayed_write_rate if estimated bytes needed to be compaction exceed this threshold.

      Default: 64GB

      Specified by:
      setSoftPendingCompactionBytesLimit in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      softPendingCompactionBytesLimit - The soft limit to impose on compaction
      Returns:
      the reference to the current options.
    • softPendingCompactionBytesLimit

      public long softPendingCompactionBytesLimit()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      All writes will be slowed down to at least delayed_write_rate if estimated bytes needed to be compaction exceed this threshold.

      Default: 64GB

      Specified by:
      softPendingCompactionBytesLimit in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      The soft limit to impose on compaction
    • setHardPendingCompactionBytesLimit

      public Options setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      All writes are stopped if estimated bytes needed to be compaction exceed this threshold.

      Default: 256GB

      Specified by:
      setHardPendingCompactionBytesLimit in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      hardPendingCompactionBytesLimit - The hard limit to impose on compaction
      Returns:
      the reference to the current options.
    • hardPendingCompactionBytesLimit

      public long hardPendingCompactionBytesLimit()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      All writes are stopped if estimated bytes needed to be compaction exceed this threshold.

      Default: 256GB

      Specified by:
      hardPendingCompactionBytesLimit in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      The hard limit to impose on compaction
    • setLevel0FileNumCompactionTrigger

      public Options setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger)
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Number of files to trigger level-0 compaction. A value < 0 means that level-0 compaction will not be triggered by number of files at all.

      Default: 4

      Specified by:
      setLevel0FileNumCompactionTrigger in interface MutableColumnFamilyOptionsInterface<Options>
      Parameters:
      level0FileNumCompactionTrigger - The number of files to trigger level-0 compaction
      Returns:
      the reference to the current option.
    • level0FileNumCompactionTrigger

      public int level0FileNumCompactionTrigger()
      Description copied from interface: MutableColumnFamilyOptionsInterface
      Number of files to trigger level-0 compaction. A value < 0 means that level-0 compaction will not be triggered by number of files at all.

      Default: 4

      Specified by:
      level0FileNumCompactionTrigger in interface MutableColumnFamilyOptionsInterface<Options>
      Returns:
      The number of files to trigger
    • setLevel0SlowdownWritesTrigger

      public Options setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Soft limit on number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.
      Specified by:
      setLevel0SlowdownWritesTrigger in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      level0SlowdownWritesTrigger - The soft limit on the number of level-0 files
      Returns:
      the reference to the current options.
    • level0SlowdownWritesTrigger

      public int level0SlowdownWritesTrigger()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Soft limit on number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.
      Specified by:
      level0SlowdownWritesTrigger in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      The soft limit on the number of level-0 files
    • setLevel0StopWritesTrigger

      public Options setLevel0StopWritesTrigger(int level0StopWritesTrigger)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Maximum number of level-0 files. We stop writes at this point.
      Specified by:
      setLevel0StopWritesTrigger in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      level0StopWritesTrigger - The maximum number of level-0 files
      Returns:
      the reference to the current options.
    • level0StopWritesTrigger

      public int level0StopWritesTrigger()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Maximum number of level-0 files. We stop writes at this point.
      Specified by:
      level0StopWritesTrigger in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      The maximum number of level-0 files
    • setMaxBytesForLevelMultiplierAdditional

      public Options setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Different max-size multipliers for different levels. These are multiplied by max_bytes_for_level_multiplier to arrive at the max-size of each level.

      Default: 1

      Specified by:
      setMaxBytesForLevelMultiplierAdditional in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      maxBytesForLevelMultiplierAdditional - The max-size multipliers for each level
      Returns:
      the reference to the current options.
    • maxBytesForLevelMultiplierAdditional

      public int[] maxBytesForLevelMultiplierAdditional()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Different max-size multipliers for different levels. These are multiplied by max_bytes_for_level_multiplier to arrive at the max-size of each level.

      Default: 1

      Specified by:
      maxBytesForLevelMultiplierAdditional in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      The max-size multipliers for each level
    • setParanoidFileChecks

      public Options setParanoidFileChecks(boolean paranoidFileChecks)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      After writing every SST file, reopen it and read all the keys.

      Default: false

      Specified by:
      setParanoidFileChecks in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      paranoidFileChecks - true to enable paranoid file checks
      Returns:
      the reference to the current options.
    • paranoidFileChecks

      public boolean paranoidFileChecks()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      After writing every SST file, reopen it and read all the keys.

      Default: false

      Specified by:
      paranoidFileChecks in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      true if paranoid file checks are enabled
    • setMaxWriteBufferNumberToMaintain

      public Options setMaxWriteBufferNumberToMaintain(int maxWriteBufferNumberToMaintain)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The total maximum number of write buffers to maintain in memory including copies of buffers that have already been flushed. Unlike AdvancedMutableColumnFamilyOptionsInterface.maxWriteBufferNumber(), this parameter does not affect flushing. This controls the minimum amount of write history that will be available in memory for conflict checking when Transactions are used.

      When using an OptimisticTransactionDB: If this value is too low, some transactions may fail at commit time due to not being able to determine whether there were any write conflicts.

      When using a TransactionDB: If Transaction::SetSnapshot is used, TransactionDB will read either in-memory write buffers or SST files to do write-conflict checking. Increasing this value can reduce the number of reads to SST files done for conflict detection.

      Setting this value to 0 will cause write buffers to be freed immediately after they are flushed. If this value is set to -1, AdvancedMutableColumnFamilyOptionsInterface.maxWriteBufferNumber() will be used.

      Default: If using a TransactionDB/OptimisticTransactionDB, the default value will be set to the value of AdvancedMutableColumnFamilyOptionsInterface.maxWriteBufferNumber() if it is not explicitly set by the user. Otherwise, the default is 0.

      Specified by:
      setMaxWriteBufferNumberToMaintain in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      maxWriteBufferNumberToMaintain - The maximum number of write buffers to maintain
      Returns:
      the reference to the current options.
    • maxWriteBufferNumberToMaintain

      public int maxWriteBufferNumberToMaintain()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The total maximum number of write buffers to maintain in memory including copies of buffers that have already been flushed.
      Specified by:
      maxWriteBufferNumberToMaintain in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      maxWriteBufferNumberToMaintain The maximum number of write buffers to maintain
    • setCompactionPriority

      public Options setCompactionPriority(CompactionPriority compactionPriority)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      If level AdvancedColumnFamilyOptionsInterface.compactionStyle() == CompactionStyle.LEVEL, for each level, which files are prioritized to be picked to compact.

      Default: CompactionPriority.ByCompensatedSize

      Specified by:
      setCompactionPriority in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionPriority - The compaction priority
      Returns:
      the reference to the current options.
    • compactionPriority

      public CompactionPriority compactionPriority()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Get the Compaction priority if level compaction is used for all levels
      Specified by:
      compactionPriority in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      The compaction priority
    • setReportBgIoStats

      public Options setReportBgIoStats(boolean reportBgIoStats)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Measure IO stats in compactions and flushes, if true.

      Default: false

      Specified by:
      setReportBgIoStats in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      reportBgIoStats - true to enable reporting
      Returns:
      the reference to the current options.
    • reportBgIoStats

      public boolean reportBgIoStats()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Determine whether IO stats in compactions and flushes are being measured
      Specified by:
      reportBgIoStats in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      true if reporting is enabled
    • setTtl

      public Options setTtl(long ttl)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Non-bottom-level files older than TTL will go through the compaction process. This needs MutableDBOptionsInterface.maxOpenFiles() to be set to -1.

      Enabled only for level compaction for now.

      Default: 0 (disabled)

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setTtl in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      ttl - the time-to-live.
      Returns:
      the reference to the current options.
    • ttl

      public long ttl()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get the TTL for Non-bottom-level files that will go through the compaction process.

      See AdvancedMutableColumnFamilyOptionsInterface.setTtl(long).

      Specified by:
      ttl in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the time-to-live.
    • setPeriodicCompactionSeconds

      public Options setPeriodicCompactionSeconds(long periodicCompactionSeconds)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Files older than this value will be picked up for compaction, and re-written to the same level as they were before. One main use of the feature is to make sure a file goes through compaction filters periodically. Users can also use the feature to clear up SST files using old format.

      A file's age is computed by looking at file_creation_time or creation_time table properties in order, if they have valid non-zero values; if not, the age is based on the file's last modified time (given by the underlying Env).

      Supported in Level and FIFO compaction. In FIFO compaction, this option has the same meaning as TTL and whichever stricter will be used. Pre-req: max_open_file == -1. unit: seconds. Ex: 7 days = 7 * 24 * 60 * 60

      Values: 0: Turn off Periodic compactions. UINT64_MAX - 1 (i.e 0xfffffffffffffffe): Let RocksDB control this feature as needed. For now, RocksDB will change this value to 30 days (i.e 30 * 24 * 60 * 60) so that every file goes through the compaction process at least once every 30 days if not compacted sooner. In FIFO compaction, since the option has the same meaning as ttl, when this value is left default, and ttl is left to 0, 30 days will be used. Otherwise, min(ttl, periodic_compaction_seconds) will be used.

      Default: 0xfffffffffffffffe (allow RocksDB to auto-tune)

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setPeriodicCompactionSeconds in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      periodicCompactionSeconds - the periodic compaction in seconds.
      Returns:
      the reference to the current options.
    • periodicCompactionSeconds

      public long periodicCompactionSeconds()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Specified by:
      periodicCompactionSeconds in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the periodic compaction in seconds.
    • setCompactionOptionsUniversal

      public Options setCompactionOptionsUniversal(CompactionOptionsUniversal compactionOptionsUniversal)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      Set the options needed to support Universal Style compactions
      Specified by:
      setCompactionOptionsUniversal in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionOptionsUniversal - The Universal Style compaction options
      Returns:
      the reference to the current options.
    • compactionOptionsUniversal

      public CompactionOptionsUniversal compactionOptionsUniversal()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The options needed to support Universal Style compactions
      Specified by:
      compactionOptionsUniversal in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      The Universal Style compaction options
    • setCompactionOptionsFIFO

      public Options setCompactionOptionsFIFO(CompactionOptionsFIFO compactionOptionsFIFO)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The options for FIFO compaction style
      Specified by:
      setCompactionOptionsFIFO in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionOptionsFIFO - The FIFO compaction options
      Returns:
      the reference to the current options.
    • compactionOptionsFIFO

      public CompactionOptionsFIFO compactionOptionsFIFO()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      The options for FIFO compaction style
      Specified by:
      compactionOptionsFIFO in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      The FIFO compaction options
    • setForceConsistencyChecks

      public Options setForceConsistencyChecks(boolean forceConsistencyChecks)
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      By default, RocksDB runs consistency checks on the LSM every time the LSM changes (Flush, Compaction, AddFile). Use this option if you need to disable them.

      Default: true

      Specified by:
      setForceConsistencyChecks in interface AdvancedColumnFamilyOptionsInterface<Options>
      Parameters:
      forceConsistencyChecks - false to disable consistency checks
      Returns:
      the reference to the current options.
    • forceConsistencyChecks

      public boolean forceConsistencyChecks()
      Description copied from interface: AdvancedColumnFamilyOptionsInterface
      By default, RocksDB runs consistency checks on the LSM every time the LSM changes (Flush, Compaction, AddFile).
      Specified by:
      forceConsistencyChecks in interface AdvancedColumnFamilyOptionsInterface<Options>
      Returns:
      true if consistency checks are enforced
    • setAtomicFlush

      public Options setAtomicFlush(boolean atomicFlush)
      Description copied from interface: DBOptionsInterface
      If true, RocksDB supports flushing multiple column families and committing their results atomically to MANIFEST. Note that it is not necessary to set atomic_flush to true if WAL is always enabled since WAL allows the database to be restored to the last persistent state in WAL. This option is useful when there are column families with writes NOT protected by WAL. For manual flush, application has to specify which column families to flush atomically in RocksDB.flush(FlushOptions, List). For auto-triggered flush, RocksDB atomically flushes ALL column families. Currently, any WAL-enabled writes after atomic flush may be replayed independently if the process crashes later and tries to recover.
      Specified by:
      setAtomicFlush in interface DBOptionsInterface<Options>
      Parameters:
      atomicFlush - true to enable atomic flush of multiple column families.
      Returns:
      the reference to the current options.
    • atomicFlush

      public boolean atomicFlush()
      Description copied from interface: DBOptionsInterface
      Determine if atomic flush of multiple column families is enabled. See DBOptionsInterface.setAtomicFlush(boolean).
      Specified by:
      atomicFlush in interface DBOptionsInterface<Options>
      Returns:
      true if atomic flush is enabled.
    • setAvoidUnnecessaryBlockingIO

      public Options setAvoidUnnecessaryBlockingIO(boolean avoidUnnecessaryBlockingIO)
      Description copied from interface: DBOptionsInterface
      If true, working thread may avoid doing unnecessary and long-latency operation (such as deleting obsolete files directly or deleting memtable) and will instead schedule a background job to do it. Use it if you're latency-sensitive. If set to true, takes precedence over ReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean).
      Specified by:
      setAvoidUnnecessaryBlockingIO in interface DBOptionsInterface<Options>
      Parameters:
      avoidUnnecessaryBlockingIO - If true, working thread may avoid doing unnecessary operation.
      Returns:
      the reference to the current options.
    • avoidUnnecessaryBlockingIO

      public boolean avoidUnnecessaryBlockingIO()
      Description copied from interface: DBOptionsInterface
      If true, working thread may avoid doing unnecessary and long-latency operation (such as deleting obsolete files directly or deleting memtable) and will instead schedule a background job to do it. Use it if you're latency-sensitive. If set to true, takes precedence over ReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean).
      Specified by:
      avoidUnnecessaryBlockingIO in interface DBOptionsInterface<Options>
      Returns:
      true, if working thread may avoid doing unnecessary operation.
    • setPersistStatsToDisk

      public Options setPersistStatsToDisk(boolean persistStatsToDisk)
      Description copied from interface: DBOptionsInterface
      If true, automatically persist stats to a hidden column family (column family name: ___rocksdb_stats_history___) every stats_persist_period_sec seconds; otherwise, write to an in-memory struct. User can query through `GetStatsHistory` API. If user attempts to create a column family with the same name on a DB which have previously set persist_stats_to_disk to true, the column family creation will fail, but the hidden column family will survive, as well as the previously persisted statistics. When peristing stats to disk, the stat name will be limited at 100 bytes. Default: false
      Specified by:
      setPersistStatsToDisk in interface DBOptionsInterface<Options>
      Parameters:
      persistStatsToDisk - true if stats should be persisted to hidden column family.
      Returns:
      the instance of the current object.
    • persistStatsToDisk

      public boolean persistStatsToDisk()
      Description copied from interface: DBOptionsInterface
      If true, automatically persist stats to a hidden column family (column family name: ___rocksdb_stats_history___) every stats_persist_period_sec seconds; otherwise, write to an in-memory struct. User can query through `GetStatsHistory` API. If user attempts to create a column family with the same name on a DB which have previously set persist_stats_to_disk to true, the column family creation will fail, but the hidden column family will survive, as well as the previously persisted statistics. When peristing stats to disk, the stat name will be limited at 100 bytes. Default: false
      Specified by:
      persistStatsToDisk in interface DBOptionsInterface<Options>
      Returns:
      true if stats should be persisted to hidden column family.
    • setWriteDbidToManifest

      public Options setWriteDbidToManifest(boolean writeDbidToManifest)
      Description copied from interface: DBOptionsInterface
      Historically DB ID has always been stored in Identity File in DB folder. If this flag is true, the DB ID is written to Manifest file in addition to the Identity file. By doing this 2 problems are solved 1. We don't checksum the Identity file where as Manifest file is. 2. Since the source of truth for DB is Manifest file DB ID will sit with the source of truth. Previously the Identity file could be copied independent of Manifest and that can result in wrong DB ID. We recommend setting this flag to true. Default: false
      Specified by:
      setWriteDbidToManifest in interface DBOptionsInterface<Options>
      Parameters:
      writeDbidToManifest - if true, then DB ID will be written to Manifest file.
      Returns:
      the instance of the current object.
    • writeDbidToManifest

      public boolean writeDbidToManifest()
      Description copied from interface: DBOptionsInterface
      Historically DB ID has always been stored in Identity File in DB folder. If this flag is true, the DB ID is written to Manifest file in addition to the Identity file. By doing this 2 problems are solved 1. We don't checksum the Identity file where as Manifest file is. 2. Since the source of truth for DB is Manifest file DB ID will sit with the source of truth. Previously the Identity file could be copied independent of Manifest and that can result in wrong DB ID. We recommend setting this flag to true. Default: false
      Specified by:
      writeDbidToManifest in interface DBOptionsInterface<Options>
      Returns:
      true, if DB ID will be written to Manifest file.
    • setLogReadaheadSize

      public Options setLogReadaheadSize(long logReadaheadSize)
      Description copied from interface: DBOptionsInterface
      The number of bytes to prefetch when reading the log. This is mostly useful for reading a remotely located log, as it can save the number of round-trips. If 0, then the prefetching is disabled. Default: 0
      Specified by:
      setLogReadaheadSize in interface DBOptionsInterface<Options>
      Parameters:
      logReadaheadSize - the number of bytes to prefetch when reading the log.
      Returns:
      the instance of the current object.
    • logReadaheadSize

      public long logReadaheadSize()
      Description copied from interface: DBOptionsInterface
      The number of bytes to prefetch when reading the log. This is mostly useful for reading a remotely located log, as it can save the number of round-trips. If 0, then the prefetching is disabled. Default: 0
      Specified by:
      logReadaheadSize in interface DBOptionsInterface<Options>
      Returns:
      the number of bytes to prefetch when reading the log.
    • setBestEffortsRecovery

      public Options setBestEffortsRecovery(boolean bestEffortsRecovery)
      Description copied from interface: DBOptionsInterface
      By default, RocksDB recovery fails if any table file referenced in MANIFEST are missing after scanning the MANIFEST. Best-efforts recovery is another recovery mode that tries to restore the database to the most recent point in time without missing file. Currently not compatible with atomic flush. Furthermore, WAL files will not be used for recovery if best_efforts_recovery is true. Default: false
      Specified by:
      setBestEffortsRecovery in interface DBOptionsInterface<Options>
      Parameters:
      bestEffortsRecovery - if true, RocksDB will use best-efforts mode when recovering.
      Returns:
      the instance of the current object.
    • bestEffortsRecovery

      public boolean bestEffortsRecovery()
      Description copied from interface: DBOptionsInterface
      By default, RocksDB recovery fails if any table file referenced in MANIFEST are missing after scanning the MANIFEST. Best-efforts recovery is another recovery mode that tries to restore the database to the most recent point in time without missing file. Currently not compatible with atomic flush. Furthermore, WAL files will not be used for recovery if best_efforts_recovery is true. Default: false
      Specified by:
      bestEffortsRecovery in interface DBOptionsInterface<Options>
      Returns:
      true, if RocksDB uses best-efforts mode when recovering.
    • setMaxBgErrorResumeCount

      public Options setMaxBgErrorResumeCount(int maxBgerrorResumeCount)
      Description copied from interface: DBOptionsInterface
      It defines how many times db resume is called by a separate thread when background retryable IO Error happens. When background retryable IO Error happens, SetBGError is called to deal with the error. If the error can be auto-recovered (e.g., retryable IO Error during Flush or WAL write), then db resume is called in background to recover from the error. If this value is 0 or negative, db resume will not be called. Default: INT_MAX
      Specified by:
      setMaxBgErrorResumeCount in interface DBOptionsInterface<Options>
      Parameters:
      maxBgerrorResumeCount - maximum number of times db resume should be called when IO Error happens.
      Returns:
      the instance of the current object.
    • maxBgerrorResumeCount

      public int maxBgerrorResumeCount()
      Description copied from interface: DBOptionsInterface
      It defines how many times db resume is called by a separate thread when background retryable IO Error happens. When background retryable IO Error happens, SetBGError is called to deal with the error. If the error can be auto-recovered (e.g., retryable IO Error during Flush or WAL write), then db resume is called in background to recover from the error. If this value is 0 or negative, db resume will not be called. Default: INT_MAX
      Specified by:
      maxBgerrorResumeCount in interface DBOptionsInterface<Options>
      Returns:
      maximum number of times db resume should be called when IO Error happens.
    • setBgerrorResumeRetryInterval

      public Options setBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)
      Description copied from interface: DBOptionsInterface
      If max_bgerror_resume_count is ≥ 2, db resume is called multiple times. This option decides how long to wait to retry the next resume if the previous resume fails and satisfy redo resume conditions. Default: 1000000 (microseconds).
      Specified by:
      setBgerrorResumeRetryInterval in interface DBOptionsInterface<Options>
      Parameters:
      bgerrorResumeRetryInterval - how many microseconds to wait between DB resume attempts.
      Returns:
      the instance of the current object.
    • bgerrorResumeRetryInterval

      public long bgerrorResumeRetryInterval()
      Description copied from interface: DBOptionsInterface
      If max_bgerror_resume_count is ≥ 2, db resume is called multiple times. This option decides how long to wait to retry the next resume if the previous resume fails and satisfy redo resume conditions. Default: 1000000 (microseconds).
      Specified by:
      bgerrorResumeRetryInterval in interface DBOptionsInterface<Options>
      Returns:
      the instance of the current object.
    • setSstPartitionerFactory

      public Options setSstPartitionerFactory(SstPartitionerFactory sstPartitionerFactory)
      Description copied from interface: ColumnFamilyOptionsInterface
      If non-nullptr, use the specified factory for a function to determine the partitioning of sst files. This helps compaction to split the files on interesting boundaries (key prefixes) to make propagation of sst files less write amplifying (covering the whole key space).

      Default: nullptr

      Specified by:
      setSstPartitionerFactory in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      sstPartitionerFactory - The factory reference
      Returns:
      the reference of the current options.
    • sstPartitionerFactory

      public SstPartitionerFactory sstPartitionerFactory()
      Description copied from interface: ColumnFamilyOptionsInterface
      Get SST partitioner factory
      Specified by:
      sstPartitionerFactory in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      SST partitioner factory
    • setMemtableMaxRangeDeletions

      public Options setMemtableMaxRangeDeletions(int count)
      Description copied from interface: ColumnFamilyOptionsInterface
      Sets the maximum range delete calls, after which memtable is flushed. This applies to the mutable memtable.
      Specified by:
      setMemtableMaxRangeDeletions in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      count - a positive integer, 0 (default) to disable the feature.
      Returns:
      the reference of the current options.
    • memtableMaxRangeDeletions

      public int memtableMaxRangeDeletions()
      Description copied from interface: ColumnFamilyOptionsInterface
      Gets the current setting of maximum range deletes allowed 0(default) indicates that feature is disabled.
      Specified by:
      memtableMaxRangeDeletions in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      current value of memtable_max_range_deletions
    • setCompactionThreadLimiter

      public Options setCompactionThreadLimiter(ConcurrentTaskLimiter compactionThreadLimiter)
      Description copied from interface: ColumnFamilyOptionsInterface
      Compaction concurrent thread limiter for the column family. If non-nullptr, use given concurrent thread limiter to control the max outstanding compaction tasks. Limiter can be shared with multiple column families across db instances.
      Specified by:
      setCompactionThreadLimiter in interface ColumnFamilyOptionsInterface<Options>
      Parameters:
      compactionThreadLimiter - The compaction thread limiter.
      Returns:
      the reference of the current options.
    • compactionThreadLimiter

      public ConcurrentTaskLimiter compactionThreadLimiter()
      Description copied from interface: ColumnFamilyOptionsInterface
      Get compaction thread limiter
      Specified by:
      compactionThreadLimiter in interface ColumnFamilyOptionsInterface<Options>
      Returns:
      Compaction thread limiter
    • setEnableBlobFiles

      public Options setEnableBlobFiles(boolean enableBlobFiles)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      When set, large values (blobs) are written to separate blob files, and only pointers to them are stored in SST files. This can reduce write amplification for large-value use cases at the cost of introducing a level of indirection for reads. See also the options min_blob_size, blob_file_size, blob_compression_type, enable_blob_garbage_collection, and blob_garbage_collection_age_cutoff below.

      Default: false

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setEnableBlobFiles in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      enableBlobFiles - true iff blob files should be enabled
      Returns:
      the reference to the current options.
    • enableBlobFiles

      public boolean enableBlobFiles()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      When set, large values (blobs) are written to separate blob files, and only pointers to them are stored in SST files. This can reduce write amplification for large-value use cases at the cost of introducing a level of indirection for reads. See also the options min_blob_size, blob_file_size, blob_compression_type, enable_blob_garbage_collection, and blob_garbage_collection_age_cutoff below.

      Default: false

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      enableBlobFiles in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      true if blob files are enabled
    • setMinBlobSize

      public Options setMinBlobSize(long minBlobSize)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set the size of the smallest value to be stored separately in a blob file. Values which have an uncompressed size smaller than this threshold are stored alongside the keys in SST files in the usual fashion. A value of zero for this option means that all values are stored in blob files. Note that enable_blob_files has to be set in order for this option to have any effect.

      Default: 0

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setMinBlobSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      minBlobSize - the size of the smallest value to be stored separately in a blob file
      Returns:
      the reference to the current options.
    • minBlobSize

      public long minBlobSize()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get the size of the smallest value to be stored separately in a blob file. Values which have an uncompressed size smaller than this threshold are stored alongside the keys in SST files in the usual fashion. A value of zero for this option means that all values are stored in blob files. Note that enable_blob_files has to be set in order for this option to have any effect.

      Default: 0

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      minBlobSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current minimum size of value which is stored separately in a blob
    • setBlobFileSize

      public Options setBlobFileSize(long blobFileSize)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set the size limit for blob files. When writing blob files, a new file is opened once this limit is reached. Note that enable_blob_files has to be set in order for this option to have any effect.

      Default: 256 MB

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setBlobFileSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      blobFileSize - the size limit for blob files
      Returns:
      the reference to the current options.
    • blobFileSize

      public long blobFileSize()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      The size limit for blob files. When writing blob files, a new file is opened once this limit is reached.
      Specified by:
      blobFileSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current size limit for blob files
    • setBlobCompressionType

      public Options setBlobCompressionType(CompressionType compressionType)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set the compression algorithm to use for large values stored in blob files. Note that enable_blob_files has to be set in order for this option to have any effect.

      Default: no compression

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setBlobCompressionType in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      compressionType - the compression algorithm to use.
      Returns:
      the reference to the current options.
    • blobCompressionType

      public CompressionType blobCompressionType()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get the compression algorithm in use for large values stored in blob files. Note that enable_blob_files has to be set in order for this option to have any effect.
      Specified by:
      blobCompressionType in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current compression algorithm
    • setEnableBlobGarbageCollection

      public Options setEnableBlobGarbageCollection(boolean enableBlobGarbageCollection)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Enable/disable garbage collection of blobs. Blob GC is performed as part of compaction. Valid blobs residing in blob files older than a cutoff get relocated to new files as they are encountered during compaction, which makes it possible to clean up blob files once they contain nothing but obsolete/garbage blobs. See also blob_garbage_collection_age_cutoff below.

      Default: false

      Specified by:
      setEnableBlobGarbageCollection in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      enableBlobGarbageCollection - the new enabled/disabled state of blob garbage collection
      Returns:
      the reference to the current options.
    • enableBlobGarbageCollection

      public boolean enableBlobGarbageCollection()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Query whether garbage collection of blobs is enabled.Blob GC is performed as part of compaction. Valid blobs residing in blob files older than a cutoff get relocated to new files as they are encountered during compaction, which makes it possible to clean up blob files once they contain nothing but obsolete/garbage blobs. See also blob_garbage_collection_age_cutoff below.

      Default: false

      Specified by:
      enableBlobGarbageCollection in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      true if blob garbage collection is currently enabled.
    • setBlobGarbageCollectionAgeCutoff

      public Options setBlobGarbageCollectionAgeCutoff(double blobGarbageCollectionAgeCutoff)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set cutoff in terms of blob file age for garbage collection. Blobs in the oldest N blob files will be relocated when encountered during compaction, where N = garbage_collection_cutoff * number_of_blob_files. Note that enable_blob_garbage_collection has to be set in order for this option to have any effect.

      Default: 0.25

      Specified by:
      setBlobGarbageCollectionAgeCutoff in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      blobGarbageCollectionAgeCutoff - the new age cutoff
      Returns:
      the reference to the current options.
    • blobGarbageCollectionAgeCutoff

      public double blobGarbageCollectionAgeCutoff()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get cutoff in terms of blob file age for garbage collection. Blobs in the oldest N blob files will be relocated when encountered during compaction, where N = garbage_collection_cutoff * number_of_blob_files. Note that enable_blob_garbage_collection has to be set in order for this option to have any effect.

      Default: 0.25

      Specified by:
      blobGarbageCollectionAgeCutoff in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current age cutoff for garbage collection
    • setBlobGarbageCollectionForceThreshold

      public Options setBlobGarbageCollectionForceThreshold(double blobGarbageCollectionForceThreshold)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      If the ratio of garbage in the blob files currently eligible for garbage collection exceeds this threshold, targeted compactions are scheduled in order to force garbage collecting the oldest blob files. This option is currently only supported with leveled compactions.

      Note that AdvancedMutableColumnFamilyOptionsInterface.enableBlobGarbageCollection() has to be set in order for this option to have any effect.

      Default: 1.0

      Dynamically changeable through the SetOptions() API

      Specified by:
      setBlobGarbageCollectionForceThreshold in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      blobGarbageCollectionForceThreshold - new value for the threshold
      Returns:
      the reference to the current options
    • blobGarbageCollectionForceThreshold

      public double blobGarbageCollectionForceThreshold()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get the current value for the #blobGarbageCollectionForceThreshold
      Specified by:
      blobGarbageCollectionForceThreshold in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current threshold at which garbage collection of blobs is forced
    • setBlobCompactionReadaheadSize

      public Options setBlobCompactionReadaheadSize(long blobCompactionReadaheadSize)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set compaction readahead for blob files.

      Default: 0

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setBlobCompactionReadaheadSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      blobCompactionReadaheadSize - the compaction readahead for blob files
      Returns:
      the reference to the current options.
    • blobCompactionReadaheadSize

      public long blobCompactionReadaheadSize()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get compaction readahead for blob files.
      Specified by:
      blobCompactionReadaheadSize in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current compaction readahead for blob files
    • setBlobFileStartingLevel

      public Options setBlobFileStartingLevel(int blobFileStartingLevel)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set a certain LSM tree level to enable blob files.

      Default: 0

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setBlobFileStartingLevel in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      blobFileStartingLevel - the starting level to enable blob files
      Returns:
      the reference to the current options.
    • blobFileStartingLevel

      public int blobFileStartingLevel()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get the starting LSM tree level to enable blob files.

      Default: 0

      Specified by:
      blobFileStartingLevel in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current LSM tree level to enable blob files.
    • setPrepopulateBlobCache

      public Options setPrepopulateBlobCache(PrepopulateBlobCache prepopulateBlobCache)
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Set a certain prepopulate blob cache option.

      Default: 0

      Dynamically changeable through RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).

      Specified by:
      setPrepopulateBlobCache in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Parameters:
      prepopulateBlobCache - prepopulate the blob cache option
      Returns:
      the reference to the current options.
    • prepopulateBlobCache

      public PrepopulateBlobCache prepopulateBlobCache()
      Description copied from interface: AdvancedMutableColumnFamilyOptionsInterface
      Get the prepopulate blob cache option.

      Default: 0

      Specified by:
      prepopulateBlobCache in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
      Returns:
      the current prepopulate blob cache option.
    • tablePropertiesCollectorFactory

      public List<TablePropertiesCollectorFactory> tablePropertiesCollectorFactory()
      Return copy of TablePropertiesCollectorFactory list. Modifying this list will not change underlying options C++ object. setTablePropertiesCollectorFactory must be called to propagate changes. All instance must be properly closed to prevent memory leaks.
      Returns:
      copy of TablePropertiesCollectorFactory list.
    • setTablePropertiesCollectorFactory

      public void setTablePropertiesCollectorFactory(List<TablePropertiesCollectorFactory> factories)
      Set TablePropertiesCollectorFactory in underlying C++ object. This method create its own copy of the list. Caller is responsible for closing all the instances in the list.
      Parameters:
      factories -
    • disposeInternal

      protected final void disposeInternal(long handle)
      Specified by:
      disposeInternal in class RocksObject