public class Options extends RocksObject implements DBOptionsInterface, ColumnFamilyOptionsInterface, MutableColumnFamilyOptionsInterface
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 |
|---|---|
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 |
allowConcurrentMemtableWrite()
If true, allow multi-writers to update mem tables in parallel.
|
boolean |
allowMmapReads()
Allow the OS to mmap file for reading sst tables.
|
boolean |
allowMmapWrites()
Allow the OS to mmap file for writing.
|
boolean |
allowOsBuffer()
Data being read from file storage may be buffered in the OS
Default: true
|
long |
arenaBlockSize()
The size of one block in arena memory allocation.
|
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.
|
long |
bytesPerSync()
Allows OS to incrementally sync files to disk while they are being
written, asynchronously, in the background.
|
CompactionStyle |
compactionStyle()
Compaction style for DB.
|
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.
|
Options |
createStatistics()
Creates statistics object which collects metrics about database operations.
|
java.lang.String |
dbLogDir()
Returns the directory of info log.
|
long |
deleteObsoleteFilesPeriodMicros()
The periodicity when obsolete files get deleted.
|
boolean |
disableAutoCompactions()
Disable automatic compactions.
|
boolean |
disableDataSync()
If true, then the contents of data files are not synced
to stable storage.
|
protected void |
disposeInternal(long handle) |
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.
|
Env |
getEnv()
Returns the set RocksEnv instance.
|
long |
hardPendingCompactionBytesLimit()
All writes are stopped if estimated bytes needed to be compaction exceed
this threshold.
|
double |
hardRateLimit()
Puts are delayed 1ms at a time when any level has a compaction score that
exceeds hard_rate_limit.
|
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.
|
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)
|
long |
maxLogFileSize()
Returns the maximum size of a info log file.
|
long |
maxManifestFileSize()
Manifest file is rolled over on reaching this limit.
|
int |
maxMemCompactionLevel()
This does nothing anymore.
|
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.
|
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 |
minPartialMergeOperands()
The number of partial merge operands to accumulate before partial
merge will be performed.
|
int |
minWriteBufferNumberToMerge()
The minimum number of write buffers that will be merged together
before writing to storage.
|
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 |
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.
|
boolean |
purgeRedundantKvsWhileFlush()
Purge duplicate/deleted keys when a memtable is flushed to storage.
|
int |
rateLimitDelayMaxMilliseconds()
The maximum time interval a put will be stalled when hard_rate_limit
is enforced.
|
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.
|
void |
setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
If true, allow multi-writers to update mem tables in parallel.
|
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 |
setAllowOsBuffer(boolean allowOsBuffer)
Data being read from file storage may be buffered in the OS
Default: true
|
Options |
setArenaBlockSize(long arenaBlockSize)
The size of one block in arena memory allocation.
|
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 |
setBytesPerSync(long bytesPerSync)
Allows OS to incrementally sync files to disk while they are being
written, asynchronously, in the background.
|
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 |
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 |
setDeleteObsoleteFilesPeriodMicros(long micros)
The periodicity when obsolete files get deleted.
|
Options |
setDisableAutoCompactions(boolean disableAutoCompactions)
Disable automatic compactions.
|
Options |
setDisableDataSync(boolean disableDataSync)
If true, then the contents of manifest and data files are
not synced to stable storage.
|
void |
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 |
setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)
All writes are stopped if estimated bytes needed to be compaction exceed
this threshold.
|
Options |
setHardRateLimit(double hardRateLimit)
Puts are delayed 1ms at a time when any level has a compaction score that
exceeds hard_rate_limit.
|
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.
|
MutableColumnFamilyOptionsInterface |
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 |
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 |
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 |
setMaxMemCompactionLevel(int maxMemCompactionLevel)
This does nothing anymore.
|
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 |
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 |
setMinPartialMergeOperands(int minPartialMergeOperands)
The number of partial merge operands to accumulate before partial
merge will be performed.
|
Options |
setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)
The minimum number of write buffers that will be merged together
before writing to storage.
|
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 |
setPurgeRedundantKvsWhileFlush(boolean purgeRedundantKvsWhileFlush)
Purge duplicate/deleted keys when a memtable is flushed to storage.
|
Options |
setRateLimitDelayMaxMilliseconds(int rateLimitDelayMaxMilliseconds)
The maximum time interval a put will be stalled when hard_rate_limit
is enforced.
|
Options |
setRateLimiter(RateLimiter rateLimiter)
Use to control write rate of flush and compaction.
|
Options |
setRateLimiterConfig(RateLimiterConfig config)
Use to control write rate of flush and compaction.
|
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 |
setSoftRateLimit(double softRateLimit)
Puts are delayed 0-1 ms when any level has a compaction score that exceeds
soft_rate_limit.
|
Options |
setStatsDumpPeriodSec(int statsDumpPeriodSec)
if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 3600 (1 hour)
|
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 |
setUseFsync(boolean useFsync)
If true, then every store to stable storage will issue a fsync.
|
Options |
setVerifyChecksumsInCompaction(boolean verifyChecksumsInCompaction)
If true, compaction will verify checksum on every read that happens
as part of compaction
Default: true
|
Options |
setWalDir(java.lang.String walDir)
This specifies the absolute dir path for write-ahead logs (WAL).
|
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 |
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.
|
void |
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.
|
void |
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.
|
long |
softPendingCompactionBytesLimit()
All writes will be slowed down to at least delayed_write_rate if estimated
bytes needed to be compaction exceed this threshold.
|
double |
softRateLimit()
Puts are delayed 0-1 ms when any level has a compaction score that exceeds
soft_rate_limit.
|
Statistics |
statisticsPtr()
Returns statistics object.
|
int |
statsDumpPeriodSec()
If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 3600 (1 hour)
|
int |
tableCacheNumshardbits()
Number of shards used for table cache.
|
java.lang.String |
tableFactoryName() |
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.
|
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.
|
boolean |
verifyChecksumsInCompaction()
If true, compaction will verify checksum on every read that happens
as part of compaction
Default: true
|
java.lang.String |
walDir()
Returns the path to the write-ahead-logs (WAL) directory.
|
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 |
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.
|
disposeInternalclose, disOwnNativeHandle, isOwningHandledispose, finalizepublic Options()
rocksdb::Options in the c++ side.public Options(DBOptions dbOptions, ColumnFamilyOptions columnFamilyOptions)
dbOptions - DBOptions instancecolumnFamilyOptions - ColumnFamilyOptions
instancepublic Options setIncreaseParallelism(int totalThreads)
DBOptionsInterfaceBy 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 DBOptionsInterfacetotalThreads - The total number of threads to be used by RocksDB.
A good value is the number of cores.public Options setCreateIfMissing(boolean flag)
DBOptionsInterfaceRocksDB.open().
Default: falsesetCreateIfMissing in interface DBOptionsInterfaceflag - 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)
DBOptionsInterfaceIf true, missing column families will be automatically created
Default: false
setCreateMissingColumnFamilies in interface DBOptionsInterfaceflag - a flag indicating if missing column families shall be
created automatically.public Options setEnv(Env env)
Env.getDefault()env - Env instance.public Env getEnv()
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()
DBOptionsInterfacecreateIfMissing in interface DBOptionsInterfaceDBOptionsInterface.setCreateIfMissing(boolean)public boolean createMissingColumnFamilies()
DBOptionsInterfacecreateMissingColumnFamilies in interface DBOptionsInterfaceDBOptionsInterface.setCreateMissingColumnFamilies(boolean)public Options optimizeForPointLookup(long blockCacheSizeMb)
ColumnFamilyOptionsInterfaceoptimizeForPointLookup in interface ColumnFamilyOptionsInterfaceblockCacheSizeMb - Block cache size in MBpublic Options optimizeLevelStyleCompaction()
ColumnFamilyOptionsInterfaceDefault 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 ColumnFamilyOptionsInterfacepublic Options optimizeLevelStyleCompaction(long memtableMemoryBudget)
ColumnFamilyOptionsInterfaceDefault 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 ColumnFamilyOptionsInterfacememtableMemoryBudget - memory budget in bytespublic Options optimizeUniversalStyleCompaction()
ColumnFamilyOptionsInterfaceDefault 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 ColumnFamilyOptionsInterfacepublic Options optimizeUniversalStyleCompaction(long memtableMemoryBudget)
ColumnFamilyOptionsInterfaceDefault 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 ColumnFamilyOptionsInterfacememtableMemoryBudget - memory budget in bytespublic Options setComparator(BuiltinComparator builtinComparator)
ColumnFamilyOptionsInterfaceBuiltinComparator to be used with RocksDB.
Note: Comparator can be set once upon database creation.
Default: BytewiseComparator.setComparator in interface ColumnFamilyOptionsInterfacebuiltinComparator - a BuiltinComparator type.public Options setComparator(AbstractComparator<? extends AbstractSlice<?>> comparator)
ColumnFamilyOptionsInterfacesetComparator in interface ColumnFamilyOptionsInterfacecomparator - java instance.public Options setMergeOperatorName(java.lang.String name)
ColumnFamilyOptionsInterfaceSet 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 ColumnFamilyOptionsInterfacename - 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)
ColumnFamilyOptionsInterfaceSet 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 ColumnFamilyOptionsInterfacemergeOperator - MergeOperator instance.public Options setWriteBufferSize(long writeBufferSize)
MutableColumnFamilyOptionsInterfacemax_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 MutableColumnFamilyOptionsInterfacewriteBufferSize - the size of write buffer.public long writeBufferSize()
MutableColumnFamilyOptionsInterfacewriteBufferSize in interface MutableColumnFamilyOptionsInterfaceMutableColumnFamilyOptionsInterface.setWriteBufferSize(long)public Options setMaxWriteBufferNumber(int maxWriteBufferNumber)
MutableColumnFamilyOptionsInterfacesetMaxWriteBufferNumber in interface MutableColumnFamilyOptionsInterfacemaxWriteBufferNumber - maximum number of write buffers.public int maxWriteBufferNumber()
MutableColumnFamilyOptionsInterfacemaxWriteBufferNumber in interface MutableColumnFamilyOptionsInterfaceMutableColumnFamilyOptionsInterface.setMaxWriteBufferNumber(int)public boolean errorIfExists()
DBOptionsInterfaceerrorIfExists in interface DBOptionsInterfacepublic Options setErrorIfExists(boolean errorIfExists)
DBOptionsInterfacesetErrorIfExists in interface DBOptionsInterfaceerrorIfExists - if true, an exception will be thrown
during RocksDB.open() if the database already exists.RocksDB.open(org.rocksdb.Options, String)public boolean paranoidChecks()
DBOptionsInterfaceparanoidChecks in interface DBOptionsInterfacepublic Options setParanoidChecks(boolean paranoidChecks)
DBOptionsInterfacesetParanoidChecks in interface DBOptionsInterfaceparanoidChecks - a flag to indicate whether paranoid-check
is on.public int maxOpenFiles()
DBOptionsInterfacetarget_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 DBOptionsInterfacepublic Options setMaxTotalWalSize(long maxTotalWalSize)
DBOptionsInterfaceOnce 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 DBOptionsInterfacemaxTotalWalSize - max total wal size.public long maxTotalWalSize()
DBOptionsInterfaceReturns 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 DBOptionsInterfacepublic Options setMaxOpenFiles(int maxOpenFiles)
DBOptionsInterfacetarget_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 DBOptionsInterfacemaxOpenFiles - the maximum number of open files.public boolean disableDataSync()
DBOptionsInterfacedisableDataSync in interface DBOptionsInterfacepublic Options setDisableDataSync(boolean disableDataSync)
DBOptionsInterfaceIf true, then the contents of manifest and data files are not synced to stable storage. Their contents remain in the OS buffers till theOS decides to flush them.
This option is good for bulk-loading of data.
Once the bulk-loading is complete, please issue a sync to the OS to flush all dirty buffers to stable storage.
Default: false
setDisableDataSync in interface DBOptionsInterfacedisableDataSync - a boolean flag to specify whether to
disable data sync.public boolean useFsync()
DBOptionsInterfaceIf 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 DBOptionsInterfacepublic Options setUseFsync(boolean useFsync)
DBOptionsInterfaceIf 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 DBOptionsInterfaceuseFsync - a boolean flag to specify whether to use fsyncpublic java.lang.String dbLogDir()
DBOptionsInterfacedbLogDir in interface DBOptionsInterfacepublic Options setDbLogDir(java.lang.String dbLogDir)
DBOptionsInterfacesetDbLogDir in interface DBOptionsInterfacedbLogDir - the path to the info log directorypublic java.lang.String walDir()
DBOptionsInterfacewalDir in interface DBOptionsInterfacepublic Options setWalDir(java.lang.String walDir)
DBOptionsInterfacesetWalDir in interface DBOptionsInterfacewalDir - the path to the write-ahead-log directory.public long deleteObsoleteFilesPeriodMicros()
DBOptionsInterfacedeleteObsoleteFilesPeriodMicros in interface DBOptionsInterfacepublic Options setDeleteObsoleteFilesPeriodMicros(long micros)
DBOptionsInterfacesetDeleteObsoleteFilesPeriodMicros in interface DBOptionsInterfacemicros - the time interval in microspublic int maxBackgroundCompactions()
DBOptionsInterfacemaxBackgroundCompactions in interface DBOptionsInterfaceEnv.setBackgroundThreads(int),
Env.setBackgroundThreads(int, int)public Options createStatistics()
DBOptionsInterfaceCreates 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.
createStatistics in interface DBOptionsInterfaceRocksDB.open(org.rocksdb.Options, String)public Statistics statisticsPtr()
DBOptionsInterfaceReturns statistics object. Calls DBOptionsInterface.createStatistics() if
C++ returns nullptr for statistics.
statisticsPtr in interface DBOptionsInterfaceDBOptionsInterface.createStatistics()public void setBaseBackgroundCompactions(int baseBackgroundCompactions)
DBOptionsInterfacesetBaseBackgroundCompactions in interface DBOptionsInterfacebaseBackgroundCompactions - Suggested number of background compaction
jobspublic int baseBackgroundCompactions()
DBOptionsInterfacebaseBackgroundCompactions in interface DBOptionsInterfacepublic Options setMaxBackgroundCompactions(int maxBackgroundCompactions)
DBOptionsInterfacesetMaxBackgroundCompactions in interface DBOptionsInterfacemaxBackgroundCompactions - the maximum number of background
compaction jobs.Env.setBackgroundThreads(int),
Env.setBackgroundThreads(int, int),
DBOptionsInterface.maxBackgroundFlushes()public void setMaxSubcompactions(int maxSubcompactions)
DBOptionsInterfacesetMaxSubcompactions in interface DBOptionsInterfacemaxSubcompactions - The maximum number of threads that will
concurrently perform a compaction jobpublic int maxSubcompactions()
DBOptionsInterfacemaxSubcompactions in interface DBOptionsInterfacepublic int maxBackgroundFlushes()
DBOptionsInterfacemaxBackgroundFlushes in interface DBOptionsInterfaceEnv.setBackgroundThreads(int),
Env.setBackgroundThreads(int, int)public Options setMaxBackgroundFlushes(int maxBackgroundFlushes)
DBOptionsInterfacesetMaxBackgroundFlushes in interface DBOptionsInterfacemaxBackgroundFlushes - number of max concurrent flush jobsEnv.setBackgroundThreads(int),
Env.setBackgroundThreads(int, int),
DBOptionsInterface.maxBackgroundCompactions()public long maxLogFileSize()
DBOptionsInterfacemaxLogFileSize in interface DBOptionsInterfacepublic Options setMaxLogFileSize(long maxLogFileSize)
DBOptionsInterfacesetMaxLogFileSize in interface DBOptionsInterfacemaxLogFileSize - the maximum size of a info log file.public long logFileTimeToRoll()
DBOptionsInterfacelogFileTimeToRoll in interface DBOptionsInterfacepublic Options setLogFileTimeToRoll(long logFileTimeToRoll)
DBOptionsInterfacesetLogFileTimeToRoll in interface DBOptionsInterfacelogFileTimeToRoll - the time interval in seconds.public long keepLogFileNum()
DBOptionsInterfacekeepLogFileNum in interface DBOptionsInterfacepublic Options setKeepLogFileNum(long keepLogFileNum)
DBOptionsInterfacesetKeepLogFileNum in interface DBOptionsInterfacekeepLogFileNum - the maximum number of info log files to be kept.public long maxManifestFileSize()
DBOptionsInterfacemaxManifestFileSize in interface DBOptionsInterfacepublic Options setMaxManifestFileSize(long maxManifestFileSize)
DBOptionsInterfacesetMaxManifestFileSize in interface DBOptionsInterfacemaxManifestFileSize - the size limit of a manifest file.public Options setMaxTableFilesSizeFIFO(long maxTableFilesSize)
ColumnFamilyOptionsInterfacesetMaxTableFilesSizeFIFO in interface ColumnFamilyOptionsInterfacemaxTableFilesSize - the size limit of the total sum of table files.public long maxTableFilesSizeFIFO()
ColumnFamilyOptionsInterfacemaxTableFilesSizeFIFO in interface ColumnFamilyOptionsInterfacepublic int tableCacheNumshardbits()
DBOptionsInterfacetableCacheNumshardbits in interface DBOptionsInterfacepublic Options setTableCacheNumshardbits(int tableCacheNumshardbits)
DBOptionsInterfacesetTableCacheNumshardbits in interface DBOptionsInterfacetableCacheNumshardbits - the number of chardspublic long walTtlSeconds()
DBOptionsInterfacewalTtlSeconds in interface DBOptionsInterfaceDBOptionsInterface.walSizeLimitMB()public Options setWalTtlSeconds(long walTtlSeconds)
DBOptionsInterfaceDBOptionsInterface.walTtlSeconds() and DBOptionsInterface.walSizeLimitMB() affect how archived logs
will be deleted.
setWalTtlSeconds in interface DBOptionsInterfacewalTtlSeconds - the ttl secondsDBOptionsInterface.setWalSizeLimitMB(long)public long walSizeLimitMB()
DBOptionsInterfaceDBOptionsInterface.walTtlSeconds() and #walSizeLimitMB() affect how archived logs
will be deleted.
walSizeLimitMB in interface DBOptionsInterfaceDBOptionsInterface.walSizeLimitMB()public Options setWalSizeLimitMB(long sizeLimitMB)
DBOptionsInterfacesetWalSizeLimitMB in interface DBOptionsInterfacesizeLimitMB - size limit in mega-bytes.DBOptionsInterface.setWalSizeLimitMB(long)public long manifestPreallocationSize()
DBOptionsInterfacemanifestPreallocationSize in interface DBOptionsInterfacepublic Options setManifestPreallocationSize(long size)
DBOptionsInterfacesetManifestPreallocationSize in interface DBOptionsInterfacesize - the size in bytepublic boolean allowOsBuffer()
DBOptionsInterfaceallowOsBuffer in interface DBOptionsInterfacepublic Options setAllowOsBuffer(boolean allowOsBuffer)
DBOptionsInterfacesetAllowOsBuffer in interface DBOptionsInterfaceallowOsBuffer - if true, then OS buffering is allowed.public boolean allowMmapReads()
DBOptionsInterfaceallowMmapReads in interface DBOptionsInterfacepublic Options setAllowMmapReads(boolean allowMmapReads)
DBOptionsInterfacesetAllowMmapReads in interface DBOptionsInterfaceallowMmapReads - true if mmap reads are allowed.public boolean allowMmapWrites()
DBOptionsInterfaceallowMmapWrites in interface DBOptionsInterfacepublic Options setAllowMmapWrites(boolean allowMmapWrites)
DBOptionsInterfacesetAllowMmapWrites in interface DBOptionsInterfaceallowMmapWrites - true if mmap writes are allowd.public boolean isFdCloseOnExec()
DBOptionsInterfaceisFdCloseOnExec in interface DBOptionsInterfacepublic Options setIsFdCloseOnExec(boolean isFdCloseOnExec)
DBOptionsInterfacesetIsFdCloseOnExec in interface DBOptionsInterfaceisFdCloseOnExec - true if child process inheriting open
files is disabled.public int statsDumpPeriodSec()
DBOptionsInterfacestatsDumpPeriodSec in interface DBOptionsInterfacepublic Options setStatsDumpPeriodSec(int statsDumpPeriodSec)
DBOptionsInterfacesetStatsDumpPeriodSec in interface DBOptionsInterfacestatsDumpPeriodSec - time interval in seconds.public boolean adviseRandomOnOpen()
DBOptionsInterfaceadviseRandomOnOpen in interface DBOptionsInterfacepublic Options setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
DBOptionsInterfacesetAdviseRandomOnOpen in interface DBOptionsInterfaceadviseRandomOnOpen - true if hinting random access is on.public boolean useAdaptiveMutex()
DBOptionsInterfaceuseAdaptiveMutex in interface DBOptionsInterfacepublic Options setUseAdaptiveMutex(boolean useAdaptiveMutex)
DBOptionsInterfacesetUseAdaptiveMutex in interface DBOptionsInterfaceuseAdaptiveMutex - true if adaptive mutex is used.public long bytesPerSync()
DBOptionsInterfacebytesPerSync in interface DBOptionsInterfacepublic Options setBytesPerSync(long bytesPerSync)
DBOptionsInterfacesetBytesPerSync in interface DBOptionsInterfacebytesPerSync - size in bytespublic void setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
DBOptionsInterfaceDBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean) if you are going to use
this feature.
Default: falsesetAllowConcurrentMemtableWrite in interface DBOptionsInterfaceallowConcurrentMemtableWrite - true to enable concurrent writes
for the memtablepublic boolean allowConcurrentMemtableWrite()
DBOptionsInterfaceDBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean) if you are going to use
this feature.
Default: falseallowConcurrentMemtableWrite in interface DBOptionsInterfacepublic void setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
DBOptionsInterfaceDBOptionsInterface.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 DBOptionsInterfaceenableWriteThreadAdaptiveYield - true to enable adaptive yield for the
write threadspublic boolean enableWriteThreadAdaptiveYield()
DBOptionsInterfaceDBOptionsInterface.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 DBOptionsInterfacepublic void setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
DBOptionsInterfaceDBOptionsInterface.writeThreadSlowYieldUsec() is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100setWriteThreadMaxYieldUsec in interface DBOptionsInterfacewriteThreadMaxYieldUsec - maximum number of microsecondspublic long writeThreadMaxYieldUsec()
DBOptionsInterfaceDBOptionsInterface.writeThreadSlowYieldUsec() is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100writeThreadMaxYieldUsec in interface DBOptionsInterfacepublic void setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
DBOptionsInterfacesetWriteThreadSlowYieldUsec in interface DBOptionsInterfacewriteThreadSlowYieldUsec - the latency in microsecondspublic long writeThreadSlowYieldUsec()
DBOptionsInterfacewriteThreadSlowYieldUsec in interface DBOptionsInterfacepublic Options setMemTableConfig(MemTableConfig config)
ColumnFamilyOptionsInterfacesetMemTableConfig in interface ColumnFamilyOptionsInterfaceconfig - the mem-table config.public Options setRateLimiterConfig(RateLimiterConfig config)
DBOptionsInterfacesetRateLimiterConfig in interface DBOptionsInterfaceconfig - rate limiter config.public Options setRateLimiter(RateLimiter rateLimiter)
DBOptionsInterfacesetRateLimiter in interface DBOptionsInterfacerateLimiter - RateLimiter instance.public Options setLogger(Logger logger)
DBOptionsInterfaceAny 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 DBOptionsInterfacelogger - Logger instance.public Options setInfoLogLevel(InfoLogLevel infoLogLevel)
DBOptionsInterfaceSets the RocksDB log level. Default level is INFO
setInfoLogLevel in interface DBOptionsInterfaceinfoLogLevel - log level to set.public InfoLogLevel infoLogLevel()
DBOptionsInterfaceReturns currently set log level.
infoLogLevel in interface DBOptionsInterfaceInfoLogLevel instance.public java.lang.String memTableFactoryName()
ColumnFamilyOptionsInterfacememTableFactoryName in interface ColumnFamilyOptionsInterfaceColumnFamilyOptionsInterface.setTableFormatConfig(org.rocksdb.TableFormatConfig)public Options setTableFormatConfig(TableFormatConfig config)
ColumnFamilyOptionsInterfacesetTableFormatConfig in interface ColumnFamilyOptionsInterfaceconfig - the table format config.public java.lang.String tableFactoryName()
tableFactoryName in interface ColumnFamilyOptionsInterfacepublic Options useFixedLengthPrefixExtractor(int n)
ColumnFamilyOptionsInterfaceuseFixedLengthPrefixExtractor in interface ColumnFamilyOptionsInterfacen - use the first n bytes of a key as its prefix.public Options useCappedPrefixExtractor(int n)
ColumnFamilyOptionsInterfaceuseCappedPrefixExtractor in interface ColumnFamilyOptionsInterfacen - use the first n bytes of a key as its prefix.public CompressionType compressionType()
ColumnFamilyOptionsInterfacecompressionType in interface ColumnFamilyOptionsInterfacepublic Options setCompressionPerLevel(java.util.List<CompressionType> compressionLevels)
ColumnFamilyOptionsInterfaceDifferent 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 ColumnFamilyOptionsInterfacecompressionLevels - list of
CompressionType instances.public java.util.List<CompressionType> compressionPerLevel()
ColumnFamilyOptionsInterfaceReturn the currently set CompressionType
per instances.
See: ColumnFamilyOptionsInterface.setCompressionPerLevel(java.util.List)
compressionPerLevel in interface ColumnFamilyOptionsInterfaceCompressionType
instances.public Options setCompressionType(CompressionType compressionType)
ColumnFamilyOptionsInterfacesetCompressionType in interface ColumnFamilyOptionsInterfacecompressionType - Compression Type.public CompactionStyle compactionStyle()
ColumnFamilyOptionsInterfacecompactionStyle in interface ColumnFamilyOptionsInterfacepublic Options setCompactionStyle(CompactionStyle compactionStyle)
ColumnFamilyOptionsInterfacesetCompactionStyle in interface ColumnFamilyOptionsInterfacecompactionStyle - Compaction style.public int numLevels()
ColumnFamilyOptionsInterfacenumLevels in interface ColumnFamilyOptionsInterfacepublic Options setNumLevels(int numLevels)
ColumnFamilyOptionsInterfacesetNumLevels in interface ColumnFamilyOptionsInterfacenumLevels - the number of levels.public int levelZeroFileNumCompactionTrigger()
ColumnFamilyOptionsInterfacelevelZeroFileNumCompactionTrigger in interface ColumnFamilyOptionsInterfacepublic Options setLevelZeroFileNumCompactionTrigger(int numFiles)
ColumnFamilyOptionsInterfacesetLevelZeroFileNumCompactionTrigger in interface ColumnFamilyOptionsInterfacenumFiles - the number of files in level-0 to trigger compaction.public int levelZeroSlowdownWritesTrigger()
ColumnFamilyOptionsInterfacelevelZeroSlowdownWritesTrigger in interface ColumnFamilyOptionsInterfacepublic Options setLevelZeroSlowdownWritesTrigger(int numFiles)
ColumnFamilyOptionsInterfacesetLevelZeroSlowdownWritesTrigger in interface ColumnFamilyOptionsInterfacenumFiles - soft limit on number of level-0 files.public int levelZeroStopWritesTrigger()
ColumnFamilyOptionsInterfacelevelZeroStopWritesTrigger in interface ColumnFamilyOptionsInterfacepublic Options setLevelZeroStopWritesTrigger(int numFiles)
ColumnFamilyOptionsInterfacesetLevelZeroStopWritesTrigger in interface ColumnFamilyOptionsInterfacenumFiles - the hard limit of the number of level-0 files.public int maxMemCompactionLevel()
ColumnFamilyOptionsInterfacemaxMemCompactionLevel in interface ColumnFamilyOptionsInterfacepublic Options setMaxMemCompactionLevel(int maxMemCompactionLevel)
ColumnFamilyOptionsInterfacesetMaxMemCompactionLevel in interface ColumnFamilyOptionsInterfacemaxMemCompactionLevel - Unused.public long targetFileSizeBase()
MutableColumnFamilyOptionsInterfacetargetFileSizeBase in interface MutableColumnFamilyOptionsInterfaceMutableColumnFamilyOptionsInterface.targetFileSizeMultiplier()public Options setTargetFileSizeBase(long targetFileSizeBase)
MutableColumnFamilyOptionsInterfacesetTargetFileSizeBase in interface MutableColumnFamilyOptionsInterfacetargetFileSizeBase - the target size of a level-0 file.MutableColumnFamilyOptionsInterface.setTargetFileSizeMultiplier(int)public int targetFileSizeMultiplier()
MutableColumnFamilyOptionsInterfacetargetFileSizeMultiplier in interface MutableColumnFamilyOptionsInterfacepublic Options setTargetFileSizeMultiplier(int multiplier)
MutableColumnFamilyOptionsInterfacesetTargetFileSizeMultiplier in interface MutableColumnFamilyOptionsInterfacemultiplier - the size ratio between a level-(L+1) file
and level-L file.public Options setMaxBytesForLevelBase(long maxBytesForLevelBase)
MutableColumnFamilyOptionsInterfacesetMaxBytesForLevelBase in interface MutableColumnFamilyOptionsInterfacemaxBytesForLevelBase - maximum bytes for level base.MutableColumnFamilyOptionsInterface.setMaxBytesForLevelMultiplier(double)public long maxBytesForLevelBase()
MutableColumnFamilyOptionsInterfacemaxBytesForLevelBase in interface MutableColumnFamilyOptionsInterfaceMutableColumnFamilyOptionsInterface.maxBytesForLevelMultiplier()public Options setLevelCompactionDynamicLevelBytes(boolean enableLevelCompactionDynamicLevelBytes)
ColumnFamilyOptionsInterfaceIf 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 ColumnFamilyOptionsInterfaceenableLevelCompactionDynamicLevelBytes - boolean value indicating
if LevelCompactionDynamicLevelBytes shall be enabled.public boolean levelCompactionDynamicLevelBytes()
ColumnFamilyOptionsInterfaceReturn if LevelCompactionDynamicLevelBytes is enabled.
For further information see
ColumnFamilyOptionsInterface.setLevelCompactionDynamicLevelBytes(boolean)
levelCompactionDynamicLevelBytes in interface ColumnFamilyOptionsInterfacelevelCompactionDynamicLevelBytes is enabled.public double maxBytesForLevelMultiplier()
ColumnFamilyOptionsInterfacemaxBytesForLevelMultiplier in interface ColumnFamilyOptionsInterfacemaxBytesForLevelMultiplier in interface MutableColumnFamilyOptionsInterfaceMutableColumnFamilyOptionsInterface.maxBytesForLevelBase()public Options setMaxBytesForLevelMultiplier(double multiplier)
ColumnFamilyOptionsInterfacesetMaxBytesForLevelMultiplier in interface ColumnFamilyOptionsInterfacesetMaxBytesForLevelMultiplier in interface MutableColumnFamilyOptionsInterfacemultiplier - the ratio between the total size of level-(L+1)
files and the total size of level-L files for all L.MutableColumnFamilyOptionsInterface.setMaxBytesForLevelBase(long)public long maxCompactionBytes()
ColumnFamilyOptionsInterfacemaxCompactionBytes in interface ColumnFamilyOptionsInterfacemaxCompactionBytes in interface MutableColumnFamilyOptionsInterfaceMutableColumnFamilyOptionsInterface.setMaxCompactionBytes(long)public Options setMaxCompactionBytes(long maxCompactionBytes)
ColumnFamilyOptionsInterfacesetMaxCompactionBytes in interface ColumnFamilyOptionsInterfacesetMaxCompactionBytes in interface MutableColumnFamilyOptionsInterfacemaxCompactionBytes - the compaction size limitMutableColumnFamilyOptionsInterface.maxCompactionBytes()public double softRateLimit()
ColumnFamilyOptionsInterfacesoftRateLimit in interface ColumnFamilyOptionsInterfacesoftRateLimit in interface MutableColumnFamilyOptionsInterfacepublic Options setSoftRateLimit(double softRateLimit)
ColumnFamilyOptionsInterfacesetSoftRateLimit in interface ColumnFamilyOptionsInterfacesetSoftRateLimit in interface MutableColumnFamilyOptionsInterfacesoftRateLimit - the soft-rate-limit of a compaction score
for put delay.public double hardRateLimit()
ColumnFamilyOptionsInterfacehardRateLimit in interface ColumnFamilyOptionsInterfacehardRateLimit in interface MutableColumnFamilyOptionsInterfacepublic Options setHardRateLimit(double hardRateLimit)
ColumnFamilyOptionsInterfacesetHardRateLimit in interface ColumnFamilyOptionsInterfacesetHardRateLimit in interface MutableColumnFamilyOptionsInterfacehardRateLimit - the hard-rate-limit of a compaction score for put
delay.public int rateLimitDelayMaxMilliseconds()
ColumnFamilyOptionsInterfacerateLimitDelayMaxMilliseconds in interface ColumnFamilyOptionsInterfacepublic Options setRateLimitDelayMaxMilliseconds(int rateLimitDelayMaxMilliseconds)
ColumnFamilyOptionsInterfacesetRateLimitDelayMaxMilliseconds in interface ColumnFamilyOptionsInterfacerateLimitDelayMaxMilliseconds - the maximum time interval a put
will be stalled.public long arenaBlockSize()
MutableColumnFamilyOptionsInterfacearenaBlockSize in interface MutableColumnFamilyOptionsInterfacepublic Options setArenaBlockSize(long arenaBlockSize)
MutableColumnFamilyOptionsInterfacesetArenaBlockSize in interface MutableColumnFamilyOptionsInterfacearenaBlockSize - the size of an arena blockpublic boolean disableAutoCompactions()
MutableColumnFamilyOptionsInterfacedisableAutoCompactions in interface MutableColumnFamilyOptionsInterfacepublic Options setDisableAutoCompactions(boolean disableAutoCompactions)
MutableColumnFamilyOptionsInterfacesetDisableAutoCompactions in interface MutableColumnFamilyOptionsInterfacedisableAutoCompactions - true if auto-compactions are disabled.public boolean purgeRedundantKvsWhileFlush()
ColumnFamilyOptionsInterfacepurgeRedundantKvsWhileFlush in interface ColumnFamilyOptionsInterfacepublic Options setPurgeRedundantKvsWhileFlush(boolean purgeRedundantKvsWhileFlush)
ColumnFamilyOptionsInterfacesetPurgeRedundantKvsWhileFlush in interface ColumnFamilyOptionsInterfacepurgeRedundantKvsWhileFlush - true if purging keys is disabled.public boolean verifyChecksumsInCompaction()
MutableColumnFamilyOptionsInterfaceverifyChecksumsInCompaction in interface MutableColumnFamilyOptionsInterfacepublic Options setVerifyChecksumsInCompaction(boolean verifyChecksumsInCompaction)
MutableColumnFamilyOptionsInterfacesetVerifyChecksumsInCompaction in interface MutableColumnFamilyOptionsInterfaceverifyChecksumsInCompaction - true if compaction verifies
checksum on every read.public long maxSequentialSkipInIterations()
MutableColumnFamilyOptionsInterfacemaxSequentialSkipInIterations in interface MutableColumnFamilyOptionsInterfacepublic Options setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations)
MutableColumnFamilyOptionsInterfacesetMaxSequentialSkipInIterations in interface MutableColumnFamilyOptionsInterfacemaxSequentialSkipInIterations - the number of keys could
be skipped in a iteration.public boolean inplaceUpdateSupport()
ColumnFamilyOptionsInterfaceinplaceUpdateSupport in interface ColumnFamilyOptionsInterfacepublic Options setInplaceUpdateSupport(boolean inplaceUpdateSupport)
ColumnFamilyOptionsInterfacesetInplaceUpdateSupport in interface ColumnFamilyOptionsInterfaceinplaceUpdateSupport - true if thread-safe inplace updates
are allowed.public long inplaceUpdateNumLocks()
MutableColumnFamilyOptionsInterfaceinplaceUpdateNumLocks in interface MutableColumnFamilyOptionsInterfacepublic Options setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
MutableColumnFamilyOptionsInterfacesetInplaceUpdateNumLocks in interface MutableColumnFamilyOptionsInterfaceinplaceUpdateNumLocks - the number of locks used for
inplace updates.public double memtablePrefixBloomSizeRatio()
MutableColumnFamilyOptionsInterfacememtablePrefixBloomSizeRatio in interface MutableColumnFamilyOptionsInterfacepublic Options setMemtablePrefixBloomSizeRatio(double memtablePrefixBloomSizeRatio)
MutableColumnFamilyOptionsInterfacesetMemtablePrefixBloomSizeRatio in interface MutableColumnFamilyOptionsInterfacememtablePrefixBloomSizeRatio - The ratiopublic int bloomLocality()
ColumnFamilyOptionsInterfacebloomLocality in interface ColumnFamilyOptionsInterfaceColumnFamilyOptionsInterface.setBloomLocality(int)public Options setBloomLocality(int bloomLocality)
ColumnFamilyOptionsInterfacesetBloomLocality in interface ColumnFamilyOptionsInterfacebloomLocality - the level of locality of bloom-filter probes.public long maxSuccessiveMerges()
MutableColumnFamilyOptionsInterfacemaxSuccessiveMerges in interface MutableColumnFamilyOptionsInterfacepublic Options setMaxSuccessiveMerges(long maxSuccessiveMerges)
MutableColumnFamilyOptionsInterfacesetMaxSuccessiveMerges in interface MutableColumnFamilyOptionsInterfacemaxSuccessiveMerges - the maximum number of successive merges.public int minWriteBufferNumberToMerge()
ColumnFamilyOptionsInterfaceminWriteBufferNumberToMerge in interface ColumnFamilyOptionsInterfacepublic Options setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)
ColumnFamilyOptionsInterfacesetMinWriteBufferNumberToMerge in interface ColumnFamilyOptionsInterfaceminWriteBufferNumberToMerge - the minimum number of write buffers
that will be merged together.public int minPartialMergeOperands()
ColumnFamilyOptionsInterfaceminPartialMergeOperands in interface ColumnFamilyOptionsInterfacepublic Options setMinPartialMergeOperands(int minPartialMergeOperands)
ColumnFamilyOptionsInterfacesetMinPartialMergeOperands in interface ColumnFamilyOptionsInterfaceminPartialMergeOperands - min partial merge operandspublic Options setOptimizeFiltersForHits(boolean optimizeFiltersForHits)
ColumnFamilyOptionsInterfaceThis 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 ColumnFamilyOptionsInterfaceoptimizeFiltersForHits - boolean value indicating if this flag is set.public boolean optimizeFiltersForHits()
ColumnFamilyOptionsInterfaceReturns the current state of the optimize_filters_for_hits
setting.
optimizeFiltersForHits in interface ColumnFamilyOptionsInterfaceoptimize_filters_for_hits was set.public Options setMemtableHugePageSize(long memtableHugePageSize)
MutableColumnFamilyOptionsInterfacesetMemtableHugePageSize in interface MutableColumnFamilyOptionsInterfacememtableHugePageSize - The page size of the huge
page tlbpublic long memtableHugePageSize()
MutableColumnFamilyOptionsInterfacememtableHugePageSize in interface MutableColumnFamilyOptionsInterfacepublic Options setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit)
MutableColumnFamilyOptionsInterfacesetSoftPendingCompactionBytesLimit in interface MutableColumnFamilyOptionsInterfacesoftPendingCompactionBytesLimit - The soft limit to impose on
compactionpublic long softPendingCompactionBytesLimit()
MutableColumnFamilyOptionsInterfacesoftPendingCompactionBytesLimit in interface MutableColumnFamilyOptionsInterfacepublic Options setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)
MutableColumnFamilyOptionsInterfacesetHardPendingCompactionBytesLimit in interface MutableColumnFamilyOptionsInterfacehardPendingCompactionBytesLimit - The hard limit to impose on
compactionpublic long hardPendingCompactionBytesLimit()
MutableColumnFamilyOptionsInterfacehardPendingCompactionBytesLimit in interface MutableColumnFamilyOptionsInterfacepublic Options setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger)
MutableColumnFamilyOptionsInterfacesetLevel0FileNumCompactionTrigger in interface MutableColumnFamilyOptionsInterfacelevel0FileNumCompactionTrigger - The number of files to trigger
level-0 compactionpublic int level0FileNumCompactionTrigger()
MutableColumnFamilyOptionsInterfacelevel0FileNumCompactionTrigger in interface MutableColumnFamilyOptionsInterfacepublic Options setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger)
MutableColumnFamilyOptionsInterfacesetLevel0SlowdownWritesTrigger in interface MutableColumnFamilyOptionsInterfacelevel0SlowdownWritesTrigger - The soft limit on the number of
level-0 filespublic int level0SlowdownWritesTrigger()
MutableColumnFamilyOptionsInterfacelevel0SlowdownWritesTrigger in interface MutableColumnFamilyOptionsInterfacepublic MutableColumnFamilyOptionsInterface setLevel0StopWritesTrigger(int level0StopWritesTrigger)
MutableColumnFamilyOptionsInterfacesetLevel0StopWritesTrigger in interface MutableColumnFamilyOptionsInterfacelevel0StopWritesTrigger - The maximum number of level-0 filespublic int level0StopWritesTrigger()
MutableColumnFamilyOptionsInterfacelevel0StopWritesTrigger in interface MutableColumnFamilyOptionsInterfacepublic Options setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional)
MutableColumnFamilyOptionsInterfacesetMaxBytesForLevelMultiplierAdditional in interface MutableColumnFamilyOptionsInterfacemaxBytesForLevelMultiplierAdditional - The max-size multipliers
for each levelpublic int[] maxBytesForLevelMultiplierAdditional()
MutableColumnFamilyOptionsInterfacemaxBytesForLevelMultiplierAdditional in interface MutableColumnFamilyOptionsInterfacepublic Options setParanoidFileChecks(boolean paranoidFileChecks)
MutableColumnFamilyOptionsInterfacesetParanoidFileChecks in interface MutableColumnFamilyOptionsInterfaceparanoidFileChecks - true to enable paranoid file checkspublic boolean paranoidFileChecks()
MutableColumnFamilyOptionsInterfaceparanoidFileChecks in interface MutableColumnFamilyOptionsInterfaceprotected final void disposeInternal(long handle)
disposeInternal in class RocksObject