Package org.rocksdb

Interface MutableDBOptionsInterface<T extends MutableDBOptionsInterface<T>>

    • Method Detail

      • setMaxBackgroundJobs

        T setMaxBackgroundJobs​(int maxBackgroundJobs)
        Specifies the maximum number of concurrent background jobs (both flushes and compactions combined). Default: 2
        Parameters:
        maxBackgroundJobs - number of max concurrent background jobs
        Returns:
        the instance of the current object.
      • maxBackgroundJobs

        int maxBackgroundJobs()
        Returns the maximum number of concurrent background jobs (both flushes and compactions combined). Default: 2
        Returns:
        the maximum number of concurrent background jobs.
      • setBaseBackgroundCompactions

        @Deprecated
        void setBaseBackgroundCompactions​(int baseBackgroundCompactions)
        Deprecated.
        NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. This option is ignored. Suggested number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. Default: -1
        Parameters:
        baseBackgroundCompactions - Suggested number of background compaction jobs
      • baseBackgroundCompactions

        int baseBackgroundCompactions()
        NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. This option is ignored. Suggested number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. Default: -1
        Returns:
        Suggested number of background compaction jobs
      • setMaxBackgroundCompactions

        @Deprecated
        T setMaxBackgroundCompactions​(int maxBackgroundCompactions)
        Deprecated.
        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
        Parameters:
        maxBackgroundCompactions - the maximum number of background compaction jobs.
        Returns:
        the instance of the current object.
        See Also:
        Env.setBackgroundThreads(int), Env.setBackgroundThreads(int, Priority), DBOptionsInterface.maxBackgroundFlushes()
      • maxBackgroundCompactions

        @Deprecated
        int maxBackgroundCompactions()
        Deprecated.
        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
        Returns:
        the maximum number of concurrent background compaction jobs.
        See Also:
        Env.setBackgroundThreads(int), Env.setBackgroundThreads(int, Priority)
      • setAvoidFlushDuringShutdown

        T setAvoidFlushDuringShutdown​(boolean avoidFlushDuringShutdown)
        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.
        Parameters:
        avoidFlushDuringShutdown - true if we should avoid flush during shutdown
        Returns:
        the reference to the current options.
      • avoidFlushDuringShutdown

        boolean avoidFlushDuringShutdown()
        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.
        Returns:
        true if we should avoid flush during shutdown
      • setWritableFileMaxBufferSize

        T setWritableFileMaxBufferSize​(long writableFileMaxBufferSize)
        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)
        Parameters:
        writableFileMaxBufferSize - the maximum buffer size
        Returns:
        the reference to the current options.
      • writableFileMaxBufferSize

        long writableFileMaxBufferSize()
        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)
        Returns:
        the maximum buffer size
      • setDelayedWriteRate

        T setDelayedWriteRate​(long delayedWriteRate)
        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).
        Parameters:
        delayedWriteRate - the rate in bytes per second
        Returns:
        the reference to the current options.
      • delayedWriteRate

        long delayedWriteRate()
        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).
        Returns:
        the rate in bytes per second
      • setMaxTotalWalSize

        T setMaxTotalWalSize​(long maxTotalWalSize)

        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 (i.e. the ones that are causing all the space amplification).

        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] * 2

        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

        Parameters:
        maxTotalWalSize - max total wal size.
        Returns:
        the instance of the current object.
      • maxTotalWalSize

        long maxTotalWalSize()

        Returns the max total wal 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 (i.e. the ones that are causing all the space amplification).

        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] * 2

        Returns:
        max total wal size
      • setDeleteObsoleteFilesPeriodMicros

        T setDeleteObsoleteFilesPeriodMicros​(long micros)
        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
        Parameters:
        micros - the time interval in micros
        Returns:
        the instance of the current object.
      • deleteObsoleteFilesPeriodMicros

        long deleteObsoleteFilesPeriodMicros()
        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
        Returns:
        the time interval in micros when obsolete files will be deleted.
      • setStatsDumpPeriodSec

        T setStatsDumpPeriodSec​(int statsDumpPeriodSec)
        if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)
        Parameters:
        statsDumpPeriodSec - time interval in seconds.
        Returns:
        the instance of the current object.
      • statsDumpPeriodSec

        int statsDumpPeriodSec()
        If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)
        Returns:
        time interval in seconds.
      • setStatsPersistPeriodSec

        T setStatsPersistPeriodSec​(int statsPersistPeriodSec)
        If not zero, dump rocksdb.stats to RocksDB every statsPersistPeriodSec Default: 600
        Parameters:
        statsPersistPeriodSec - time interval in seconds.
        Returns:
        the instance of the current object.
      • statsPersistPeriodSec

        int statsPersistPeriodSec()
        If not zero, dump rocksdb.stats to RocksDB every statsPersistPeriodSec
        Returns:
        time interval in seconds.
      • setStatsHistoryBufferSize

        T setStatsHistoryBufferSize​(long statsHistoryBufferSize)
        If not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped at statsHistoryBufferSize Default: 1MB
        Parameters:
        statsHistoryBufferSize - the size of the buffer.
        Returns:
        the instance of the current object.
      • statsHistoryBufferSize

        long statsHistoryBufferSize()
        If not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped at statsHistoryBufferSize
        Returns:
        the size of the buffer.
      • setMaxOpenFiles

        T setMaxOpenFiles​(int maxOpenFiles)
        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
        Parameters:
        maxOpenFiles - the maximum number of open files.
        Returns:
        the instance of the current object.
      • maxOpenFiles

        int maxOpenFiles()
        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
        Returns:
        the maximum number of open files.
      • setBytesPerSync

        T setBytesPerSync​(long bytesPerSync)
        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
        Parameters:
        bytesPerSync - size in bytes
        Returns:
        the instance of the current object.
      • bytesPerSync

        long bytesPerSync()
        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
        Returns:
        size in bytes
      • setWalBytesPerSync

        T setWalBytesPerSync​(long walBytesPerSync)
        Same as setBytesPerSync(long) , but applies to WAL files Default: 0, turned off
        Parameters:
        walBytesPerSync - size in bytes
        Returns:
        the instance of the current object.
      • walBytesPerSync

        long walBytesPerSync()
        Same as bytesPerSync() , but applies to WAL files Default: 0, turned off
        Returns:
        size in bytes
      • setStrictBytesPerSync

        T setStrictBytesPerSync​(boolean strictBytesPerSync)
        When true, guarantees WAL files have at most walBytesPerSync() bytes submitted for writeback at any given time, and SST files have at most 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 bytesPerSync() / 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
        Parameters:
        strictBytesPerSync - the bytes per sync
        Returns:
        the instance of the current object.
      • strictBytesPerSync

        boolean strictBytesPerSync()
        Return the strict byte limit per sync. See setStrictBytesPerSync(boolean)
        Returns:
        the limit in bytes.
      • setCompactionReadaheadSize

        T setCompactionReadaheadSize​(long compactionReadaheadSize)
        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. When non-zero, we also force DBOptionsInterface.newTableReaderForCompactionInputs() to true. Default: 0
        Parameters:
        compactionReadaheadSize - The compaction read-ahead size
        Returns:
        the reference to the current options.
      • compactionReadaheadSize

        long compactionReadaheadSize()
        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. When non-zero, we also force DBOptionsInterface.newTableReaderForCompactionInputs() to true. Default: 0
        Returns:
        The compaction read-ahead size