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 |
allowIngestBehind()
Returns true if ingest behind is allowed.
|
boolean |
allowMmapReads()
Allow the OS to mmap file for reading sst tables.
|
boolean |
allowMmapWrites()
Allow the OS to mmap file for writing.
|
boolean |
atomicFlush()
Determine if atomic flush of multiple column families is enabled.
|
boolean |
avoidFlushDuringRecovery()
By default RocksDB replay WAL logs and flush them on DB open, which may
create very small SST files.
|
boolean |
avoidUnnecessaryBlockingIO()
If true, working thread may avoid doing unnecessary and long-latency
operation (such as deleting obsolete files directly or deleting memtable)
and will instead schedule a background job to do it.
|
boolean |
bestEffortsRecovery()
By default, RocksDB recovery fails if any table file referenced in
MANIFEST are missing after scanning the MANIFEST.
|
long |
bgerrorResumeRetryInterval()
If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.
|
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 |
deleteObsoleteFilesPeriodMicros()
The periodicity when obsolete files get deleted.
|
boolean |
dumpMallocStats()
If true, then print malloc stats together with rocksdb.stats
when printing to LOG.
|
boolean |
enablePipelinedWrite()
Returns true if pipelined writes are enabled.
|
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
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.
|
Env |
getEnv()
Returns the set RocksEnv instance.
|
InfoLogLevel |
infoLogLevel()
Returns currently set log level.
|
boolean |
isFdCloseOnExec()
Disable child process inherit open files.
|
long |
keepLogFileNum()
Returns the maximum number of info log files to be kept.
|
java.util.List<AbstractEventListener> |
listeners()
Sets the
EventListener s whose callback functions
will be called when specific RocksDB event happens. |
long |
logFileTimeToRoll()
Returns the time interval for the info log file to roll (in seconds).
|
long |
logReadaheadSize()
The number of bytes to prefetch when reading the log.
|
long |
manifestPreallocationSize()
Number of bytes to preallocate (via fallocate) the manifest
files.
|
boolean |
manualWalFlush()
Returns true if automatic WAL flushing is disabled.
|
int |
maxBackgroundFlushes()
Deprecated.
|
int |
maxBgerrorResumeCount()
It defines how many times db resume is called by a separate thread when
background retryable IO Error happens.
|
int |
maxFileOpeningThreads()
If
MutableDBOptionsInterface.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 |
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 |
maxWriteBatchGroupSizeBytes()
The maximum limit of number of bytes that are written in a single batch
of WAL or memtable write.
|
T |
optimizeForSmallDb()
Use this if your DB is very small (like under 1GB) and you don't want to
spend lots of memory for memtables.
|
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 |
persistStatsToDisk()
If true, automatically persist stats to a hidden column family (column
family name: ___rocksdb_stats_history___) every
stats_persist_period_sec seconds; otherwise, write to an in-memory
struct.
|
long |
randomAccessMaxBufferSize()
This is a maximum buffer size that is used by WinMmapReadableFile in
unbuffered disk I/O mode.
|
long |
recycleLogFileNum()
Recycle log files.
|
Cache |
rowCache()
A global cache for table-level rows.
|
T |
setAccessHintOnCompactionStart(AccessHint accessHint)
Specify the file access pattern once a compaction is started.
|
T |
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.
|
T |
setAllow2pc(boolean allow2pc)
if set to false then recovery will fail when a prepared
transaction is encountered in the WAL
Default: false
|
T |
setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
If true, allow multi-writers to update mem tables in parallel.
|
T |
setAllowFAllocate(boolean allowFAllocate)
Whether fallocate calls are allowed
|
T |
setAllowIngestBehind(boolean allowIngestBehind)
Set this option to true during creation of database if you want
to be able to ingest behind (call IngestExternalFile() skipping keys
that already exist, rather than overwriting matching keys).
|
T |
setAllowMmapReads(boolean allowMmapReads)
Allow the OS to mmap file for reading sst tables.
|
T |
setAllowMmapWrites(boolean allowMmapWrites)
Allow the OS to mmap file for writing.
|
T |
setAtomicFlush(boolean atomicFlush)
If true, RocksDB supports flushing multiple column families and committing
their results atomically to MANIFEST.
|
T |
setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
By default RocksDB replay WAL logs and flush them on DB open, which may
create very small SST files.
|
T |
setAvoidUnnecessaryBlockingIO(boolean avoidUnnecessaryBlockingIO)
If true, working thread may avoid doing unnecessary and long-latency
operation (such as deleting obsolete files directly or deleting memtable)
and will instead schedule a background job to do it.
|
T |
setBestEffortsRecovery(boolean bestEffortsRecovery)
By default, RocksDB recovery fails if any table file referenced in
MANIFEST are missing after scanning the MANIFEST.
|
T |
setBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)
If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.
|
T |
setCreateIfMissing(boolean flag)
If this value is set to true, then the database will be created
if it is missing during
RocksDB.open() . |
T |
setCreateMissingColumnFamilies(boolean flag)
If true, missing column families will be automatically created
|
T |
setDbLogDir(java.lang.String dbLogDir)
This specifies the info LOG dir.
|
T |
setDbPaths(java.util.Collection<DbPath> dbPaths)
A list of paths where SST files can be put into, with its target size.
|
T |
setDbWriteBufferSize(long dbWriteBufferSize)
Amount of data to build up in memtables across all column
families before writing to disk.
|
T |
setDeleteObsoleteFilesPeriodMicros(long micros)
The periodicity when obsolete files get deleted.
|
T |
setDumpMallocStats(boolean dumpMallocStats)
If true, then print malloc stats together with rocksdb.stats
when printing to LOG.
|
T |
setEnablePipelinedWrite(boolean enablePipelinedWrite)
By default, a single write thread queue is maintained.
|
T |
setEnableThreadTracking(boolean enableThreadTracking)
If true, then the status of the threads involved in this DB will
be tracked and available via GetThreadList() API.
|
T |
setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
If true, threads synchronizing with the write batch group leader will
wait for up to
writeThreadMaxYieldUsec() before blocking on a
mutex. |
T |
setEnv(Env env)
Use the specified object to interact with the environment,
e.g.
|
T |
setErrorIfExists(boolean errorIfExists)
If true, an error will be thrown during RocksDB.open() if the
database already exists.
|
T |
setFailIfOptionsFileError(boolean failIfOptionsFileError)
If true, then DB::Open / CreateColumnFamily / DropColumnFamily
/ SetOptions will fail if options file is not detected or properly
persisted.
|
T |
setIncreaseParallelism(int totalThreads)
By default, RocksDB uses only one background thread for flush and
compaction.
|
T |
setInfoLogLevel(InfoLogLevel infoLogLevel)
Sets the RocksDB log level.
|
T |
setIsFdCloseOnExec(boolean isFdCloseOnExec)
Disable child process inherit open files.
|
T |
setKeepLogFileNum(long keepLogFileNum)
Specifies the maximum number of info log files to be kept.
|
T |
setListeners(java.util.List<AbstractEventListener> listeners)
Sets the
EventListener s whose callback functions
will be called when specific RocksDB event happens. |
T |
setLogFileTimeToRoll(long logFileTimeToRoll)
Specifies the time interval for the info log file to roll (in seconds).
|
T |
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.
|
T |
setLogReadaheadSize(long logReadaheadSize)
The number of bytes to prefetch when reading the log.
|
T |
setManifestPreallocationSize(long size)
Number of bytes to preallocate (via fallocate) the manifest
files.
|
T |
setManualWalFlush(boolean manualWalFlush)
If true WAL is not flushed automatically after each write.
|
T |
setMaxBackgroundFlushes(int maxBackgroundFlushes)
Deprecated.
|
T |
setMaxBgErrorResumeCount(int maxBgerrorResumeCount)
It defines how many times db resume is called by a separate thread when
background retryable IO Error happens.
|
T |
setMaxFileOpeningThreads(int maxFileOpeningThreads)
If
MutableDBOptionsInterface.maxOpenFiles() is -1, DB will open
all files on DB::Open(). |
T |
setMaxLogFileSize(long maxLogFileSize)
Specifies the maximum size of a info log file.
|
T |
setMaxManifestFileSize(long maxManifestFileSize)
Manifest file is rolled over on reaching this limit.
|
T |
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.
|
T |
setMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)
The maximum limit of number of bytes that are written in a single batch
of WAL or memtable write.
|
T |
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.
|
T |
setPersistStatsToDisk(boolean persistStatsToDisk)
If true, automatically persist stats to a hidden column family (column
family name: ___rocksdb_stats_history___) every
stats_persist_period_sec seconds; otherwise, write to an in-memory
struct.
|
T |
setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
This is a maximum buffer size that is used by WinMmapReadableFile in
unbuffered disk I/O mode.
|
T |
setRateLimiter(RateLimiter rateLimiter)
Use to control write rate of flush and compaction.
|
T |
setRecycleLogFileNum(long recycleLogFileNum)
Recycle log files.
|
T |
setRowCache(Cache rowCache)
A global cache for table-level rows.
|
T |
setSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)
If true, then
RocksDB.open(String) will not fetch and check sizes of all sst files. |
T |
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.
|
T |
setSstFileManager(SstFileManager sstFileManager)
Use to track SST files and control their file deletion rate.
|
T |
setStatistics(Statistics statistics)
Sets the statistics object which collects metrics about database operations.
|
T |
setTableCacheNumshardbits(int tableCacheNumshardbits)
Number of shards used for table cache.
|
T |
setTwoWriteQueues(boolean twoWriteQueues)
If enabled it uses two queues for writes, one for the ones with
disable_memtable and one for the ones that also write to memtable.
|
T |
setUnorderedWrite(boolean unorderedWrite)
Setting
unorderedWrite() to true trades higher write throughput with
relaxing the immutability guarantee of snapshots. |
T |
setUseAdaptiveMutex(boolean useAdaptiveMutex)
Use adaptive mutex, which spins in the user space before resorting
to kernel.
|
T |
setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
Enable the OS to use direct reads and writes in flush and
compaction
Default: false
|
T |
setUseDirectReads(boolean useDirectReads)
Enable the OS to use direct I/O for reading sst tables.
|
T |
setUseFsync(boolean useFsync)
If true, then every store to stable storage will issue a fsync.
|
T |
setWalDir(java.lang.String walDir)
This specifies the absolute dir path for write-ahead logs (WAL).
|
T |
setWalFilter(AbstractWalFilter walFilter)
A filter object supplied to be invoked while processing write-ahead-logs
(WALs) during recovery.
|
T |
setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
Recovery mode to control the consistency while replaying WAL
Default:
WALRecoveryMode.PointInTimeRecovery |
T |
setWalSizeLimitMB(long sizeLimitMB)
WalTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted.
|
T |
setWalTtlSeconds(long walTtlSeconds)
walTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted. |
T |
setWriteBufferManager(WriteBufferManager writeBufferManager)
Use passed
WriteBufferManager to control memory usage across
multiple column families and/or DB instances. |
T |
setWriteDbidToManifest(boolean writeDbidToManifest)
Historically DB ID has always been stored in Identity File in DB folder.
|
T |
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.
|
T |
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 |
skipCheckingSstFileSizesOnDbOpen()
If true, then
RocksDB.open(String) will not fetch and check sizes of all sst files. |
boolean |
skipStatsUpdateOnDbOpen()
If true, then DB::Open() will not update the statistics used to optimize
compaction decision by loading table properties from many files.
|
Statistics |
statistics()
Returns statistics object.
|
int |
tableCacheNumshardbits()
Number of shards used for table cache.
|
boolean |
twoWriteQueues()
Returns true if two write queues are enabled.
|
boolean |
unorderedWrite()
Returns true if unordered write are enabled.
|
boolean |
useAdaptiveMutex()
Use adaptive mutex, which spins in the user space before resorting
to kernel.
|
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.
|
boolean |
useFsync()
If true, then every store to stable storage will issue a fsync.
|
java.lang.String |
walDir()
Returns the path to the write-ahead-logs (WAL) directory.
|
WalFilter |
walFilter()
Get's the filter for processing WALs during recovery.
|
WALRecoveryMode |
walRecoveryMode()
Recovery mode to control the consistency while replaying WAL
Default:
WALRecoveryMode.PointInTimeRecovery |
long |
walSizeLimitMB()
walTtlSeconds() and #walSizeLimitMB() affect how archived logs
will be deleted. |
long |
walTtlSeconds()
WalTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted.
|
WriteBufferManager |
writeBufferManager()
Reference to
WriteBufferManager used by it. |
boolean |
writeDbidToManifest()
Historically DB ID has always been stored in Identity File in DB folder.
|
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.
|
T optimizeForSmallDb()
T setEnv(Env env)
Env.getDefault()
env
- Env
instance.Env getEnv()
RocksEnv
instance set in the options.T setIncreaseParallelism(int totalThreads)
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.
totalThreads
- The total number of threads to be used by RocksDB.
A good value is the number of cores.T setCreateIfMissing(boolean flag)
RocksDB.open()
.
Default: falseflag
- 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)
boolean createIfMissing()
setCreateIfMissing(boolean)
T setCreateMissingColumnFamilies(boolean flag)
If true, missing column families will be automatically created
Default: false
flag
- a flag indicating if missing column families shall be
created automatically.boolean createMissingColumnFamilies()
setCreateMissingColumnFamilies(boolean)
T setErrorIfExists(boolean errorIfExists)
errorIfExists
- if true, an exception will be thrown
during RocksDB.open()
if the database already exists.RocksDB.open(org.rocksdb.Options, String)
boolean errorIfExists()
T setParanoidChecks(boolean paranoidChecks)
paranoidChecks
- a flag to indicate whether paranoid-check
is on.boolean paranoidChecks()
T setRateLimiter(RateLimiter rateLimiter)
rateLimiter
- RateLimiter
instance.T setSstFileManager(SstFileManager sstFileManager)
sstFileManager
- The SST File Manager for the db.T 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.
Default: nullptr
logger
- Logger
instance.T setInfoLogLevel(InfoLogLevel infoLogLevel)
Sets the RocksDB log level. Default level is INFO
infoLogLevel
- log level to set.InfoLogLevel infoLogLevel()
Returns currently set log level.
InfoLogLevel
instance.T setMaxFileOpeningThreads(int maxFileOpeningThreads)
MutableDBOptionsInterface.maxOpenFiles()
is -1, DB will open
all files on DB::Open(). You can use this option to increase the number
of threads used to open the files.
Default: 16maxFileOpeningThreads
- the maximum number of threads to use to
open filesint maxFileOpeningThreads()
MutableDBOptionsInterface.maxOpenFiles()
is -1, DB will open all
files on DB::Open(). You can use this option to increase the number of
threads used to open the files.
Default: 16T setStatistics(Statistics statistics)
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.
statistics
- The statistics to setRocksDB.open(org.rocksdb.Options, String)
Statistics statistics()
Returns statistics object.
setStatistics(Statistics)
T setUseFsync(boolean useFsync)
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
useFsync
- a boolean flag to specify whether to use fsyncboolean useFsync()
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.
T setDbPaths(java.util.Collection<DbPath> dbPaths)
dbPaths
- the paths and target sizesjava.util.List<DbPath> dbPaths()
Collections.emptyList()
T setDbLogDir(java.lang.String dbLogDir)
dbLogDir
- the path to the info log directoryjava.lang.String dbLogDir()
T setWalDir(java.lang.String walDir)
walDir
- the path to the write-ahead-log directory.java.lang.String walDir()
T setDeleteObsoleteFilesPeriodMicros(long micros)
micros
- the time interval in microslong deleteObsoleteFilesPeriodMicros()
T setMaxSubcompactions(int maxSubcompactions)
maxSubcompactions
- The maximum number of threads that will
concurrently perform a compaction jobint maxSubcompactions()
@Deprecated T setMaxBackgroundFlushes(int maxBackgroundFlushes)
MutableDBOptionsInterface.setMaxBackgroundJobs(int)
maxBackgroundFlushes
- number of max concurrent flush jobsEnv.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, Priority)
,
MutableDBOptionsInterface.maxBackgroundCompactions()
@Deprecated int maxBackgroundFlushes()
Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, Priority)
T setMaxLogFileSize(long maxLogFileSize)
maxLogFileSize
- the maximum size of a info log file.java.lang.IllegalArgumentException
- thrown on 32-Bit platforms
while overflowing the underlying platform specific value.long maxLogFileSize()
T setLogFileTimeToRoll(long logFileTimeToRoll)
logFileTimeToRoll
- the time interval in seconds.java.lang.IllegalArgumentException
- thrown on 32-Bit platforms
while overflowing the underlying platform specific value.long logFileTimeToRoll()
T setKeepLogFileNum(long keepLogFileNum)
keepLogFileNum
- the maximum number of info log files to be kept.java.lang.IllegalArgumentException
- thrown on 32-Bit platforms
while overflowing the underlying platform specific value.long keepLogFileNum()
T setRecycleLogFileNum(long recycleLogFileNum)
recycleLogFileNum
- the number of log files to keep for recyclinglong recycleLogFileNum()
T setMaxManifestFileSize(long maxManifestFileSize)
maxManifestFileSize
- the size limit of a manifest file.long maxManifestFileSize()
T setTableCacheNumshardbits(int tableCacheNumshardbits)
tableCacheNumshardbits
- the number of chardsint tableCacheNumshardbits()
T setWalTtlSeconds(long walTtlSeconds)
walTtlSeconds()
and walSizeLimitMB()
affect how archived logs
will be deleted.
walTtlSeconds
- the ttl secondssetWalSizeLimitMB(long)
long walTtlSeconds()
walSizeLimitMB()
T setWalSizeLimitMB(long sizeLimitMB)
sizeLimitMB
- size limit in mega-bytes.setWalSizeLimitMB(long)
long walSizeLimitMB()
walTtlSeconds()
and #walSizeLimitMB()
affect how archived logs
will be deleted.
walSizeLimitMB()
T setMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)
maxWriteBatchGroupSizeBytes
- the maximum limit of number of bytes, see description.long maxWriteBatchGroupSizeBytes()
T setManifestPreallocationSize(long size)
size
- the size in bytejava.lang.IllegalArgumentException
- thrown on 32-Bit platforms
while overflowing the underlying platform specific value.long manifestPreallocationSize()
T setUseDirectReads(boolean useDirectReads)
useDirectReads
- if true, then direct read is enabledboolean useDirectReads()
T setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
useDirectIoForFlushAndCompaction
- if true, then direct
I/O will be enabled for background flush and compactionsboolean useDirectIoForFlushAndCompaction()
T setAllowFAllocate(boolean allowFAllocate)
allowFAllocate
- false if fallocate() calls are bypassedboolean allowFAllocate()
T setAllowMmapReads(boolean allowMmapReads)
allowMmapReads
- true if mmap reads are allowed.boolean allowMmapReads()
T setAllowMmapWrites(boolean allowMmapWrites)
allowMmapWrites
- true if mmap writes are allowd.boolean allowMmapWrites()
T setIsFdCloseOnExec(boolean isFdCloseOnExec)
isFdCloseOnExec
- true if child process inheriting open
files is disabled.boolean isFdCloseOnExec()
T setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
adviseRandomOnOpen
- true if hinting random access is on.boolean adviseRandomOnOpen()
T setDbWriteBufferSize(long dbWriteBufferSize)
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
- the size of the write bufferT setWriteBufferManager(WriteBufferManager writeBufferManager)
WriteBufferManager
to control memory usage across
multiple column families and/or DB instances.
Check
https://github.com/facebook/rocksdb/wiki/Write-Buffer-Manager
for more details on when to use itwriteBufferManager
- The WriteBufferManager to useWriteBufferManager writeBufferManager()
WriteBufferManager
used by it. long dbWriteBufferSize()
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)T setAccessHintOnCompactionStart(AccessHint accessHint)
AccessHint.NORMAL
accessHint
- The access hintAccessHint accessHintOnCompactionStart()
AccessHint.NORMAL
T setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
MutableDBOptionsInterface.compactionReadaheadSize()
value and
always try to read ahead.
With read-ahead we always pre-allocate buffer to the size instead of
growing it up to a limit.
This option is currently honored only on Windows
Default: 1 Mb
Special value: 0 - means do not maintain per instance buffer. Allocate
per request buffer and avoid locking.randomAccessMaxBufferSize
- the maximum size of the random access
bufferlong randomAccessMaxBufferSize()
MutableDBOptionsInterface.compactionReadaheadSize()
value and
always try to read ahead. With read-ahead we always pre-allocate buffer
to the size instead of growing it up to a limit.
This option is currently honored only on Windows
Default: 1 Mb
Special value: 0 - means do not maintain per instance buffer. Allocate
per request buffer and avoid locking.T setUseAdaptiveMutex(boolean useAdaptiveMutex)
useAdaptiveMutex
- true if adaptive mutex is used.boolean useAdaptiveMutex()
T setListeners(java.util.List<AbstractEventListener> listeners)
EventListener
s whose callback functions
will be called when specific RocksDB event happens.
Note: the RocksJava API currently only supports EventListeners implemented in Java.
It could be extended in future to also support adding/removing EventListeners implemented in
C++.listeners
- the listeners who should be notified on various events.java.util.List<AbstractEventListener> listeners()
EventListener
s whose callback functions
will be called when specific RocksDB event happens.
Note: the RocksJava API currently only supports EventListeners implemented in Java.
It could be extended in future to also support adding/removing EventListeners implemented in
C++.T setEnableThreadTracking(boolean enableThreadTracking)
enableThreadTracking
- true to enable trackingboolean enableThreadTracking()
T setEnablePipelinedWrite(boolean enablePipelinedWrite)
enablePipelinedWrite()
is true, separate write thread queue is
maintained for WAL write and memtable write. A write thread first enter WAL
writer queue and then memtable writer queue. Pending thread on the WAL
writer queue thus only have to wait for previous writers to finish their
WAL writing but not the memtable writing. Enabling the feature may improve
write throughput and reduce latency of the prepare phase of two-phase
commit.
Default: falseenablePipelinedWrite
- true to enabled pipelined writesboolean enablePipelinedWrite()
setEnablePipelinedWrite(boolean)
.T setUnorderedWrite(boolean unorderedWrite)
unorderedWrite()
to true trades higher write throughput with
relaxing the immutability guarantee of snapshots. This violates the
repeatability one expects from ::Get from a snapshot, as well as
::MultiGet and Iterator's consistent-point-in-time view property.
If the application cannot tolerate the relaxed guarantees, it can implement
its own mechanisms to work around that and yet benefit from the higher
throughput. Using TransactionDB with WRITE_PREPARED write policy and
twoWriteQueues()
true is one way to achieve immutable snapshots despite
unordered_write.
By default, i.e., when it is false, rocksdb does not advance the sequence
number for new snapshots unless all the writes with lower sequence numbers
are already finished. This provides the immutability that we except from
snapshots. Moreover, since Iterator and MultiGet internally depend on
snapshots, the snapshot immutability results into Iterator and MultiGet
offering consistent-point-in-time view. If set to true, although
Read-Your-Own-Write property is still provided, the snapshot immutability
property is relaxed: the writes issued after the snapshot is obtained (with
larger sequence numbers) will be still not visible to the reads from that
snapshot, however, there still might be pending writes (with lower sequence
number) that will change the state visible to the snapshot after they are
landed to the memtable.unorderedWrite
- true to enabled unordered writeboolean unorderedWrite()
setUnorderedWrite(boolean)
.T setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
setEnableWriteThreadAdaptiveYield(boolean)
if you are going to use
this feature.
Default: trueallowConcurrentMemtableWrite
- true to enable concurrent writes
for the memtableboolean allowConcurrentMemtableWrite()
setEnableWriteThreadAdaptiveYield(boolean)
if you are going to use
this feature.
Default: trueT setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
writeThreadMaxYieldUsec()
before blocking on a
mutex. This can substantially improve throughput for concurrent workloads,
regardless of whether allowConcurrentMemtableWrite()
is enabled.
Default: trueenableWriteThreadAdaptiveYield
- true to enable adaptive yield for the
write threadsboolean enableWriteThreadAdaptiveYield()
writeThreadMaxYieldUsec()
before blocking on a
mutex. This can substantially improve throughput for concurrent workloads,
regardless of whether allowConcurrentMemtableWrite()
is enabled.
Default: trueT setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
writeThreadSlowYieldUsec()
is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100writeThreadMaxYieldUsec
- maximum number of microsecondslong writeThreadMaxYieldUsec()
writeThreadSlowYieldUsec()
is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100T setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
writeThreadSlowYieldUsec
- the latency in microsecondslong writeThreadSlowYieldUsec()
T setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
skipStatsUpdateOnDbOpen
- true if updating stats will be skippedboolean skipStatsUpdateOnDbOpen()
T setSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)
RocksDB.open(String)
will not fetch and check sizes of all sst files.
This may significantly speed up startup if there are many sst files,
especially when using non-default Env with expensive GetFileSize().
We'll still check that all required sst files exist.
If paranoid_checks
is false, this option is ignored, and sst files are
not checked at all.
Default: falseskipCheckingSstFileSizesOnDbOpen
- if true, then SST file sizes will not be checked
when calling RocksDB.open(String)
.boolean skipCheckingSstFileSizesOnDbOpen()
RocksDB.open(String)
will not fetch and check sizes of all sst files.
This may significantly speed up startup if there are many sst files,
especially when using non-default Env with expensive GetFileSize().
We'll still check that all required sst files exist.
If paranoid_checks
is false, this option is ignored, and sst files are
not checked at all.
Default: falseRocksDB.open(String)
.T setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
WALRecoveryMode.PointInTimeRecovery
walRecoveryMode
- The WAL recover modeWALRecoveryMode walRecoveryMode()
WALRecoveryMode.PointInTimeRecovery
T setAllow2pc(boolean allow2pc)
allow2pc
- true if two-phase-commit is enabledboolean allow2pc()
T setRowCache(Cache rowCache)
rowCache
- The global row cacheCache rowCache()
T setWalFilter(AbstractWalFilter walFilter)
walFilter
- the filter for processing WALs during recovery.WalFilter walFilter()
setWalFilter(AbstractWalFilter)
.T setFailIfOptionsFileError(boolean failIfOptionsFileError)
failIfOptionsFileError
- true if we should fail if there is an error
in the options fileboolean failIfOptionsFileError()
T setDumpMallocStats(boolean dumpMallocStats)
dumpMallocStats
- true if malloc stats should be printed to LOGboolean dumpMallocStats()
T setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
avoidFlushDuringRecovery
- true to try to avoid (but not guarantee
not to) flush during recoveryboolean avoidFlushDuringRecovery()
T setAllowIngestBehind(boolean allowIngestBehind)
allowIngestBehind
- true to allow ingest behind, false to disallow.boolean allowIngestBehind()
setAllowIngestBehind(boolean)
.T setTwoWriteQueues(boolean twoWriteQueues)
twoWriteQueues
- true to enable two write queues, false otherwise.boolean twoWriteQueues()
T setManualWalFlush(boolean manualWalFlush)
manualWalFlush
- true to set disable automatic WAL flushing,
false otherwise.boolean manualWalFlush()
setManualWalFlush(boolean)
.T setAtomicFlush(boolean atomicFlush)
RocksDB.flush(FlushOptions, List)
.
For auto-triggered flush, RocksDB atomically flushes ALL column families.
Currently, any WAL-enabled writes after atomic flush may be replayed
independently if the process crashes later and tries to recover.atomicFlush
- true to enable atomic flush of multiple column families.boolean atomicFlush()
setAtomicFlush(boolean)
.T setAvoidUnnecessaryBlockingIO(boolean avoidUnnecessaryBlockingIO)
ReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean)
.avoidUnnecessaryBlockingIO
- If true, working thread may avoid doing unnecessary
operation.boolean avoidUnnecessaryBlockingIO()
ReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean)
.T setPersistStatsToDisk(boolean persistStatsToDisk)
persistStatsToDisk
- true if stats should be persisted to hidden column family.boolean persistStatsToDisk()
T setWriteDbidToManifest(boolean writeDbidToManifest)
writeDbidToManifest
- if true, then DB ID will be written to Manifest file.boolean writeDbidToManifest()
T setLogReadaheadSize(long logReadaheadSize)
logReadaheadSize
- the number of bytes to prefetch when reading the log.long logReadaheadSize()
T setBestEffortsRecovery(boolean bestEffortsRecovery)
bestEffortsRecovery
- if true, RocksDB will use best-efforts mode when recovering.boolean bestEffortsRecovery()
T setMaxBgErrorResumeCount(int maxBgerrorResumeCount)
maxBgerrorResumeCount
- maximum number of times db resume should be called when IO Error
happens.int maxBgerrorResumeCount()
T setBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)
bgerrorResumeRetryInterval
- how many microseconds to wait between DB resume attempts.long bgerrorResumeRetryInterval()