public class Options extends RocksObject implements DBOptionsInterface<Options>, ColumnFamilyOptionsInterface<Options>, MutableColumnFamilyOptionsInterface<Options>
RocksDB
(i.e., RocksDB.open()).
If AbstractNativeReference.dispose()
function is not called, then it will be GC'd
automaticallyand native resources will be released as part of the process.nativeHandle_
DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET
Constructor and Description |
---|
Options()
Construct options for opening a RocksDB.
|
Options(DBOptions dbOptions,
ColumnFamilyOptions columnFamilyOptions)
Construct options for opening a RocksDB.
|
Modifier and Type | Method and Description |
---|---|
AccessHint |
accessHintOnCompactionStart()
Specify the file access pattern once a compaction is started.
|
boolean |
adviseRandomOnOpen()
If set true, will hint the underlying file system that the file
access pattern is random, when a sst file is opened.
|
boolean |
allow2pc()
if set to false then recovery will fail when a prepared
transaction is encountered in the WAL
Default: false
|
boolean |
allowConcurrentMemtableWrite()
If true, allow multi-writers to update mem tables in parallel.
|
boolean |
allowFAllocate()
Whether fallocate calls are allowed
|
boolean |
allowMmapReads()
Allow the OS to mmap file for reading sst tables.
|
boolean |
allowMmapWrites()
Allow the OS to mmap file for writing.
|
long |
arenaBlockSize()
The size of one block in arena memory allocation.
|
boolean |
avoidFlushDuringRecovery()
By default RocksDB replay WAL logs and flush them on DB open, which may
create very small SST files.
|
boolean |
avoidFlushDuringShutdown()
By default RocksDB will flush all memtables on DB close if there are
unpersisted data (i.e.
|
int |
baseBackgroundCompactions()
Suggested number of concurrent background compaction jobs, submitted to
the default LOW priority thread pool.
|
int |
bloomLocality()
Control locality of bloom filter probes to improve cache miss rate.
|
CompressionType |
bottommostCompressionType()
Compression algorithm that will be used for the bottommost level that
contain files.
|
long |
bytesPerSync()
Allows OS to incrementally sync files to disk while they are being
written, asynchronously, in the background.
|
CompactionOptionsFIFO |
compactionOptionsFIFO()
The options for FIFO compaction style
|
CompactionOptionsUniversal |
compactionOptionsUniversal()
The options needed to support Universal Style compactions
|
CompactionPriority |
compactionPriority()
Get the Compaction priority if level compaction
is used for all levels
|
long |
compactionReadaheadSize()
If non-zero, we perform bigger reads when doing compaction.
|
CompactionStyle |
compactionStyle()
Compaction style for DB.
|
CompressionOptions |
compressionOptions()
Get the different options for compression algorithms
|
java.util.List<CompressionType> |
compressionPerLevel()
Return the currently set
CompressionType
per instances. |
CompressionType |
compressionType()
Compress blocks using the specified compression algorithm.
|
boolean |
createIfMissing()
Return true if the create_if_missing flag is set to true.
|
boolean |
createMissingColumnFamilies()
Return true if the create_missing_column_families flag is set
to true.
|
java.lang.String |
dbLogDir()
Returns the directory of info log.
|
java.util.List<DbPath> |
dbPaths()
A list of paths where SST files can be put into, with its target size.
|
long |
dbWriteBufferSize()
Amount of data to build up in memtables across all column
families before writing to disk.
|
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. |
long |
deleteObsoleteFilesPeriodMicros()
The periodicity when obsolete files get deleted.
|
boolean |
disableAutoCompactions()
Disable automatic compactions.
|
protected void |
disposeInternal(long handle) |
boolean |
dumpMallocStats()
If true, then print malloc stats together with rocksdb.stats
when printing to LOG.
|
boolean |
enableThreadTracking()
If true, then the status of the threads involved in this DB will
be tracked and available via GetThreadList() API.
|
boolean |
enableWriteThreadAdaptiveYield()
If true, threads synchronizing with the write batch group leader will
wait for up to
DBOptionsInterface.writeThreadMaxYieldUsec() before blocking on a
mutex. |
boolean |
errorIfExists()
If true, an error will be thrown during RocksDB.open() if the
database already exists.
|
boolean |
failIfOptionsFileError()
If true, then DB::Open / CreateColumnFamily / DropColumnFamily
/ SetOptions will fail if options file is not detected or properly
persisted.
|
boolean |
forceConsistencyChecks()
In debug mode, RocksDB run consistency checks on the LSM everytime the LSM
change (Flush, Compaction, AddFile).
|
Env |
getEnv()
Returns the set RocksEnv instance.
|
long |
hardPendingCompactionBytesLimit()
All writes are stopped if estimated bytes needed to be compaction exceed
this threshold.
|
InfoLogLevel |
infoLogLevel()
Returns currently set log level.
|
long |
inplaceUpdateNumLocks()
Number of locks used for inplace update
Default: 10000, if inplace_update_support = true, else 0.
|
boolean |
inplaceUpdateSupport()
Allows thread-safe inplace updates.
|
boolean |
isFdCloseOnExec()
Disable child process inherit open files.
|
long |
keepLogFileNum()
Returns the maximum number of info log files to be kept.
|
int |
level0FileNumCompactionTrigger()
Number of files to trigger level-0 compaction.
|
int |
level0SlowdownWritesTrigger()
Soft limit on number of level-0 files.
|
int |
level0StopWritesTrigger()
Maximum number of level-0 files.
|
boolean |
levelCompactionDynamicLevelBytes()
Return if
LevelCompactionDynamicLevelBytes is enabled. |
int |
levelZeroFileNumCompactionTrigger()
The number of files in level 0 to trigger compaction from level-0 to
level-1.
|
int |
levelZeroSlowdownWritesTrigger()
Soft limit on the number of level-0 files.
|
int |
levelZeroStopWritesTrigger()
Maximum number of level-0 files.
|
long |
logFileTimeToRoll()
Returns the time interval for the info log file to roll (in seconds).
|
long |
manifestPreallocationSize()
Number of bytes to preallocate (via fallocate) the manifest
files.
|
int |
maxBackgroundCompactions()
Returns the maximum number of concurrent background compaction jobs,
submitted to the default LOW priority thread pool.
|
int |
maxBackgroundFlushes()
Returns the maximum number of concurrent background flush jobs.
|
int |
maxBackgroundJobs()
Returns the maximum number of concurrent background jobs (both flushes
and compactions combined).
|
long |
maxBytesForLevelBase()
The upper-bound of the total size of level-1 files in bytes.
|
double |
maxBytesForLevelMultiplier()
The ratio between the total size of level-(L+1) files and the total
size of level-L files for all L.
|
int[] |
maxBytesForLevelMultiplierAdditional()
Different max-size multipliers for different levels.
|
long |
maxCompactionBytes()
Control maximum size of each compaction (not guaranteed)
|
int |
maxFileOpeningThreads()
If
DBOptionsInterface.maxOpenFiles() is -1, DB will open all files on DB::Open(). |
long |
maxLogFileSize()
Returns the maximum size of a info log file.
|
long |
maxManifestFileSize()
Manifest file is rolled over on reaching this limit.
|
int |
maxOpenFiles()
Number of open files that can be used by the DB.
|
long |
maxSequentialSkipInIterations()
An iteration->Next() sequentially skips over keys with the same
user-key unless this option is set.
|
int |
maxSubcompactions()
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.
|
long |
maxSuccessiveMerges()
Maximum number of successive merge operations on a key in the memtable.
|
long |
maxTableFilesSizeFIFO()
FIFO compaction option.
|
long |
maxTotalWalSize()
Returns the max total wal size.
|
int |
maxWriteBufferNumber()
Returns maximum number of write buffers.
|
int |
maxWriteBufferNumberToMaintain()
The total maximum number of write buffers to maintain in memory including
copies of buffers that have already been flushed.
|
MemTableConfig |
memTableConfig()
Get the config for mem-table.
|
java.lang.String |
memTableFactoryName()
Returns the name of the current mem table representation.
|
long |
memtableHugePageSize()
Page size for huge page TLB for bloom in memtable.
|
double |
memtablePrefixBloomSizeRatio()
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.
|
int |
minWriteBufferNumberToMerge()
The minimum number of write buffers that will be merged together
before writing to storage.
|
boolean |
newTableReaderForCompactionInputs()
If true, always create a new file descriptor and new table reader
for compaction inputs.
|
int |
numLevels()
If level-styled compaction is used, then this number determines
the total number of levels.
|
boolean |
optimizeFiltersForHits()
Returns the current state of the
optimize_filters_for_hits
setting. |
Options |
optimizeForPointLookup(long blockCacheSizeMb)
Use this if you don't need to keep the data sorted, i.e.
|
Options |
optimizeForSmallDb()
Use this if your DB is very small (like under 1GB) and you don't want to
spend lots of memory for memtables.
|
Options |
optimizeLevelStyleCompaction()
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.
|
Options |
optimizeLevelStyleCompaction(long memtableMemoryBudget)
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.
|
Options |
optimizeUniversalStyleCompaction()
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.
|
Options |
optimizeUniversalStyleCompaction(long memtableMemoryBudget)
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.
|
boolean |
paranoidChecks()
If true, the implementation will do aggressive checking of the
data it is processing and will stop early if it detects any
errors.
|
boolean |
paranoidFileChecks()
After writing every SST file, reopen it and read all the keys.
|
Options |
prepareForBulkLoad()
Set appropriate parameters for bulk loading.
|
long |
randomAccessMaxBufferSize()
This is a maximum buffer size that is used by WinMmapReadableFile in
unbuffered disk I/O mode.
|
long |
recycleLogFileNum()
Recycle log files.
|
boolean |
reportBgIoStats()
Determine whether IO stats in compactions and flushes are being measured
|
Cache |
rowCache()
A global cache for table-level rows.
|
Options |
setAccessHintOnCompactionStart(AccessHint accessHint)
Specify the file access pattern once a compaction is started.
|
Options |
setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
If set true, will hint the underlying file system that the file
access pattern is random, when a sst file is opened.
|
Options |
setAllow2pc(boolean allow2pc)
if set to false then recovery will fail when a prepared
transaction is encountered in the WAL
Default: false
|
Options |
setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
If true, allow multi-writers to update mem tables in parallel.
|
Options |
setAllowFAllocate(boolean allowFAllocate)
Whether fallocate calls are allowed
|
Options |
setAllowMmapReads(boolean allowMmapReads)
Allow the OS to mmap file for reading sst tables.
|
Options |
setAllowMmapWrites(boolean allowMmapWrites)
Allow the OS to mmap file for writing.
|
Options |
setArenaBlockSize(long arenaBlockSize)
The size of one block in arena memory allocation.
|
Options |
setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
By default RocksDB replay WAL logs and flush them on DB open, which may
create very small SST files.
|
Options |
setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
By default RocksDB will flush all memtables on DB close if there are
unpersisted data (i.e.
|
void |
setBaseBackgroundCompactions(int baseBackgroundCompactions)
Suggested number of concurrent background compaction jobs, submitted to
the default LOW priority thread pool.
|
Options |
setBloomLocality(int bloomLocality)
Control locality of bloom filter probes to improve cache miss rate.
|
Options |
setBottommostCompressionType(CompressionType bottommostCompressionType)
Compression algorithm that will be used for the bottommost level that
contain files.
|
Options |
setBytesPerSync(long bytesPerSync)
Allows OS to incrementally sync files to disk while they are being
written, asynchronously, in the background.
|
Options |
setCompactionOptionsFIFO(CompactionOptionsFIFO compactionOptionsFIFO)
The options for FIFO compaction style
|
Options |
setCompactionOptionsUniversal(CompactionOptionsUniversal compactionOptionsUniversal)
Set the options needed to support Universal Style compactions
|
Options |
setCompactionPriority(CompactionPriority compactionPriority)
If level
AdvancedColumnFamilyOptionsInterface.compactionStyle() == CompactionStyle.LEVEL ,
for each level, which files are prioritized to be picked to compact. |
Options |
setCompactionReadaheadSize(long compactionReadaheadSize)
If non-zero, we perform bigger reads when doing compaction.
|
Options |
setCompactionStyle(CompactionStyle compactionStyle)
Set compaction style for DB.
|
Options |
setComparator(AbstractComparator<? extends AbstractSlice<?>> comparator)
Use the specified comparator for key ordering.
|
Options |
setComparator(BuiltinComparator builtinComparator)
Set
BuiltinComparator to be used with RocksDB. |
Options |
setCompressionOptions(CompressionOptions compressionOptions)
Set the different options for compression algorithms
|
Options |
setCompressionPerLevel(java.util.List<CompressionType> compressionLevels)
Different levels can have different compression
policies.
|
Options |
setCompressionType(CompressionType compressionType)
Compress blocks using the specified compression algorithm.
|
Options |
setCreateIfMissing(boolean flag)
If this value is set to true, then the database will be created
if it is missing during
RocksDB.open() . |
Options |
setCreateMissingColumnFamilies(boolean flag)
If true, missing column families will be automatically created
|
Options |
setDbLogDir(java.lang.String dbLogDir)
This specifies the info LOG dir.
|
Options |
setDbPaths(java.util.Collection<DbPath> dbPaths)
A list of paths where SST files can be put into, with its target size.
|
Options |
setDbWriteBufferSize(long dbWriteBufferSize)
Amount of data to build up in memtables across all column
families before writing to disk.
|
Options |
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. |
Options |
setDeleteObsoleteFilesPeriodMicros(long micros)
The periodicity when obsolete files get deleted.
|
Options |
setDisableAutoCompactions(boolean disableAutoCompactions)
Disable automatic compactions.
|
Options |
setDumpMallocStats(boolean dumpMallocStats)
If true, then print malloc stats together with rocksdb.stats
when printing to LOG.
|
Options |
setEnableThreadTracking(boolean enableThreadTracking)
If true, then the status of the threads involved in this DB will
be tracked and available via GetThreadList() API.
|
Options |
setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
If true, threads synchronizing with the write batch group leader will
wait for up to
DBOptionsInterface.writeThreadMaxYieldUsec() before blocking on a
mutex. |
Options |
setEnv(Env env)
Use the specified object to interact with the environment,
e.g.
|
Options |
setErrorIfExists(boolean errorIfExists)
If true, an error will be thrown during RocksDB.open() if the
database already exists.
|
Options |
setFailIfOptionsFileError(boolean failIfOptionsFileError)
If true, then DB::Open / CreateColumnFamily / DropColumnFamily
/ SetOptions will fail if options file is not detected or properly
persisted.
|
Options |
setForceConsistencyChecks(boolean forceConsistencyChecks)
In debug mode, RocksDB run consistency checks on the LSM everytime the LSM
change (Flush, Compaction, AddFile).
|
Options |
setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)
All writes are stopped if estimated bytes needed to be compaction exceed
this threshold.
|
Options |
setIncreaseParallelism(int totalThreads)
By default, RocksDB uses only one background thread for flush and
compaction.
|
Options |
setInfoLogLevel(InfoLogLevel infoLogLevel)
Sets the RocksDB log level.
|
Options |
setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
Number of locks used for inplace update
Default: 10000, if inplace_update_support = true, else 0.
|
Options |
setInplaceUpdateSupport(boolean inplaceUpdateSupport)
Allows thread-safe inplace updates.
|
Options |
setIsFdCloseOnExec(boolean isFdCloseOnExec)
Disable child process inherit open files.
|
Options |
setKeepLogFileNum(long keepLogFileNum)
Specifies the maximum number of info log files to be kept.
|
Options |
setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger)
Number of files to trigger level-0 compaction.
|
Options |
setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger)
Soft limit on number of level-0 files.
|
Options |
setLevel0StopWritesTrigger(int level0StopWritesTrigger)
Maximum number of level-0 files.
|
Options |
setLevelCompactionDynamicLevelBytes(boolean enableLevelCompactionDynamicLevelBytes)
If
true , RocksDB will pick target size of each level
dynamically. |
Options |
setLevelZeroFileNumCompactionTrigger(int numFiles)
Number of files to trigger level-0 compaction.
|
Options |
setLevelZeroSlowdownWritesTrigger(int numFiles)
Soft limit on number of level-0 files.
|
Options |
setLevelZeroStopWritesTrigger(int numFiles)
Maximum number of level-0 files.
|
Options |
setLogFileTimeToRoll(long logFileTimeToRoll)
Specifies the time interval for the info log file to roll (in seconds).
|
Options |
setLogger(Logger logger)
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.
|
Options |
setManifestPreallocationSize(long size)
Number of bytes to preallocate (via fallocate) the manifest
files.
|
Options |
setMaxBackgroundCompactions(int maxBackgroundCompactions)
Specifies the maximum number of concurrent background compaction jobs,
submitted to the default LOW priority thread pool.
|
Options |
setMaxBackgroundFlushes(int maxBackgroundFlushes)
Specifies the maximum number of concurrent background flush jobs.
|
Options |
setMaxBackgroundJobs(int maxBackgroundJobs)
Specifies the maximum number of concurrent background jobs (both flushes
and compactions combined).
|
Options |
setMaxBytesForLevelBase(long maxBytesForLevelBase)
The upper-bound of the total size of level-1 files in bytes.
|
Options |
setMaxBytesForLevelMultiplier(double multiplier)
The ratio between the total size of level-(L+1) files and the total
size of level-L files for all L.
|
Options |
setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional)
Different max-size multipliers for different levels.
|
Options |
setMaxCompactionBytes(long maxCompactionBytes)
Maximum size of each compaction (not guarantee)
|
Options |
setMaxFileOpeningThreads(int maxFileOpeningThreads)
If
DBOptionsInterface.maxOpenFiles() is -1, DB will open all files on DB::Open(). |
Options |
setMaxLogFileSize(long maxLogFileSize)
Specifies the maximum size of a info log file.
|
Options |
setMaxManifestFileSize(long maxManifestFileSize)
Manifest file is rolled over on reaching this limit.
|
Options |
setMaxOpenFiles(int maxOpenFiles)
Number of open files that can be used by the DB.
|
Options |
setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations)
An iteration->Next() sequentially skips over keys with the same
user-key unless this option is set.
|
void |
setMaxSubcompactions(int maxSubcompactions)
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.
|
Options |
setMaxSuccessiveMerges(long maxSuccessiveMerges)
Maximum number of successive merge operations on a key in the memtable.
|
Options |
setMaxTableFilesSizeFIFO(long maxTableFilesSize)
FIFO compaction option.
|
Options |
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.
|
Options |
setMaxWriteBufferNumber(int maxWriteBufferNumber)
The maximum number of write buffers that are built up in memory.
|
Options |
setMaxWriteBufferNumberToMaintain(int maxWriteBufferNumberToMaintain)
The total maximum number of write buffers to maintain in memory including
copies of buffers that have already been flushed.
|
Options |
setMemTableConfig(MemTableConfig config)
Set the config for mem-table.
|
Options |
setMemtableHugePageSize(long memtableHugePageSize)
Page size for huge page TLB for bloom in memtable.
|
Options |
setMemtablePrefixBloomSizeRatio(double memtablePrefixBloomSizeRatio)
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.
|
Options |
setMergeOperator(MergeOperator mergeOperator)
Set the merge operator to be used for merging two different key/value
pairs that share the same key.
|
Options |
setMergeOperatorName(java.lang.String name)
Set the merge operator to be used for merging two merge operands
of the same key.
|
Options |
setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)
The minimum number of write buffers that will be merged together
before writing to storage.
|
Options |
setNewTableReaderForCompactionInputs(boolean newTableReaderForCompactionInputs)
If true, always create a new file descriptor and new table reader
for compaction inputs.
|
Options |
setNumLevels(int numLevels)
Set the number of levels for this database
If level-styled compaction is used, then this number determines
the total number of levels.
|
Options |
setOptimizeFiltersForHits(boolean optimizeFiltersForHits)
This flag specifies that the implementation should optimize the filters
mainly for cases where keys are found rather than also optimize for keys
missed.
|
Options |
setParanoidChecks(boolean paranoidChecks)
If true, the implementation will do aggressive checking of the
data it is processing and will stop early if it detects any
errors.
|
Options |
setParanoidFileChecks(boolean paranoidFileChecks)
After writing every SST file, reopen it and read all the keys.
|
Options |
setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
This is a maximum buffer size that is used by WinMmapReadableFile in
unbuffered disk I/O mode.
|
Options |
setRateLimiter(RateLimiter rateLimiter)
Use to control write rate of flush and compaction.
|
Options |
setRecycleLogFileNum(long recycleLogFileNum)
Recycle log files.
|
Options |
setReportBgIoStats(boolean reportBgIoStats)
Measure IO stats in compactions and flushes, if true.
|
Options |
setRowCache(Cache rowCache)
A global cache for table-level rows.
|
Options |
setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
If true, then DB::Open() will not update the statistics used to optimize
compaction decision by loading table properties from many files.
|
Options |
setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit)
All writes will be slowed down to at least delayed_write_rate if estimated
bytes needed to be compaction exceed this threshold.
|
Options |
setStatistics(Statistics statistics)
Sets the statistics object which collects metrics about database operations.
|
Options |
setStatsDumpPeriodSec(int statsDumpPeriodSec)
if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 600 (10 minutes)
|
Options |
setTableCacheNumshardbits(int tableCacheNumshardbits)
Number of shards used for table cache.
|
Options |
setTableFormatConfig(TableFormatConfig config)
Set the config for table format.
|
Options |
setTargetFileSizeBase(long targetFileSizeBase)
The target file size for compaction.
|
Options |
setTargetFileSizeMultiplier(int multiplier)
targetFileSizeMultiplier defines the size ratio between a
level-L file and level-(L+1) file.
|
Options |
setUseAdaptiveMutex(boolean useAdaptiveMutex)
Use adaptive mutex, which spins in the user space before resorting
to kernel.
|
Options |
setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
Enable the OS to use direct reads and writes in flush and
compaction
Default: false
|
Options |
setUseDirectReads(boolean useDirectReads)
Enable the OS to use direct I/O for reading sst tables.
|
Options |
setUseFsync(boolean useFsync)
If true, then every store to stable storage will issue a fsync.
|
Options |
setWalBytesPerSync(long walBytesPerSync)
Same as
DBOptionsInterface.setBytesPerSync(long) , but applies to WAL files
Default: 0, turned off |
Options |
setWalDir(java.lang.String walDir)
This specifies the absolute dir path for write-ahead logs (WAL).
|
Options |
setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
Recovery mode to control the consistency while replaying WAL
Default:
WALRecoveryMode.PointInTimeRecovery |
Options |
setWalSizeLimitMB(long sizeLimitMB)
WalTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted.
|
Options |
setWalTtlSeconds(long walTtlSeconds)
DBOptionsInterface.walTtlSeconds() and DBOptionsInterface.walSizeLimitMB() affect how archived logs
will be deleted. |
Options |
setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
This is the maximum buffer size that is used by WritableFileWriter.
|
Options |
setWriteBufferSize(long writeBufferSize)
Amount of data to build up in memory (backed by an unsorted log
on disk) before converting to a sorted on-disk file.
|
Options |
setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
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.
|
Options |
setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
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.
|
boolean |
skipStatsUpdateOnDbOpen()
If true, then DB::Open() will not update the statistics used to optimize
compaction decision by loading table properties from many files.
|
long |
softPendingCompactionBytesLimit()
All writes will be slowed down to at least delayed_write_rate if estimated
bytes needed to be compaction exceed this threshold.
|
Statistics |
statistics()
Returns statistics object.
|
int |
statsDumpPeriodSec()
If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 600 (10 minutes)
|
int |
tableCacheNumshardbits()
Number of shards used for table cache.
|
java.lang.String |
tableFactoryName() |
TableFormatConfig |
tableFormatConfig()
Get the config for table format.
|
long |
targetFileSizeBase()
The target file size for compaction.
|
int |
targetFileSizeMultiplier()
targetFileSizeMultiplier defines the size ratio between a
level-(L+1) file and level-L file.
|
boolean |
useAdaptiveMutex()
Use adaptive mutex, which spins in the user space before resorting
to kernel.
|
Options |
useCappedPrefixExtractor(int n)
Same as fixed length prefix extractor, except that when slice is
shorter than the fixed length, it will use the full key.
|
boolean |
useDirectIoForFlushAndCompaction()
Enable the OS to use direct reads and writes in flush and
compaction
|
boolean |
useDirectReads()
Enable the OS to use direct I/O for reading sst tables.
|
Options |
useFixedLengthPrefixExtractor(int n)
This prefix-extractor uses the first n bytes of a key as its prefix.
|
boolean |
useFsync()
If true, then every store to stable storage will issue a fsync.
|
long |
walBytesPerSync()
Same as
DBOptionsInterface.bytesPerSync() , but applies to WAL files
Default: 0, turned off |
java.lang.String |
walDir()
Returns the path to the write-ahead-logs (WAL) directory.
|
WALRecoveryMode |
walRecoveryMode()
Recovery mode to control the consistency while replaying WAL
Default:
WALRecoveryMode.PointInTimeRecovery |
long |
walSizeLimitMB()
DBOptionsInterface.walTtlSeconds() and #walSizeLimitMB() affect how archived logs
will be deleted. |
long |
walTtlSeconds()
WalTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted.
|
long |
writableFileMaxBufferSize()
This is the maximum buffer size that is used by WritableFileWriter.
|
long |
writeBufferSize()
Return size of write buffer size.
|
long |
writeThreadMaxYieldUsec()
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.
|
long |
writeThreadSlowYieldUsec()
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.
|
disposeInternal
close, disOwnNativeHandle, isOwningHandle
dispose, finalize
public Options()
rocksdb::Options
in the c++ side.public Options(DBOptions dbOptions, ColumnFamilyOptions columnFamilyOptions)
dbOptions
- DBOptions
instancecolumnFamilyOptions
- ColumnFamilyOptions
instancepublic Options setIncreaseParallelism(int totalThreads)
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.
setIncreaseParallelism
in interface DBOptionsInterface<Options>
totalThreads
- The total number of threads to be used by RocksDB.
A good value is the number of cores.public Options setCreateIfMissing(boolean flag)
DBOptionsInterface
RocksDB.open()
.
Default: falsesetCreateIfMissing
in interface DBOptionsInterface<Options>
flag
- a flag indicating whether to create a database the
specified database in RocksDB.open(org.rocksdb.Options, String)
operation
is missing.RocksDB.open(org.rocksdb.Options, String)
public Options setCreateMissingColumnFamilies(boolean flag)
DBOptionsInterface
If true, missing column families will be automatically created
Default: false
setCreateMissingColumnFamilies
in interface DBOptionsInterface<Options>
flag
- a flag indicating if missing column families shall be
created automatically.public Options setEnv(Env env)
DBOptionsInterface
Env.getDefault()
setEnv
in interface DBOptionsInterface<Options>
env
- Env
instance.public Env getEnv()
DBOptionsInterface
getEnv
in interface DBOptionsInterface<Options>
RocksEnv
instance set in the options.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.
public boolean createIfMissing()
DBOptionsInterface
createIfMissing
in interface DBOptionsInterface<Options>
DBOptionsInterface.setCreateIfMissing(boolean)
public boolean createMissingColumnFamilies()
DBOptionsInterface
createMissingColumnFamilies
in interface DBOptionsInterface<Options>
DBOptionsInterface.setCreateMissingColumnFamilies(boolean)
public Options optimizeForSmallDb()
DBOptionsInterface
optimizeForSmallDb
in interface ColumnFamilyOptionsInterface<Options>
optimizeForSmallDb
in interface DBOptionsInterface<Options>
public Options optimizeForPointLookup(long blockCacheSizeMb)
ColumnFamilyOptionsInterface
optimizeForPointLookup
in interface ColumnFamilyOptionsInterface<Options>
blockCacheSizeMb
- Block cache size in MBpublic Options optimizeLevelStyleCompaction()
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
optimizeLevelStyleCompaction
in interface ColumnFamilyOptionsInterface<Options>
public Options optimizeLevelStyleCompaction(long memtableMemoryBudget)
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
optimizeLevelStyleCompaction
in interface ColumnFamilyOptionsInterface<Options>
memtableMemoryBudget
- memory budget in bytespublic Options optimizeUniversalStyleCompaction()
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
optimizeUniversalStyleCompaction
in interface ColumnFamilyOptionsInterface<Options>
public Options optimizeUniversalStyleCompaction(long memtableMemoryBudget)
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
optimizeUniversalStyleCompaction
in interface ColumnFamilyOptionsInterface<Options>
memtableMemoryBudget
- memory budget in bytespublic Options setComparator(BuiltinComparator builtinComparator)
ColumnFamilyOptionsInterface
BuiltinComparator
to be used with RocksDB.
Note: Comparator can be set once upon database creation.
Default: BytewiseComparator.setComparator
in interface ColumnFamilyOptionsInterface<Options>
builtinComparator
- a BuiltinComparator
type.public Options setComparator(AbstractComparator<? extends AbstractSlice<?>> comparator)
ColumnFamilyOptionsInterface
setComparator
in interface ColumnFamilyOptionsInterface<Options>
comparator
- java instance.public Options setMergeOperatorName(java.lang.String name)
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.
setMergeOperatorName
in interface ColumnFamilyOptionsInterface<Options>
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".public Options setMergeOperator(MergeOperator mergeOperator)
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.
setMergeOperator
in interface ColumnFamilyOptionsInterface<Options>
mergeOperator
- MergeOperator
instance.public Options setWriteBufferSize(long writeBufferSize)
MutableColumnFamilyOptionsInterface
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: 4MBsetWriteBufferSize
in interface MutableColumnFamilyOptionsInterface<Options>
writeBufferSize
- the size of write buffer.public long writeBufferSize()
MutableColumnFamilyOptionsInterface
writeBufferSize
in interface MutableColumnFamilyOptionsInterface<Options>
MutableColumnFamilyOptionsInterface.setWriteBufferSize(long)
public Options setMaxWriteBufferNumber(int maxWriteBufferNumber)
AdvancedMutableColumnFamilyOptionsInterface
setMaxWriteBufferNumber
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
maxWriteBufferNumber
- maximum number of write buffers.public int maxWriteBufferNumber()
AdvancedMutableColumnFamilyOptionsInterface
maxWriteBufferNumber
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
AdvancedMutableColumnFamilyOptionsInterface.setMaxWriteBufferNumber(int)
public boolean errorIfExists()
DBOptionsInterface
errorIfExists
in interface DBOptionsInterface<Options>
public Options setErrorIfExists(boolean errorIfExists)
DBOptionsInterface
setErrorIfExists
in interface DBOptionsInterface<Options>
errorIfExists
- if true, an exception will be thrown
during RocksDB.open()
if the database already exists.RocksDB.open(org.rocksdb.Options, String)
public boolean paranoidChecks()
DBOptionsInterface
paranoidChecks
in interface DBOptionsInterface<Options>
public Options setParanoidChecks(boolean paranoidChecks)
DBOptionsInterface
setParanoidChecks
in interface DBOptionsInterface<Options>
paranoidChecks
- a flag to indicate whether paranoid-check
is on.public int maxOpenFiles()
DBOptionsInterface
target_file_size_base
and target_file_size_multiplier
for level-based compaction. For universal-style compaction, you can usually
set it to -1.maxOpenFiles
in interface DBOptionsInterface<Options>
public Options setMaxFileOpeningThreads(int maxFileOpeningThreads)
DBOptionsInterface
DBOptionsInterface.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: 16setMaxFileOpeningThreads
in interface DBOptionsInterface<Options>
maxFileOpeningThreads
- the maximum number of threads to use to
open filespublic int maxFileOpeningThreads()
DBOptionsInterface
DBOptionsInterface.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: 16maxFileOpeningThreads
in interface DBOptionsInterface<Options>
public Options setMaxTotalWalSize(long maxTotalWalSize)
DBOptionsInterface
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
Default: 0
setMaxTotalWalSize
in interface DBOptionsInterface<Options>
maxTotalWalSize
- max total wal size.public long maxTotalWalSize()
DBOptionsInterface
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
maxTotalWalSize
in interface DBOptionsInterface<Options>
public Options setMaxOpenFiles(int maxOpenFiles)
DBOptionsInterface
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: 5000setMaxOpenFiles
in interface DBOptionsInterface<Options>
maxOpenFiles
- the maximum number of open files.public boolean useFsync()
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.
useFsync
in interface DBOptionsInterface<Options>
public Options setUseFsync(boolean useFsync)
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
setUseFsync
in interface DBOptionsInterface<Options>
useFsync
- a boolean flag to specify whether to use fsyncpublic Options setDbPaths(java.util.Collection<DbPath> dbPaths)
DBOptionsInterface
setDbPaths
in interface DBOptionsInterface<Options>
dbPaths
- the paths and target sizespublic java.util.List<DbPath> dbPaths()
DBOptionsInterface
Collections.emptyList()
dbPaths
in interface DBOptionsInterface<Options>
public java.lang.String dbLogDir()
DBOptionsInterface
dbLogDir
in interface DBOptionsInterface<Options>
public Options setDbLogDir(java.lang.String dbLogDir)
DBOptionsInterface
setDbLogDir
in interface DBOptionsInterface<Options>
dbLogDir
- the path to the info log directorypublic java.lang.String walDir()
DBOptionsInterface
walDir
in interface DBOptionsInterface<Options>
public Options setWalDir(java.lang.String walDir)
DBOptionsInterface
setWalDir
in interface DBOptionsInterface<Options>
walDir
- the path to the write-ahead-log directory.public long deleteObsoleteFilesPeriodMicros()
DBOptionsInterface
deleteObsoleteFilesPeriodMicros
in interface DBOptionsInterface<Options>
public Options setDeleteObsoleteFilesPeriodMicros(long micros)
DBOptionsInterface
setDeleteObsoleteFilesPeriodMicros
in interface DBOptionsInterface<Options>
micros
- the time interval in microspublic int maxBackgroundCompactions()
DBOptionsInterface
maxBackgroundCompactions
in interface DBOptionsInterface<Options>
Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
public Options setStatistics(Statistics statistics)
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.
setStatistics
in interface DBOptionsInterface<Options>
RocksDB.open(org.rocksdb.Options, String)
public Statistics statistics()
DBOptionsInterface
Returns statistics object.
statistics
in interface DBOptionsInterface<Options>
DBOptionsInterface.setStatistics(Statistics)
public void setBaseBackgroundCompactions(int baseBackgroundCompactions)
DBOptionsInterface
setBaseBackgroundCompactions
in interface DBOptionsInterface<Options>
baseBackgroundCompactions
- Suggested number of background compaction
jobspublic int baseBackgroundCompactions()
DBOptionsInterface
baseBackgroundCompactions
in interface DBOptionsInterface<Options>
public Options setMaxBackgroundCompactions(int maxBackgroundCompactions)
DBOptionsInterface
setMaxBackgroundCompactions
in interface DBOptionsInterface<Options>
maxBackgroundCompactions
- the maximum number of background
compaction jobs.Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
,
DBOptionsInterface.maxBackgroundFlushes()
public void setMaxSubcompactions(int maxSubcompactions)
DBOptionsInterface
setMaxSubcompactions
in interface DBOptionsInterface<Options>
maxSubcompactions
- The maximum number of threads that will
concurrently perform a compaction jobpublic int maxSubcompactions()
DBOptionsInterface
maxSubcompactions
in interface DBOptionsInterface<Options>
public int maxBackgroundFlushes()
DBOptionsInterface
maxBackgroundFlushes
in interface DBOptionsInterface<Options>
Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
public Options setMaxBackgroundFlushes(int maxBackgroundFlushes)
DBOptionsInterface
setMaxBackgroundFlushes
in interface DBOptionsInterface<Options>
maxBackgroundFlushes
- number of max concurrent flush jobsEnv.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
,
DBOptionsInterface.maxBackgroundCompactions()
public int maxBackgroundJobs()
DBOptionsInterface
maxBackgroundJobs
in interface DBOptionsInterface<Options>
public Options setMaxBackgroundJobs(int maxBackgroundJobs)
DBOptionsInterface
setMaxBackgroundJobs
in interface DBOptionsInterface<Options>
maxBackgroundJobs
- number of max concurrent background jobspublic long maxLogFileSize()
DBOptionsInterface
maxLogFileSize
in interface DBOptionsInterface<Options>
public Options setMaxLogFileSize(long maxLogFileSize)
DBOptionsInterface
setMaxLogFileSize
in interface DBOptionsInterface<Options>
maxLogFileSize
- the maximum size of a info log file.public long logFileTimeToRoll()
DBOptionsInterface
logFileTimeToRoll
in interface DBOptionsInterface<Options>
public Options setLogFileTimeToRoll(long logFileTimeToRoll)
DBOptionsInterface
setLogFileTimeToRoll
in interface DBOptionsInterface<Options>
logFileTimeToRoll
- the time interval in seconds.public long keepLogFileNum()
DBOptionsInterface
keepLogFileNum
in interface DBOptionsInterface<Options>
public Options setKeepLogFileNum(long keepLogFileNum)
DBOptionsInterface
setKeepLogFileNum
in interface DBOptionsInterface<Options>
keepLogFileNum
- the maximum number of info log files to be kept.public Options setRecycleLogFileNum(long recycleLogFileNum)
DBOptionsInterface
setRecycleLogFileNum
in interface DBOptionsInterface<Options>
recycleLogFileNum
- the number of log files to keep for recyclingpublic long recycleLogFileNum()
DBOptionsInterface
recycleLogFileNum
in interface DBOptionsInterface<Options>
public long maxManifestFileSize()
DBOptionsInterface
maxManifestFileSize
in interface DBOptionsInterface<Options>
public Options setMaxManifestFileSize(long maxManifestFileSize)
DBOptionsInterface
setMaxManifestFileSize
in interface DBOptionsInterface<Options>
maxManifestFileSize
- the size limit of a manifest file.public Options setMaxTableFilesSizeFIFO(long maxTableFilesSize)
ColumnFamilyOptionsInterface
setMaxTableFilesSizeFIFO
in interface ColumnFamilyOptionsInterface<Options>
maxTableFilesSize
- the size limit of the total sum of table files.public long maxTableFilesSizeFIFO()
ColumnFamilyOptionsInterface
maxTableFilesSizeFIFO
in interface ColumnFamilyOptionsInterface<Options>
public int tableCacheNumshardbits()
DBOptionsInterface
tableCacheNumshardbits
in interface DBOptionsInterface<Options>
public Options setTableCacheNumshardbits(int tableCacheNumshardbits)
DBOptionsInterface
setTableCacheNumshardbits
in interface DBOptionsInterface<Options>
tableCacheNumshardbits
- the number of chardspublic long walTtlSeconds()
DBOptionsInterface
walTtlSeconds
in interface DBOptionsInterface<Options>
DBOptionsInterface.walSizeLimitMB()
public Options setWalTtlSeconds(long walTtlSeconds)
DBOptionsInterface
DBOptionsInterface.walTtlSeconds()
and DBOptionsInterface.walSizeLimitMB()
affect how archived logs
will be deleted.
setWalTtlSeconds
in interface DBOptionsInterface<Options>
walTtlSeconds
- the ttl secondsDBOptionsInterface.setWalSizeLimitMB(long)
public long walSizeLimitMB()
DBOptionsInterface
DBOptionsInterface.walTtlSeconds()
and #walSizeLimitMB()
affect how archived logs
will be deleted.
walSizeLimitMB
in interface DBOptionsInterface<Options>
DBOptionsInterface.walSizeLimitMB()
public Options setWalSizeLimitMB(long sizeLimitMB)
DBOptionsInterface
setWalSizeLimitMB
in interface DBOptionsInterface<Options>
sizeLimitMB
- size limit in mega-bytes.DBOptionsInterface.setWalSizeLimitMB(long)
public long manifestPreallocationSize()
DBOptionsInterface
manifestPreallocationSize
in interface DBOptionsInterface<Options>
public Options setManifestPreallocationSize(long size)
DBOptionsInterface
setManifestPreallocationSize
in interface DBOptionsInterface<Options>
size
- the size in bytepublic Options setUseDirectReads(boolean useDirectReads)
DBOptionsInterface
setUseDirectReads
in interface DBOptionsInterface<Options>
useDirectReads
- if true, then direct read is enabledpublic boolean useDirectReads()
DBOptionsInterface
useDirectReads
in interface DBOptionsInterface<Options>
public Options setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
DBOptionsInterface
setUseDirectIoForFlushAndCompaction
in interface DBOptionsInterface<Options>
useDirectIoForFlushAndCompaction
- if true, then direct
I/O will be enabled for background flush and compactionspublic boolean useDirectIoForFlushAndCompaction()
DBOptionsInterface
useDirectIoForFlushAndCompaction
in interface DBOptionsInterface<Options>
public Options setAllowFAllocate(boolean allowFAllocate)
DBOptionsInterface
setAllowFAllocate
in interface DBOptionsInterface<Options>
allowFAllocate
- false if fallocate() calls are bypassedpublic boolean allowFAllocate()
DBOptionsInterface
allowFAllocate
in interface DBOptionsInterface<Options>
public boolean allowMmapReads()
DBOptionsInterface
allowMmapReads
in interface DBOptionsInterface<Options>
public Options setAllowMmapReads(boolean allowMmapReads)
DBOptionsInterface
setAllowMmapReads
in interface DBOptionsInterface<Options>
allowMmapReads
- true if mmap reads are allowed.public boolean allowMmapWrites()
DBOptionsInterface
allowMmapWrites
in interface DBOptionsInterface<Options>
public Options setAllowMmapWrites(boolean allowMmapWrites)
DBOptionsInterface
setAllowMmapWrites
in interface DBOptionsInterface<Options>
allowMmapWrites
- true if mmap writes are allowd.public boolean isFdCloseOnExec()
DBOptionsInterface
isFdCloseOnExec
in interface DBOptionsInterface<Options>
public Options setIsFdCloseOnExec(boolean isFdCloseOnExec)
DBOptionsInterface
setIsFdCloseOnExec
in interface DBOptionsInterface<Options>
isFdCloseOnExec
- true if child process inheriting open
files is disabled.public int statsDumpPeriodSec()
DBOptionsInterface
statsDumpPeriodSec
in interface DBOptionsInterface<Options>
public Options setStatsDumpPeriodSec(int statsDumpPeriodSec)
DBOptionsInterface
setStatsDumpPeriodSec
in interface DBOptionsInterface<Options>
statsDumpPeriodSec
- time interval in seconds.public boolean adviseRandomOnOpen()
DBOptionsInterface
adviseRandomOnOpen
in interface DBOptionsInterface<Options>
public Options setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
DBOptionsInterface
setAdviseRandomOnOpen
in interface DBOptionsInterface<Options>
adviseRandomOnOpen
- true if hinting random access is on.public Options setDbWriteBufferSize(long dbWriteBufferSize)
DBOptionsInterface
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)setDbWriteBufferSize
in interface DBOptionsInterface<Options>
dbWriteBufferSize
- the size of the write bufferpublic long dbWriteBufferSize()
DBOptionsInterface
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)dbWriteBufferSize
in interface DBOptionsInterface<Options>
public Options setAccessHintOnCompactionStart(AccessHint accessHint)
DBOptionsInterface
AccessHint.NORMAL
setAccessHintOnCompactionStart
in interface DBOptionsInterface<Options>
accessHint
- The access hintpublic AccessHint accessHintOnCompactionStart()
DBOptionsInterface
AccessHint.NORMAL
accessHintOnCompactionStart
in interface DBOptionsInterface<Options>
public Options setNewTableReaderForCompactionInputs(boolean newTableReaderForCompactionInputs)
DBOptionsInterface
BlockBasedTableConfig.cacheIndexAndFilterBlocks()
for this mode if using block-based table.
Default: falsesetNewTableReaderForCompactionInputs
in interface DBOptionsInterface<Options>
newTableReaderForCompactionInputs
- true if a new file descriptor and
table reader should be created for compaction inputspublic boolean newTableReaderForCompactionInputs()
DBOptionsInterface
BlockBasedTableConfig.cacheIndexAndFilterBlocks()
for this mode if using block-based table.
Default: falsenewTableReaderForCompactionInputs
in interface DBOptionsInterface<Options>
public Options setCompactionReadaheadSize(long compactionReadaheadSize)
DBOptionsInterface
DBOptionsInterface.newTableReaderForCompactionInputs()
to true.
Default: 0setCompactionReadaheadSize
in interface DBOptionsInterface<Options>
compactionReadaheadSize
- The compaction read-ahead sizepublic long compactionReadaheadSize()
DBOptionsInterface
DBOptionsInterface.newTableReaderForCompactionInputs()
to true.
Default: 0compactionReadaheadSize
in interface DBOptionsInterface<Options>
public Options setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
DBOptionsInterface
DBOptionsInterface.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.setRandomAccessMaxBufferSize
in interface DBOptionsInterface<Options>
randomAccessMaxBufferSize
- the maximum size of the random access
bufferpublic long randomAccessMaxBufferSize()
DBOptionsInterface
DBOptionsInterface.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.randomAccessMaxBufferSize
in interface DBOptionsInterface<Options>
public Options setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
DBOptionsInterface
setWritableFileMaxBufferSize
in interface DBOptionsInterface<Options>
writableFileMaxBufferSize
- the maximum buffer sizepublic long writableFileMaxBufferSize()
DBOptionsInterface
writableFileMaxBufferSize
in interface DBOptionsInterface<Options>
public boolean useAdaptiveMutex()
DBOptionsInterface
useAdaptiveMutex
in interface DBOptionsInterface<Options>
public Options setUseAdaptiveMutex(boolean useAdaptiveMutex)
DBOptionsInterface
setUseAdaptiveMutex
in interface DBOptionsInterface<Options>
useAdaptiveMutex
- true if adaptive mutex is used.public long bytesPerSync()
DBOptionsInterface
bytesPerSync
in interface DBOptionsInterface<Options>
public Options setBytesPerSync(long bytesPerSync)
DBOptionsInterface
setBytesPerSync
in interface DBOptionsInterface<Options>
bytesPerSync
- size in bytespublic Options setWalBytesPerSync(long walBytesPerSync)
DBOptionsInterface
DBOptionsInterface.setBytesPerSync(long)
, but applies to WAL files
Default: 0, turned offsetWalBytesPerSync
in interface DBOptionsInterface<Options>
walBytesPerSync
- size in bytespublic long walBytesPerSync()
DBOptionsInterface
DBOptionsInterface.bytesPerSync()
, but applies to WAL files
Default: 0, turned offwalBytesPerSync
in interface DBOptionsInterface<Options>
public Options setEnableThreadTracking(boolean enableThreadTracking)
DBOptionsInterface
setEnableThreadTracking
in interface DBOptionsInterface<Options>
enableThreadTracking
- true to enable trackingpublic boolean enableThreadTracking()
DBOptionsInterface
enableThreadTracking
in interface DBOptionsInterface<Options>
public Options setDelayedWriteRate(long delayedWriteRate)
DBOptionsInterface
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.
Unit: bytes per second.
Default: 16MB/ssetDelayedWriteRate
in interface DBOptionsInterface<Options>
delayedWriteRate
- the rate in bytes per secondpublic long delayedWriteRate()
DBOptionsInterface
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.
Unit: bytes per second.
Default: 16MB/sdelayedWriteRate
in interface DBOptionsInterface<Options>
public Options setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
DBOptionsInterface
DBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean)
if you are going to use
this feature.
Default: falsesetAllowConcurrentMemtableWrite
in interface DBOptionsInterface<Options>
allowConcurrentMemtableWrite
- true to enable concurrent writes
for the memtablepublic boolean allowConcurrentMemtableWrite()
DBOptionsInterface
DBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean)
if you are going to use
this feature.
Default: falseallowConcurrentMemtableWrite
in interface DBOptionsInterface<Options>
public Options setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
DBOptionsInterface
DBOptionsInterface.writeThreadMaxYieldUsec()
before blocking on a
mutex. This can substantially improve throughput for concurrent workloads,
regardless of whether DBOptionsInterface.allowConcurrentMemtableWrite()
is enabled.
Default: falsesetEnableWriteThreadAdaptiveYield
in interface DBOptionsInterface<Options>
enableWriteThreadAdaptiveYield
- true to enable adaptive yield for the
write threadspublic boolean enableWriteThreadAdaptiveYield()
DBOptionsInterface
DBOptionsInterface.writeThreadMaxYieldUsec()
before blocking on a
mutex. This can substantially improve throughput for concurrent workloads,
regardless of whether DBOptionsInterface.allowConcurrentMemtableWrite()
is enabled.
Default: falseenableWriteThreadAdaptiveYield
in interface DBOptionsInterface<Options>
public Options setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
DBOptionsInterface
DBOptionsInterface.writeThreadSlowYieldUsec()
is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100setWriteThreadMaxYieldUsec
in interface DBOptionsInterface<Options>
writeThreadMaxYieldUsec
- maximum number of microsecondspublic long writeThreadMaxYieldUsec()
DBOptionsInterface
DBOptionsInterface.writeThreadSlowYieldUsec()
is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100writeThreadMaxYieldUsec
in interface DBOptionsInterface<Options>
public Options setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
DBOptionsInterface
setWriteThreadSlowYieldUsec
in interface DBOptionsInterface<Options>
writeThreadSlowYieldUsec
- the latency in microsecondspublic long writeThreadSlowYieldUsec()
DBOptionsInterface
writeThreadSlowYieldUsec
in interface DBOptionsInterface<Options>
public Options setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
DBOptionsInterface
setSkipStatsUpdateOnDbOpen
in interface DBOptionsInterface<Options>
skipStatsUpdateOnDbOpen
- true if updating stats will be skippedpublic boolean skipStatsUpdateOnDbOpen()
DBOptionsInterface
skipStatsUpdateOnDbOpen
in interface DBOptionsInterface<Options>
public Options setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
DBOptionsInterface
WALRecoveryMode.PointInTimeRecovery
setWalRecoveryMode
in interface DBOptionsInterface<Options>
walRecoveryMode
- The WAL recover modepublic WALRecoveryMode walRecoveryMode()
DBOptionsInterface
WALRecoveryMode.PointInTimeRecovery
walRecoveryMode
in interface DBOptionsInterface<Options>
public Options setAllow2pc(boolean allow2pc)
DBOptionsInterface
setAllow2pc
in interface DBOptionsInterface<Options>
allow2pc
- true if two-phase-commit is enabledpublic boolean allow2pc()
DBOptionsInterface
allow2pc
in interface DBOptionsInterface<Options>
public Options setRowCache(Cache rowCache)
DBOptionsInterface
setRowCache
in interface DBOptionsInterface<Options>
rowCache
- The global row cachepublic Cache rowCache()
DBOptionsInterface
rowCache
in interface DBOptionsInterface<Options>
public Options setFailIfOptionsFileError(boolean failIfOptionsFileError)
DBOptionsInterface
setFailIfOptionsFileError
in interface DBOptionsInterface<Options>
failIfOptionsFileError
- true if we should fail if there is an error
in the options filepublic boolean failIfOptionsFileError()
DBOptionsInterface
failIfOptionsFileError
in interface DBOptionsInterface<Options>
public Options setDumpMallocStats(boolean dumpMallocStats)
DBOptionsInterface
setDumpMallocStats
in interface DBOptionsInterface<Options>
dumpMallocStats
- true if malloc stats should be printed to LOGpublic boolean dumpMallocStats()
DBOptionsInterface
dumpMallocStats
in interface DBOptionsInterface<Options>
public Options setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
DBOptionsInterface
setAvoidFlushDuringRecovery
in interface DBOptionsInterface<Options>
avoidFlushDuringRecovery
- true to try to avoid (but not guarantee
not to) flush during recoverypublic boolean avoidFlushDuringRecovery()
DBOptionsInterface
avoidFlushDuringRecovery
in interface DBOptionsInterface<Options>
public Options setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
DBOptionsInterface
RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
API.setAvoidFlushDuringShutdown
in interface DBOptionsInterface<Options>
avoidFlushDuringShutdown
- true if we should avoid flush during
shutdownpublic boolean avoidFlushDuringShutdown()
DBOptionsInterface
RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
API.avoidFlushDuringShutdown
in interface DBOptionsInterface<Options>
public MemTableConfig memTableConfig()
ColumnFamilyOptionsInterface
memTableConfig
in interface ColumnFamilyOptionsInterface<Options>
public Options setMemTableConfig(MemTableConfig config)
ColumnFamilyOptionsInterface
setMemTableConfig
in interface ColumnFamilyOptionsInterface<Options>
config
- the mem-table config.public Options setRateLimiter(RateLimiter rateLimiter)
DBOptionsInterface
setRateLimiter
in interface DBOptionsInterface<Options>
rateLimiter
- RateLimiter
instance.public Options setLogger(Logger logger)
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
setLogger
in interface DBOptionsInterface<Options>
logger
- Logger
instance.public Options setInfoLogLevel(InfoLogLevel infoLogLevel)
DBOptionsInterface
Sets the RocksDB log level. Default level is INFO
setInfoLogLevel
in interface DBOptionsInterface<Options>
infoLogLevel
- log level to set.public InfoLogLevel infoLogLevel()
DBOptionsInterface
Returns currently set log level.
infoLogLevel
in interface DBOptionsInterface<Options>
InfoLogLevel
instance.public java.lang.String memTableFactoryName()
ColumnFamilyOptionsInterface
memTableFactoryName
in interface ColumnFamilyOptionsInterface<Options>
ColumnFamilyOptionsInterface.setTableFormatConfig(org.rocksdb.TableFormatConfig)
public TableFormatConfig tableFormatConfig()
ColumnFamilyOptionsInterface
tableFormatConfig
in interface ColumnFamilyOptionsInterface<Options>
public Options setTableFormatConfig(TableFormatConfig config)
ColumnFamilyOptionsInterface
setTableFormatConfig
in interface ColumnFamilyOptionsInterface<Options>
config
- the table format config.public java.lang.String tableFactoryName()
tableFactoryName
in interface ColumnFamilyOptionsInterface<Options>
public Options useFixedLengthPrefixExtractor(int n)
ColumnFamilyOptionsInterface
useFixedLengthPrefixExtractor
in interface ColumnFamilyOptionsInterface<Options>
n
- use the first n bytes of a key as its prefix.public Options useCappedPrefixExtractor(int n)
ColumnFamilyOptionsInterface
useCappedPrefixExtractor
in interface ColumnFamilyOptionsInterface<Options>
n
- use the first n bytes of a key as its prefix.public CompressionType compressionType()
MutableColumnFamilyOptionsInterface
compressionType
in interface MutableColumnFamilyOptionsInterface<Options>
public Options setCompressionPerLevel(java.util.List<CompressionType> compressionLevels)
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'.
NOTICEIf 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>0
, compression_per_level[i]
determines compaction type for level n+i-1
.
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
setCompressionPerLevel
in interface AdvancedColumnFamilyOptionsInterface<Options>
compressionLevels
- list of
CompressionType
instances.public java.util.List<CompressionType> compressionPerLevel()
AdvancedColumnFamilyOptionsInterface
Return the currently set CompressionType
per instances.
See: AdvancedColumnFamilyOptionsInterface.setCompressionPerLevel(java.util.List)
compressionPerLevel
in interface AdvancedColumnFamilyOptionsInterface<Options>
CompressionType
instances.public Options setCompressionType(CompressionType compressionType)
MutableColumnFamilyOptionsInterface
setCompressionType
in interface MutableColumnFamilyOptionsInterface<Options>
compressionType
- Compression Type.public Options setBottommostCompressionType(CompressionType bottommostCompressionType)
ColumnFamilyOptionsInterface
CompressionType.DISABLE_COMPRESSION_OPTION
setBottommostCompressionType
in interface ColumnFamilyOptionsInterface<Options>
bottommostCompressionType
- The compression type to use for the
bottommost levelpublic CompressionType bottommostCompressionType()
ColumnFamilyOptionsInterface
CompressionType.DISABLE_COMPRESSION_OPTION
bottommostCompressionType
in interface ColumnFamilyOptionsInterface<Options>
public Options setCompressionOptions(CompressionOptions compressionOptions)
ColumnFamilyOptionsInterface
setCompressionOptions
in interface ColumnFamilyOptionsInterface<Options>
compressionOptions
- The compression optionspublic CompressionOptions compressionOptions()
ColumnFamilyOptionsInterface
compressionOptions
in interface ColumnFamilyOptionsInterface<Options>
public CompactionStyle compactionStyle()
AdvancedColumnFamilyOptionsInterface
compactionStyle
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setCompactionStyle(CompactionStyle compactionStyle)
AdvancedColumnFamilyOptionsInterface
setCompactionStyle
in interface AdvancedColumnFamilyOptionsInterface<Options>
compactionStyle
- Compaction style.public int numLevels()
AdvancedColumnFamilyOptionsInterface
numLevels
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setNumLevels(int numLevels)
AdvancedColumnFamilyOptionsInterface
setNumLevels
in interface AdvancedColumnFamilyOptionsInterface<Options>
numLevels
- the number of levels.public int levelZeroFileNumCompactionTrigger()
ColumnFamilyOptionsInterface
levelZeroFileNumCompactionTrigger
in interface ColumnFamilyOptionsInterface<Options>
public Options setLevelZeroFileNumCompactionTrigger(int numFiles)
ColumnFamilyOptionsInterface
setLevelZeroFileNumCompactionTrigger
in interface ColumnFamilyOptionsInterface<Options>
numFiles
- the number of files in level-0 to trigger compaction.public int levelZeroSlowdownWritesTrigger()
ColumnFamilyOptionsInterface
levelZeroSlowdownWritesTrigger
in interface ColumnFamilyOptionsInterface<Options>
public Options setLevelZeroSlowdownWritesTrigger(int numFiles)
ColumnFamilyOptionsInterface
setLevelZeroSlowdownWritesTrigger
in interface ColumnFamilyOptionsInterface<Options>
numFiles
- soft limit on number of level-0 files.public int levelZeroStopWritesTrigger()
ColumnFamilyOptionsInterface
levelZeroStopWritesTrigger
in interface ColumnFamilyOptionsInterface<Options>
public Options setLevelZeroStopWritesTrigger(int numFiles)
ColumnFamilyOptionsInterface
setLevelZeroStopWritesTrigger
in interface ColumnFamilyOptionsInterface<Options>
numFiles
- the hard limit of the number of level-0 files.public long targetFileSizeBase()
AdvancedMutableColumnFamilyOptionsInterface
targetFileSizeBase
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
AdvancedMutableColumnFamilyOptionsInterface.targetFileSizeMultiplier()
public Options setTargetFileSizeBase(long targetFileSizeBase)
AdvancedMutableColumnFamilyOptionsInterface
setTargetFileSizeBase
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
targetFileSizeBase
- the target size of a level-0 file.AdvancedMutableColumnFamilyOptionsInterface.setTargetFileSizeMultiplier(int)
public int targetFileSizeMultiplier()
AdvancedMutableColumnFamilyOptionsInterface
targetFileSizeMultiplier
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setTargetFileSizeMultiplier(int multiplier)
AdvancedMutableColumnFamilyOptionsInterface
setTargetFileSizeMultiplier
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
multiplier
- the size ratio between a level-(L+1) file
and level-L file.public Options setMaxBytesForLevelBase(long maxBytesForLevelBase)
MutableColumnFamilyOptionsInterface
setMaxBytesForLevelBase
in interface MutableColumnFamilyOptionsInterface<Options>
maxBytesForLevelBase
- maximum bytes for level base.AdvancedMutableColumnFamilyOptionsInterface.setMaxBytesForLevelMultiplier(double)
public long maxBytesForLevelBase()
MutableColumnFamilyOptionsInterface
maxBytesForLevelBase
in interface MutableColumnFamilyOptionsInterface<Options>
AdvancedMutableColumnFamilyOptionsInterface.maxBytesForLevelMultiplier()
public Options setLevelCompactionDynamicLevelBytes(boolean enableLevelCompactionDynamicLevelBytes)
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
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.
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
setLevelCompactionDynamicLevelBytes
in interface AdvancedColumnFamilyOptionsInterface<Options>
enableLevelCompactionDynamicLevelBytes
- boolean value indicating
if LevelCompactionDynamicLevelBytes
shall be enabled.public boolean levelCompactionDynamicLevelBytes()
AdvancedColumnFamilyOptionsInterface
Return if LevelCompactionDynamicLevelBytes
is enabled.
For further information see
AdvancedColumnFamilyOptionsInterface.setLevelCompactionDynamicLevelBytes(boolean)
levelCompactionDynamicLevelBytes
in interface AdvancedColumnFamilyOptionsInterface<Options>
levelCompactionDynamicLevelBytes
is enabled.public double maxBytesForLevelMultiplier()
ColumnFamilyOptionsInterface
maxBytesForLevelMultiplier
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
maxBytesForLevelMultiplier
in interface ColumnFamilyOptionsInterface<Options>
public Options setMaxBytesForLevelMultiplier(double multiplier)
ColumnFamilyOptionsInterface
setMaxBytesForLevelMultiplier
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
setMaxBytesForLevelMultiplier
in interface ColumnFamilyOptionsInterface<Options>
multiplier
- the ratio between the total size of level-(L+1)
files and the total size of level-L files for all L.public long maxCompactionBytes()
AdvancedColumnFamilyOptionsInterface
maxCompactionBytes
in interface AdvancedColumnFamilyOptionsInterface<Options>
maxCompactionBytes
in interface MutableColumnFamilyOptionsInterface<Options>
MutableColumnFamilyOptionsInterface.setMaxCompactionBytes(long)
public Options setMaxCompactionBytes(long maxCompactionBytes)
AdvancedColumnFamilyOptionsInterface
setMaxCompactionBytes
in interface AdvancedColumnFamilyOptionsInterface<Options>
setMaxCompactionBytes
in interface MutableColumnFamilyOptionsInterface<Options>
maxCompactionBytes
- the compaction size limitMutableColumnFamilyOptionsInterface.maxCompactionBytes()
public long arenaBlockSize()
AdvancedMutableColumnFamilyOptionsInterface
arenaBlockSize
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setArenaBlockSize(long arenaBlockSize)
AdvancedMutableColumnFamilyOptionsInterface
setArenaBlockSize
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
arenaBlockSize
- the size of an arena blockpublic boolean disableAutoCompactions()
MutableColumnFamilyOptionsInterface
disableAutoCompactions
in interface MutableColumnFamilyOptionsInterface<Options>
public Options setDisableAutoCompactions(boolean disableAutoCompactions)
MutableColumnFamilyOptionsInterface
setDisableAutoCompactions
in interface MutableColumnFamilyOptionsInterface<Options>
disableAutoCompactions
- true if auto-compactions are disabled.public long maxSequentialSkipInIterations()
AdvancedMutableColumnFamilyOptionsInterface
maxSequentialSkipInIterations
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations)
AdvancedMutableColumnFamilyOptionsInterface
setMaxSequentialSkipInIterations
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
maxSequentialSkipInIterations
- the number of keys could
be skipped in a iteration.public boolean inplaceUpdateSupport()
AdvancedColumnFamilyOptionsInterface
inplaceUpdateSupport
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setInplaceUpdateSupport(boolean inplaceUpdateSupport)
AdvancedColumnFamilyOptionsInterface
setInplaceUpdateSupport
in interface AdvancedColumnFamilyOptionsInterface<Options>
inplaceUpdateSupport
- true if thread-safe inplace updates
are allowed.public long inplaceUpdateNumLocks()
AdvancedMutableColumnFamilyOptionsInterface
inplaceUpdateNumLocks
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
AdvancedMutableColumnFamilyOptionsInterface
setInplaceUpdateNumLocks
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
inplaceUpdateNumLocks
- the number of locks used for
inplace updates.public double memtablePrefixBloomSizeRatio()
AdvancedMutableColumnFamilyOptionsInterface
memtablePrefixBloomSizeRatio
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setMemtablePrefixBloomSizeRatio(double memtablePrefixBloomSizeRatio)
AdvancedMutableColumnFamilyOptionsInterface
setMemtablePrefixBloomSizeRatio
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
memtablePrefixBloomSizeRatio
- The ratiopublic int bloomLocality()
AdvancedColumnFamilyOptionsInterface
bloomLocality
in interface AdvancedColumnFamilyOptionsInterface<Options>
AdvancedColumnFamilyOptionsInterface.setBloomLocality(int)
public Options setBloomLocality(int bloomLocality)
AdvancedColumnFamilyOptionsInterface
setBloomLocality
in interface AdvancedColumnFamilyOptionsInterface<Options>
bloomLocality
- the level of locality of bloom-filter probes.public long maxSuccessiveMerges()
AdvancedMutableColumnFamilyOptionsInterface
maxSuccessiveMerges
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setMaxSuccessiveMerges(long maxSuccessiveMerges)
AdvancedMutableColumnFamilyOptionsInterface
setMaxSuccessiveMerges
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
maxSuccessiveMerges
- the maximum number of successive merges.public int minWriteBufferNumberToMerge()
AdvancedColumnFamilyOptionsInterface
minWriteBufferNumberToMerge
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)
AdvancedColumnFamilyOptionsInterface
setMinWriteBufferNumberToMerge
in interface AdvancedColumnFamilyOptionsInterface<Options>
minWriteBufferNumberToMerge
- the minimum number of write buffers
that will be merged together.public Options setOptimizeFiltersForHits(boolean optimizeFiltersForHits)
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
setOptimizeFiltersForHits
in interface AdvancedColumnFamilyOptionsInterface<Options>
optimizeFiltersForHits
- boolean value indicating if this flag is set.public boolean optimizeFiltersForHits()
AdvancedColumnFamilyOptionsInterface
Returns the current state of the optimize_filters_for_hits
setting.
optimizeFiltersForHits
in interface AdvancedColumnFamilyOptionsInterface<Options>
optimize_filters_for_hits
was set.public Options setMemtableHugePageSize(long memtableHugePageSize)
AdvancedMutableColumnFamilyOptionsInterface
setMemtableHugePageSize
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
memtableHugePageSize
- The page size of the huge
page tlbpublic long memtableHugePageSize()
AdvancedMutableColumnFamilyOptionsInterface
memtableHugePageSize
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit)
AdvancedMutableColumnFamilyOptionsInterface
setSoftPendingCompactionBytesLimit
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
softPendingCompactionBytesLimit
- The soft limit to impose on
compactionpublic long softPendingCompactionBytesLimit()
AdvancedMutableColumnFamilyOptionsInterface
softPendingCompactionBytesLimit
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)
AdvancedMutableColumnFamilyOptionsInterface
setHardPendingCompactionBytesLimit
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
hardPendingCompactionBytesLimit
- The hard limit to impose on
compactionpublic long hardPendingCompactionBytesLimit()
AdvancedMutableColumnFamilyOptionsInterface
hardPendingCompactionBytesLimit
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger)
MutableColumnFamilyOptionsInterface
setLevel0FileNumCompactionTrigger
in interface MutableColumnFamilyOptionsInterface<Options>
level0FileNumCompactionTrigger
- The number of files to trigger
level-0 compactionpublic int level0FileNumCompactionTrigger()
MutableColumnFamilyOptionsInterface
level0FileNumCompactionTrigger
in interface MutableColumnFamilyOptionsInterface<Options>
public Options setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger)
AdvancedMutableColumnFamilyOptionsInterface
setLevel0SlowdownWritesTrigger
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
level0SlowdownWritesTrigger
- The soft limit on the number of
level-0 filespublic int level0SlowdownWritesTrigger()
AdvancedMutableColumnFamilyOptionsInterface
level0SlowdownWritesTrigger
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setLevel0StopWritesTrigger(int level0StopWritesTrigger)
AdvancedMutableColumnFamilyOptionsInterface
setLevel0StopWritesTrigger
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
level0StopWritesTrigger
- The maximum number of level-0 filespublic int level0StopWritesTrigger()
AdvancedMutableColumnFamilyOptionsInterface
level0StopWritesTrigger
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional)
AdvancedMutableColumnFamilyOptionsInterface
setMaxBytesForLevelMultiplierAdditional
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
maxBytesForLevelMultiplierAdditional
- The max-size multipliers
for each levelpublic int[] maxBytesForLevelMultiplierAdditional()
AdvancedMutableColumnFamilyOptionsInterface
maxBytesForLevelMultiplierAdditional
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setParanoidFileChecks(boolean paranoidFileChecks)
AdvancedMutableColumnFamilyOptionsInterface
setParanoidFileChecks
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
paranoidFileChecks
- true to enable paranoid file checkspublic boolean paranoidFileChecks()
AdvancedMutableColumnFamilyOptionsInterface
paranoidFileChecks
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setMaxWriteBufferNumberToMaintain(int maxWriteBufferNumberToMaintain)
AdvancedColumnFamilyOptionsInterface
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.setMaxWriteBufferNumberToMaintain
in interface AdvancedColumnFamilyOptionsInterface<Options>
maxWriteBufferNumberToMaintain
- The maximum number of write
buffers to maintainpublic int maxWriteBufferNumberToMaintain()
AdvancedColumnFamilyOptionsInterface
maxWriteBufferNumberToMaintain
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setCompactionPriority(CompactionPriority compactionPriority)
AdvancedColumnFamilyOptionsInterface
AdvancedColumnFamilyOptionsInterface.compactionStyle()
== CompactionStyle.LEVEL
,
for each level, which files are prioritized to be picked to compact.
Default: CompactionPriority.ByCompensatedSize
setCompactionPriority
in interface AdvancedColumnFamilyOptionsInterface<Options>
compactionPriority
- The compaction prioritypublic CompactionPriority compactionPriority()
AdvancedColumnFamilyOptionsInterface
compactionPriority
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setReportBgIoStats(boolean reportBgIoStats)
AdvancedMutableColumnFamilyOptionsInterface
setReportBgIoStats
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
reportBgIoStats
- true to enable reportingpublic boolean reportBgIoStats()
AdvancedMutableColumnFamilyOptionsInterface
reportBgIoStats
in interface AdvancedMutableColumnFamilyOptionsInterface<Options>
public Options setCompactionOptionsUniversal(CompactionOptionsUniversal compactionOptionsUniversal)
AdvancedColumnFamilyOptionsInterface
setCompactionOptionsUniversal
in interface AdvancedColumnFamilyOptionsInterface<Options>
compactionOptionsUniversal
- The Universal Style compaction optionspublic CompactionOptionsUniversal compactionOptionsUniversal()
AdvancedColumnFamilyOptionsInterface
compactionOptionsUniversal
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setCompactionOptionsFIFO(CompactionOptionsFIFO compactionOptionsFIFO)
AdvancedColumnFamilyOptionsInterface
setCompactionOptionsFIFO
in interface AdvancedColumnFamilyOptionsInterface<Options>
compactionOptionsFIFO
- The FIFO compaction optionspublic CompactionOptionsFIFO compactionOptionsFIFO()
AdvancedColumnFamilyOptionsInterface
compactionOptionsFIFO
in interface AdvancedColumnFamilyOptionsInterface<Options>
public Options setForceConsistencyChecks(boolean forceConsistencyChecks)
AdvancedColumnFamilyOptionsInterface
setForceConsistencyChecks
in interface AdvancedColumnFamilyOptionsInterface<Options>
forceConsistencyChecks
- true to force consistency checkspublic boolean forceConsistencyChecks()
AdvancedColumnFamilyOptionsInterface
forceConsistencyChecks
in interface AdvancedColumnFamilyOptionsInterface<Options>
protected final void disposeInternal(long handle)
disposeInternal
in class RocksObject