public class DBOptions extends RocksObject implements DBOptionsInterface<DBOptions>
RocksDB
(i.e., RocksDB.open()).
If AbstractNativeReference.dispose()
function is not called, then it will be GC'd
automatically and native resources will be released as part of the process.nativeHandle_
Constructor and Description |
---|
DBOptions()
Construct DBOptions.
|
DBOptions(DBOptions other)
Copy constructor for DBOptions.
|
Modifier and Type | Method and Description |
---|---|
AccessHint |
accessHintOnCompactionStart()
Specify the file access pattern once a compaction is started.
|
boolean |
adviseRandomOnOpen()
If set true, will hint the underlying file system that the file
access pattern is random, when a sst file is opened.
|
boolean |
allow2pc()
if set to false then recovery will fail when a prepared
transaction is encountered in the WAL
Default: false
|
boolean |
allowConcurrentMemtableWrite()
If true, allow multi-writers to update mem tables in parallel.
|
boolean |
allowFAllocate()
Whether fallocate calls are allowed
|
boolean |
allowMmapReads()
Allow the OS to mmap file for reading sst tables.
|
boolean |
allowMmapWrites()
Allow the OS to mmap file for writing.
|
boolean |
avoidFlushDuringRecovery()
By default RocksDB replay WAL logs and flush them on DB open, which may
create very small SST files.
|
boolean |
avoidFlushDuringShutdown()
By default RocksDB will flush all memtables on DB close if there are
unpersisted data (i.e.
|
int |
baseBackgroundCompactions()
Suggested number of concurrent background compaction jobs, submitted to
the default LOW priority thread pool.
|
long |
bytesPerSync()
Allows OS to incrementally sync files to disk while they are being
written, asynchronously, in the background.
|
long |
compactionReadaheadSize()
If non-zero, we perform bigger reads when doing compaction.
|
boolean |
createIfMissing()
Return true if the create_if_missing flag is set to true.
|
boolean |
createMissingColumnFamilies()
Return true if the create_missing_column_families flag is set
to true.
|
java.lang.String |
dbLogDir()
Returns the directory of info log.
|
java.util.List<DbPath> |
dbPaths()
A list of paths where SST files can be put into, with its target size.
|
long |
dbWriteBufferSize()
Amount of data to build up in memtables across all column
families before writing to disk.
|
long |
delayedWriteRate()
The limited write rate to DB if
ColumnFamilyOptions.softPendingCompactionBytesLimit() or
ColumnFamilyOptions.level0SlowdownWritesTrigger() is triggered,
or we are writing to the last mem table allowed and we allow more than 3
mem tables. |
long |
deleteObsoleteFilesPeriodMicros()
The periodicity when obsolete files get deleted.
|
protected void |
disposeInternal(long handle) |
boolean |
dumpMallocStats()
If true, then print malloc stats together with rocksdb.stats
when printing to LOG.
|
boolean |
enableThreadTracking()
If true, then the status of the threads involved in this DB will
be tracked and available via GetThreadList() API.
|
boolean |
enableWriteThreadAdaptiveYield()
If true, threads synchronizing with the write batch group leader will
wait for up to
DBOptionsInterface.writeThreadMaxYieldUsec() before blocking on a
mutex. |
boolean |
errorIfExists()
If true, an error will be thrown during RocksDB.open() if the
database already exists.
|
boolean |
failIfOptionsFileError()
If true, then DB::Open / CreateColumnFamily / DropColumnFamily
/ SetOptions will fail if options file is not detected or properly
persisted.
|
static DBOptions |
getDBOptionsFromProps(java.util.Properties properties)
Method to get a options instance by using pre-configured
property values.
|
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.
|
long |
logFileTimeToRoll()
Returns the time interval for the info log file to roll (in seconds).
|
long |
manifestPreallocationSize()
Number of bytes to preallocate (via fallocate) the manifest
files.
|
int |
maxBackgroundCompactions()
Returns the maximum number of concurrent background compaction jobs,
submitted to the default LOW priority thread pool.
|
int |
maxBackgroundFlushes()
Returns the maximum number of concurrent background flush jobs.
|
int |
maxBackgroundJobs()
Returns the maximum number of concurrent background jobs (both flushes
and compactions combined).
|
int |
maxFileOpeningThreads()
If
DBOptionsInterface.maxOpenFiles() is -1, DB will open all files on DB::Open(). |
long |
maxLogFileSize()
Returns the maximum size of a info log file.
|
long |
maxManifestFileSize()
Manifest file is rolled over on reaching this limit.
|
int |
maxOpenFiles()
Number of open files that can be used by the DB.
|
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 |
maxTotalWalSize()
Returns the max total wal size.
|
boolean |
newTableReaderForCompactionInputs()
If true, always create a new file descriptor and new table reader
for compaction inputs.
|
DBOptions |
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.
|
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.
|
DBOptions |
setAccessHintOnCompactionStart(AccessHint accessHint)
Specify the file access pattern once a compaction is started.
|
DBOptions |
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.
|
DBOptions |
setAllow2pc(boolean allow2pc)
if set to false then recovery will fail when a prepared
transaction is encountered in the WAL
Default: false
|
DBOptions |
setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
If true, allow multi-writers to update mem tables in parallel.
|
DBOptions |
setAllowFAllocate(boolean allowFAllocate)
Whether fallocate calls are allowed
|
DBOptions |
setAllowMmapReads(boolean allowMmapReads)
Allow the OS to mmap file for reading sst tables.
|
DBOptions |
setAllowMmapWrites(boolean allowMmapWrites)
Allow the OS to mmap file for writing.
|
DBOptions |
setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
By default RocksDB replay WAL logs and flush them on DB open, which may
create very small SST files.
|
DBOptions |
setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
By default RocksDB will flush all memtables on DB close if there are
unpersisted data (i.e.
|
void |
setBaseBackgroundCompactions(int baseBackgroundCompactions)
Suggested number of concurrent background compaction jobs, submitted to
the default LOW priority thread pool.
|
DBOptions |
setBytesPerSync(long bytesPerSync)
Allows OS to incrementally sync files to disk while they are being
written, asynchronously, in the background.
|
DBOptions |
setCompactionReadaheadSize(long compactionReadaheadSize)
If non-zero, we perform bigger reads when doing compaction.
|
DBOptions |
setCreateIfMissing(boolean flag)
If this value is set to true, then the database will be created
if it is missing during
RocksDB.open() . |
DBOptions |
setCreateMissingColumnFamilies(boolean flag)
If true, missing column families will be automatically created
|
DBOptions |
setDbLogDir(java.lang.String dbLogDir)
This specifies the info LOG dir.
|
DBOptions |
setDbPaths(java.util.Collection<DbPath> dbPaths)
A list of paths where SST files can be put into, with its target size.
|
DBOptions |
setDbWriteBufferSize(long dbWriteBufferSize)
Amount of data to build up in memtables across all column
families before writing to disk.
|
DBOptions |
setDelayedWriteRate(long delayedWriteRate)
The limited write rate to DB if
ColumnFamilyOptions.softPendingCompactionBytesLimit() or
ColumnFamilyOptions.level0SlowdownWritesTrigger() is triggered,
or we are writing to the last mem table allowed and we allow more than 3
mem tables. |
DBOptions |
setDeleteObsoleteFilesPeriodMicros(long micros)
The periodicity when obsolete files get deleted.
|
DBOptions |
setDumpMallocStats(boolean dumpMallocStats)
If true, then print malloc stats together with rocksdb.stats
when printing to LOG.
|
DBOptions |
setEnableThreadTracking(boolean enableThreadTracking)
If true, then the status of the threads involved in this DB will
be tracked and available via GetThreadList() API.
|
DBOptions |
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. |
DBOptions |
setEnv(Env env)
Use the specified object to interact with the environment,
e.g.
|
DBOptions |
setErrorIfExists(boolean errorIfExists)
If true, an error will be thrown during RocksDB.open() if the
database already exists.
|
DBOptions |
setFailIfOptionsFileError(boolean failIfOptionsFileError)
If true, then DB::Open / CreateColumnFamily / DropColumnFamily
/ SetOptions will fail if options file is not detected or properly
persisted.
|
DBOptions |
setIncreaseParallelism(int totalThreads)
By default, RocksDB uses only one background thread for flush and
compaction.
|
DBOptions |
setInfoLogLevel(InfoLogLevel infoLogLevel)
Sets the RocksDB log level.
|
DBOptions |
setIsFdCloseOnExec(boolean isFdCloseOnExec)
Disable child process inherit open files.
|
DBOptions |
setKeepLogFileNum(long keepLogFileNum)
Specifies the maximum number of info log files to be kept.
|
DBOptions |
setLogFileTimeToRoll(long logFileTimeToRoll)
Specifies the time interval for the info log file to roll (in seconds).
|
DBOptions |
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.
|
DBOptions |
setManifestPreallocationSize(long size)
Number of bytes to preallocate (via fallocate) the manifest
files.
|
DBOptions |
setMaxBackgroundCompactions(int maxBackgroundCompactions)
Specifies the maximum number of concurrent background compaction jobs,
submitted to the default LOW priority thread pool.
|
DBOptions |
setMaxBackgroundFlushes(int maxBackgroundFlushes)
Specifies the maximum number of concurrent background flush jobs.
|
DBOptions |
setMaxBackgroundJobs(int maxBackgroundJobs)
Specifies the maximum number of concurrent background jobs (both flushes
and compactions combined).
|
DBOptions |
setMaxFileOpeningThreads(int maxFileOpeningThreads)
If
DBOptionsInterface.maxOpenFiles() is -1, DB will open all files on DB::Open(). |
DBOptions |
setMaxLogFileSize(long maxLogFileSize)
Specifies the maximum size of a info log file.
|
DBOptions |
setMaxManifestFileSize(long maxManifestFileSize)
Manifest file is rolled over on reaching this limit.
|
DBOptions |
setMaxOpenFiles(int maxOpenFiles)
Number of open files that can be used by the DB.
|
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.
|
DBOptions |
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.
|
DBOptions |
setNewTableReaderForCompactionInputs(boolean newTableReaderForCompactionInputs)
If true, always create a new file descriptor and new table reader
for compaction inputs.
|
DBOptions |
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.
|
DBOptions |
setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
This is a maximum buffer size that is used by WinMmapReadableFile in
unbuffered disk I/O mode.
|
DBOptions |
setRateLimiter(RateLimiter rateLimiter)
Use to control write rate of flush and compaction.
|
DBOptions |
setRecycleLogFileNum(long recycleLogFileNum)
Recycle log files.
|
DBOptions |
setRowCache(Cache rowCache)
A global cache for table-level rows.
|
DBOptions |
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.
|
DBOptions |
setSstFileManager(SstFileManager sstFileManager)
Use to track SST files and control their file deletion rate.
|
DBOptions |
setStatistics(Statistics statistics)
Sets the statistics object which collects metrics about database operations.
|
DBOptions |
setStatsDumpPeriodSec(int statsDumpPeriodSec)
if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 600 (10 minutes)
|
DBOptions |
setTableCacheNumshardbits(int tableCacheNumshardbits)
Number of shards used for table cache.
|
DBOptions |
setUseAdaptiveMutex(boolean useAdaptiveMutex)
Use adaptive mutex, which spins in the user space before resorting
to kernel.
|
DBOptions |
setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
Enable the OS to use direct reads and writes in flush and
compaction
Default: false
|
DBOptions |
setUseDirectReads(boolean useDirectReads)
Enable the OS to use direct I/O for reading sst tables.
|
DBOptions |
setUseFsync(boolean useFsync)
If true, then every store to stable storage will issue a fsync.
|
DBOptions |
setWalBytesPerSync(long walBytesPerSync)
Same as
DBOptionsInterface.setBytesPerSync(long) , but applies to WAL files
Default: 0, turned off |
DBOptions |
setWalDir(java.lang.String walDir)
This specifies the absolute dir path for write-ahead logs (WAL).
|
DBOptions |
setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
Recovery mode to control the consistency while replaying WAL
Default:
WALRecoveryMode.PointInTimeRecovery |
DBOptions |
setWalSizeLimitMB(long sizeLimitMB)
WalTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted.
|
DBOptions |
setWalTtlSeconds(long walTtlSeconds)
DBOptionsInterface.walTtlSeconds() and DBOptionsInterface.walSizeLimitMB() affect how archived logs
will be deleted. |
DBOptions |
setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
This is the maximum buffer size that is used by WritableFileWriter.
|
DBOptions |
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.
|
DBOptions |
setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
The latency in microseconds after which a std::this_thread::yield
call (sched_yield on Linux) is considered to be a signal that
other processes or threads would like to use the current core.
|
boolean |
skipStatsUpdateOnDbOpen()
If true, then DB::Open() will not update the statistics used to optimize
compaction decision by loading table properties from many files.
|
Statistics |
statistics()
Returns statistics object.
|
int |
statsDumpPeriodSec()
If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 600 (10 minutes)
|
int |
tableCacheNumshardbits()
Number of shards used for table cache.
|
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.
|
long |
walBytesPerSync()
Same as
DBOptionsInterface.bytesPerSync() , but applies to WAL files
Default: 0, turned off |
java.lang.String |
walDir()
Returns the path to the write-ahead-logs (WAL) directory.
|
WALRecoveryMode |
walRecoveryMode()
Recovery mode to control the consistency while replaying WAL
Default:
WALRecoveryMode.PointInTimeRecovery |
long |
walSizeLimitMB()
DBOptionsInterface.walTtlSeconds() and #walSizeLimitMB() affect how archived logs
will be deleted. |
long |
walTtlSeconds()
WalTtlSeconds() and walSizeLimitMB() affect how archived logs
will be deleted.
|
long |
writableFileMaxBufferSize()
This is the maximum buffer size that is used by WritableFileWriter.
|
long |
writeThreadMaxYieldUsec()
The maximum number of microseconds that a write operation will use
a yielding spin loop to coordinate with other write threads before
blocking on a mutex.
|
long |
writeThreadSlowYieldUsec()
The latency in microseconds after which a std::this_thread::yield
call (sched_yield on Linux) is considered to be a signal that
other processes or threads would like to use the current core.
|
disposeInternal
close, disOwnNativeHandle, isOwningHandle
dispose, finalize
public DBOptions()
rocksdb::DBOptions
in the c++ side.public DBOptions(DBOptions other)
other
- The DBOptions to copy.public static DBOptions getDBOptionsFromProps(java.util.Properties properties)
Method to get a options instance by using pre-configured property values. If one or many values are undefined in the context of RocksDB the method will return a null value.
Note: Property keys can be derived from
getter methods within the options class. Example: the method
allowMmapReads()
has a property key:
allow_mmap_reads
.
properties
- Properties
instance.instance
or null.java.lang.IllegalArgumentException
- if null or empty
Properties
instance is passed to the method call.public DBOptions optimizeForSmallDb()
DBOptionsInterface
optimizeForSmallDb
in interface DBOptionsInterface<DBOptions>
public DBOptions setIncreaseParallelism(int totalThreads)
DBOptionsInterface
By default, RocksDB uses only one background thread for flush and compaction. Calling this function will set it up such that total of `total_threads` is used.
You almost definitely want to call this function if your system is bottlenecked by RocksDB.
setIncreaseParallelism
in interface DBOptionsInterface<DBOptions>
totalThreads
- The total number of threads to be used by RocksDB.
A good value is the number of cores.public DBOptions setCreateIfMissing(boolean flag)
DBOptionsInterface
RocksDB.open()
.
Default: falsesetCreateIfMissing
in interface DBOptionsInterface<DBOptions>
flag
- a flag indicating whether to create a database the
specified database in RocksDB.open(org.rocksdb.Options, String)
operation
is missing.RocksDB.open(org.rocksdb.Options, String)
public boolean createIfMissing()
DBOptionsInterface
createIfMissing
in interface DBOptionsInterface<DBOptions>
DBOptionsInterface.setCreateIfMissing(boolean)
public DBOptions setCreateMissingColumnFamilies(boolean flag)
DBOptionsInterface
If true, missing column families will be automatically created
Default: false
setCreateMissingColumnFamilies
in interface DBOptionsInterface<DBOptions>
flag
- a flag indicating if missing column families shall be
created automatically.public boolean createMissingColumnFamilies()
DBOptionsInterface
createMissingColumnFamilies
in interface DBOptionsInterface<DBOptions>
DBOptionsInterface.setCreateMissingColumnFamilies(boolean)
public DBOptions setEnv(Env env)
DBOptionsInterface
Env.getDefault()
setEnv
in interface DBOptionsInterface<DBOptions>
env
- Env
instance.public Env getEnv()
DBOptionsInterface
getEnv
in interface DBOptionsInterface<DBOptions>
RocksEnv
instance set in the options.public DBOptions setErrorIfExists(boolean errorIfExists)
DBOptionsInterface
setErrorIfExists
in interface DBOptionsInterface<DBOptions>
errorIfExists
- if true, an exception will be thrown
during RocksDB.open()
if the database already exists.RocksDB.open(org.rocksdb.Options, String)
public boolean errorIfExists()
DBOptionsInterface
errorIfExists
in interface DBOptionsInterface<DBOptions>
public DBOptions setParanoidChecks(boolean paranoidChecks)
DBOptionsInterface
setParanoidChecks
in interface DBOptionsInterface<DBOptions>
paranoidChecks
- a flag to indicate whether paranoid-check
is on.public boolean paranoidChecks()
DBOptionsInterface
paranoidChecks
in interface DBOptionsInterface<DBOptions>
public DBOptions setRateLimiter(RateLimiter rateLimiter)
DBOptionsInterface
setRateLimiter
in interface DBOptionsInterface<DBOptions>
rateLimiter
- RateLimiter
instance.public DBOptions setSstFileManager(SstFileManager sstFileManager)
DBOptionsInterface
setSstFileManager
in interface DBOptionsInterface<DBOptions>
sstFileManager
- The SST File Manager for the db.public DBOptions setLogger(Logger logger)
DBOptionsInterface
Any internal progress/error information generated by the db will be written to the Logger if it is non-nullptr, or to a file stored in the same directory as the DB contents if info_log is nullptr.
Default: nullptr
setLogger
in interface DBOptionsInterface<DBOptions>
logger
- Logger
instance.public DBOptions setInfoLogLevel(InfoLogLevel infoLogLevel)
DBOptionsInterface
Sets the RocksDB log level. Default level is INFO
setInfoLogLevel
in interface DBOptionsInterface<DBOptions>
infoLogLevel
- log level to set.public InfoLogLevel infoLogLevel()
DBOptionsInterface
Returns currently set log level.
infoLogLevel
in interface DBOptionsInterface<DBOptions>
InfoLogLevel
instance.public DBOptions setMaxOpenFiles(int maxOpenFiles)
DBOptionsInterface
target_file_size_base
and target_file_size_multiplier
for level-based compaction. For universal-style compaction, you can usually
set it to -1.
Default: 5000setMaxOpenFiles
in interface DBOptionsInterface<DBOptions>
maxOpenFiles
- the maximum number of open files.public int maxOpenFiles()
DBOptionsInterface
target_file_size_base
and target_file_size_multiplier
for level-based compaction. For universal-style compaction, you can usually
set it to -1.maxOpenFiles
in interface DBOptionsInterface<DBOptions>
public DBOptions setMaxFileOpeningThreads(int maxFileOpeningThreads)
DBOptionsInterface
DBOptionsInterface.maxOpenFiles()
is -1, DB will open all files on DB::Open(). You
can use this option to increase the number of threads used to open the
files.
Default: 16setMaxFileOpeningThreads
in interface DBOptionsInterface<DBOptions>
maxFileOpeningThreads
- the maximum number of threads to use to
open filespublic int maxFileOpeningThreads()
DBOptionsInterface
DBOptionsInterface.maxOpenFiles()
is -1, DB will open all files on DB::Open(). You
can use this option to increase the number of threads used to open the
files.
Default: 16maxFileOpeningThreads
in interface DBOptionsInterface<DBOptions>
public DBOptions setMaxTotalWalSize(long maxTotalWalSize)
DBOptionsInterface
Once write-ahead logs exceed this size, we will start forcing the flush of column families whose memtables are backed by the oldest live WAL file (i.e. the ones that are causing all the space amplification).
If set to 0 (default), we will dynamically choose the WAL size limit to be [sum of all write_buffer_size * max_write_buffer_number] * 2
Default: 0
setMaxTotalWalSize
in interface DBOptionsInterface<DBOptions>
maxTotalWalSize
- max total wal size.public long maxTotalWalSize()
DBOptionsInterface
Returns the max total wal size. Once write-ahead logs exceed this size, we will start forcing the flush of column families whose memtables are backed by the oldest live WAL file (i.e. the ones that are causing all the space amplification).
If set to 0 (default), we will dynamically choose the WAL size limit to be [sum of all write_buffer_size * max_write_buffer_number] * 2
maxTotalWalSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setStatistics(Statistics statistics)
DBOptionsInterface
Sets the statistics object which collects metrics about database operations. Statistics objects should not be shared between DB instances as it does not use any locks to prevent concurrent updates.
setStatistics
in interface DBOptionsInterface<DBOptions>
statistics
- The statistics to setRocksDB.open(org.rocksdb.Options, String)
public Statistics statistics()
DBOptionsInterface
Returns statistics object.
statistics
in interface DBOptionsInterface<DBOptions>
DBOptionsInterface.setStatistics(Statistics)
public DBOptions setUseFsync(boolean useFsync)
DBOptionsInterface
If true, then every store to stable storage will issue a fsync.
If false, then every store to stable storage will issue a fdatasync. This parameter should be set to true while storing data to filesystem like ext3 that can lose files after a reboot.
Default: false
setUseFsync
in interface DBOptionsInterface<DBOptions>
useFsync
- a boolean flag to specify whether to use fsyncpublic boolean useFsync()
DBOptionsInterface
If true, then every store to stable storage will issue a fsync.
If false, then every store to stable storage will issue a fdatasync. This parameter should be set to true while storing data to filesystem like ext3 that can lose files after a reboot.
useFsync
in interface DBOptionsInterface<DBOptions>
public DBOptions setDbPaths(java.util.Collection<DbPath> dbPaths)
DBOptionsInterface
setDbPaths
in interface DBOptionsInterface<DBOptions>
dbPaths
- the paths and target sizespublic java.util.List<DbPath> dbPaths()
DBOptionsInterface
Collections.emptyList()
dbPaths
in interface DBOptionsInterface<DBOptions>
public DBOptions setDbLogDir(java.lang.String dbLogDir)
DBOptionsInterface
setDbLogDir
in interface DBOptionsInterface<DBOptions>
dbLogDir
- the path to the info log directorypublic java.lang.String dbLogDir()
DBOptionsInterface
dbLogDir
in interface DBOptionsInterface<DBOptions>
public DBOptions setWalDir(java.lang.String walDir)
DBOptionsInterface
setWalDir
in interface DBOptionsInterface<DBOptions>
walDir
- the path to the write-ahead-log directory.public java.lang.String walDir()
DBOptionsInterface
walDir
in interface DBOptionsInterface<DBOptions>
public DBOptions setDeleteObsoleteFilesPeriodMicros(long micros)
DBOptionsInterface
setDeleteObsoleteFilesPeriodMicros
in interface DBOptionsInterface<DBOptions>
micros
- the time interval in microspublic long deleteObsoleteFilesPeriodMicros()
DBOptionsInterface
deleteObsoleteFilesPeriodMicros
in interface DBOptionsInterface<DBOptions>
public void setBaseBackgroundCompactions(int baseBackgroundCompactions)
DBOptionsInterface
setBaseBackgroundCompactions
in interface DBOptionsInterface<DBOptions>
baseBackgroundCompactions
- Suggested number of background compaction
jobspublic int baseBackgroundCompactions()
DBOptionsInterface
baseBackgroundCompactions
in interface DBOptionsInterface<DBOptions>
public DBOptions setMaxBackgroundCompactions(int maxBackgroundCompactions)
DBOptionsInterface
setMaxBackgroundCompactions
in interface DBOptionsInterface<DBOptions>
maxBackgroundCompactions
- the maximum number of background
compaction jobs.Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
,
DBOptionsInterface.maxBackgroundFlushes()
public int maxBackgroundCompactions()
DBOptionsInterface
maxBackgroundCompactions
in interface DBOptionsInterface<DBOptions>
Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
public void setMaxSubcompactions(int maxSubcompactions)
DBOptionsInterface
setMaxSubcompactions
in interface DBOptionsInterface<DBOptions>
maxSubcompactions
- The maximum number of threads that will
concurrently perform a compaction jobpublic int maxSubcompactions()
DBOptionsInterface
maxSubcompactions
in interface DBOptionsInterface<DBOptions>
public DBOptions setMaxBackgroundFlushes(int maxBackgroundFlushes)
DBOptionsInterface
setMaxBackgroundFlushes
in interface DBOptionsInterface<DBOptions>
maxBackgroundFlushes
- number of max concurrent flush jobsEnv.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
,
DBOptionsInterface.maxBackgroundCompactions()
public int maxBackgroundFlushes()
DBOptionsInterface
maxBackgroundFlushes
in interface DBOptionsInterface<DBOptions>
Env.setBackgroundThreads(int)
,
Env.setBackgroundThreads(int, int)
public DBOptions setMaxBackgroundJobs(int maxBackgroundJobs)
DBOptionsInterface
setMaxBackgroundJobs
in interface DBOptionsInterface<DBOptions>
maxBackgroundJobs
- number of max concurrent background jobspublic int maxBackgroundJobs()
DBOptionsInterface
maxBackgroundJobs
in interface DBOptionsInterface<DBOptions>
public DBOptions setMaxLogFileSize(long maxLogFileSize)
DBOptionsInterface
setMaxLogFileSize
in interface DBOptionsInterface<DBOptions>
maxLogFileSize
- the maximum size of a info log file.public long maxLogFileSize()
DBOptionsInterface
maxLogFileSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setLogFileTimeToRoll(long logFileTimeToRoll)
DBOptionsInterface
setLogFileTimeToRoll
in interface DBOptionsInterface<DBOptions>
logFileTimeToRoll
- the time interval in seconds.public long logFileTimeToRoll()
DBOptionsInterface
logFileTimeToRoll
in interface DBOptionsInterface<DBOptions>
public DBOptions setKeepLogFileNum(long keepLogFileNum)
DBOptionsInterface
setKeepLogFileNum
in interface DBOptionsInterface<DBOptions>
keepLogFileNum
- the maximum number of info log files to be kept.public long keepLogFileNum()
DBOptionsInterface
keepLogFileNum
in interface DBOptionsInterface<DBOptions>
public DBOptions setRecycleLogFileNum(long recycleLogFileNum)
DBOptionsInterface
setRecycleLogFileNum
in interface DBOptionsInterface<DBOptions>
recycleLogFileNum
- the number of log files to keep for recyclingpublic long recycleLogFileNum()
DBOptionsInterface
recycleLogFileNum
in interface DBOptionsInterface<DBOptions>
public DBOptions setMaxManifestFileSize(long maxManifestFileSize)
DBOptionsInterface
setMaxManifestFileSize
in interface DBOptionsInterface<DBOptions>
maxManifestFileSize
- the size limit of a manifest file.public long maxManifestFileSize()
DBOptionsInterface
maxManifestFileSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setTableCacheNumshardbits(int tableCacheNumshardbits)
DBOptionsInterface
setTableCacheNumshardbits
in interface DBOptionsInterface<DBOptions>
tableCacheNumshardbits
- the number of chardspublic int tableCacheNumshardbits()
DBOptionsInterface
tableCacheNumshardbits
in interface DBOptionsInterface<DBOptions>
public DBOptions setWalTtlSeconds(long walTtlSeconds)
DBOptionsInterface
DBOptionsInterface.walTtlSeconds()
and DBOptionsInterface.walSizeLimitMB()
affect how archived logs
will be deleted.
setWalTtlSeconds
in interface DBOptionsInterface<DBOptions>
walTtlSeconds
- the ttl secondsDBOptionsInterface.setWalSizeLimitMB(long)
public long walTtlSeconds()
DBOptionsInterface
walTtlSeconds
in interface DBOptionsInterface<DBOptions>
DBOptionsInterface.walSizeLimitMB()
public DBOptions setWalSizeLimitMB(long sizeLimitMB)
DBOptionsInterface
setWalSizeLimitMB
in interface DBOptionsInterface<DBOptions>
sizeLimitMB
- size limit in mega-bytes.DBOptionsInterface.setWalSizeLimitMB(long)
public long walSizeLimitMB()
DBOptionsInterface
DBOptionsInterface.walTtlSeconds()
and #walSizeLimitMB()
affect how archived logs
will be deleted.
walSizeLimitMB
in interface DBOptionsInterface<DBOptions>
DBOptionsInterface.walSizeLimitMB()
public DBOptions setManifestPreallocationSize(long size)
DBOptionsInterface
setManifestPreallocationSize
in interface DBOptionsInterface<DBOptions>
size
- the size in bytepublic long manifestPreallocationSize()
DBOptionsInterface
manifestPreallocationSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setUseDirectReads(boolean useDirectReads)
DBOptionsInterface
setUseDirectReads
in interface DBOptionsInterface<DBOptions>
useDirectReads
- if true, then direct read is enabledpublic boolean useDirectReads()
DBOptionsInterface
useDirectReads
in interface DBOptionsInterface<DBOptions>
public DBOptions setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
DBOptionsInterface
setUseDirectIoForFlushAndCompaction
in interface DBOptionsInterface<DBOptions>
useDirectIoForFlushAndCompaction
- if true, then direct
I/O will be enabled for background flush and compactionspublic boolean useDirectIoForFlushAndCompaction()
DBOptionsInterface
useDirectIoForFlushAndCompaction
in interface DBOptionsInterface<DBOptions>
public DBOptions setAllowFAllocate(boolean allowFAllocate)
DBOptionsInterface
setAllowFAllocate
in interface DBOptionsInterface<DBOptions>
allowFAllocate
- false if fallocate() calls are bypassedpublic boolean allowFAllocate()
DBOptionsInterface
allowFAllocate
in interface DBOptionsInterface<DBOptions>
public DBOptions setAllowMmapReads(boolean allowMmapReads)
DBOptionsInterface
setAllowMmapReads
in interface DBOptionsInterface<DBOptions>
allowMmapReads
- true if mmap reads are allowed.public boolean allowMmapReads()
DBOptionsInterface
allowMmapReads
in interface DBOptionsInterface<DBOptions>
public DBOptions setAllowMmapWrites(boolean allowMmapWrites)
DBOptionsInterface
setAllowMmapWrites
in interface DBOptionsInterface<DBOptions>
allowMmapWrites
- true if mmap writes are allowd.public boolean allowMmapWrites()
DBOptionsInterface
allowMmapWrites
in interface DBOptionsInterface<DBOptions>
public DBOptions setIsFdCloseOnExec(boolean isFdCloseOnExec)
DBOptionsInterface
setIsFdCloseOnExec
in interface DBOptionsInterface<DBOptions>
isFdCloseOnExec
- true if child process inheriting open
files is disabled.public boolean isFdCloseOnExec()
DBOptionsInterface
isFdCloseOnExec
in interface DBOptionsInterface<DBOptions>
public DBOptions setStatsDumpPeriodSec(int statsDumpPeriodSec)
DBOptionsInterface
setStatsDumpPeriodSec
in interface DBOptionsInterface<DBOptions>
statsDumpPeriodSec
- time interval in seconds.public int statsDumpPeriodSec()
DBOptionsInterface
statsDumpPeriodSec
in interface DBOptionsInterface<DBOptions>
public DBOptions setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
DBOptionsInterface
setAdviseRandomOnOpen
in interface DBOptionsInterface<DBOptions>
adviseRandomOnOpen
- true if hinting random access is on.public boolean adviseRandomOnOpen()
DBOptionsInterface
adviseRandomOnOpen
in interface DBOptionsInterface<DBOptions>
public DBOptions setDbWriteBufferSize(long dbWriteBufferSize)
DBOptionsInterface
ColumnFamilyOptions.writeBufferSize()
,
which enforces a limit for a single memtable.
This feature is disabled by default. Specify a non-zero value
to enable it.
Default: 0 (disabled)setDbWriteBufferSize
in interface DBOptionsInterface<DBOptions>
dbWriteBufferSize
- the size of the write bufferpublic long dbWriteBufferSize()
DBOptionsInterface
ColumnFamilyOptions.writeBufferSize()
,
which enforces a limit for a single memtable.
This feature is disabled by default. Specify a non-zero value
to enable it.
Default: 0 (disabled)dbWriteBufferSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setAccessHintOnCompactionStart(AccessHint accessHint)
DBOptionsInterface
AccessHint.NORMAL
setAccessHintOnCompactionStart
in interface DBOptionsInterface<DBOptions>
accessHint
- The access hintpublic AccessHint accessHintOnCompactionStart()
DBOptionsInterface
AccessHint.NORMAL
accessHintOnCompactionStart
in interface DBOptionsInterface<DBOptions>
public DBOptions setNewTableReaderForCompactionInputs(boolean newTableReaderForCompactionInputs)
DBOptionsInterface
BlockBasedTableConfig.cacheIndexAndFilterBlocks()
for this mode if using block-based table.
Default: falsesetNewTableReaderForCompactionInputs
in interface DBOptionsInterface<DBOptions>
newTableReaderForCompactionInputs
- true if a new file descriptor and
table reader should be created for compaction inputspublic boolean newTableReaderForCompactionInputs()
DBOptionsInterface
BlockBasedTableConfig.cacheIndexAndFilterBlocks()
for this mode if using block-based table.
Default: falsenewTableReaderForCompactionInputs
in interface DBOptionsInterface<DBOptions>
public DBOptions setCompactionReadaheadSize(long compactionReadaheadSize)
DBOptionsInterface
DBOptionsInterface.newTableReaderForCompactionInputs()
to true.
Default: 0setCompactionReadaheadSize
in interface DBOptionsInterface<DBOptions>
compactionReadaheadSize
- The compaction read-ahead sizepublic long compactionReadaheadSize()
DBOptionsInterface
DBOptionsInterface.newTableReaderForCompactionInputs()
to true.
Default: 0compactionReadaheadSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
DBOptionsInterface
DBOptionsInterface.compactionReadaheadSize()
value and always try to read ahead.
With read-ahead we always pre-allocate buffer to the size instead of
growing it up to a limit.
This option is currently honored only on Windows
Default: 1 Mb
Special value: 0 - means do not maintain per instance buffer. Allocate
per request buffer and avoid locking.setRandomAccessMaxBufferSize
in interface DBOptionsInterface<DBOptions>
randomAccessMaxBufferSize
- the maximum size of the random access
bufferpublic long randomAccessMaxBufferSize()
DBOptionsInterface
DBOptionsInterface.compactionReadaheadSize()
value and always try to read ahead.
With read-ahead we always pre-allocate buffer to the size instead of
growing it up to a limit.
This option is currently honored only on Windows
Default: 1 Mb
Special value: 0 - means do not maintain per instance buffer. Allocate
per request buffer and avoid locking.randomAccessMaxBufferSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
DBOptionsInterface
setWritableFileMaxBufferSize
in interface DBOptionsInterface<DBOptions>
writableFileMaxBufferSize
- the maximum buffer sizepublic long writableFileMaxBufferSize()
DBOptionsInterface
writableFileMaxBufferSize
in interface DBOptionsInterface<DBOptions>
public DBOptions setUseAdaptiveMutex(boolean useAdaptiveMutex)
DBOptionsInterface
setUseAdaptiveMutex
in interface DBOptionsInterface<DBOptions>
useAdaptiveMutex
- true if adaptive mutex is used.public boolean useAdaptiveMutex()
DBOptionsInterface
useAdaptiveMutex
in interface DBOptionsInterface<DBOptions>
public DBOptions setBytesPerSync(long bytesPerSync)
DBOptionsInterface
setBytesPerSync
in interface DBOptionsInterface<DBOptions>
bytesPerSync
- size in bytespublic long bytesPerSync()
DBOptionsInterface
bytesPerSync
in interface DBOptionsInterface<DBOptions>
public DBOptions setWalBytesPerSync(long walBytesPerSync)
DBOptionsInterface
DBOptionsInterface.setBytesPerSync(long)
, but applies to WAL files
Default: 0, turned offsetWalBytesPerSync
in interface DBOptionsInterface<DBOptions>
walBytesPerSync
- size in bytespublic long walBytesPerSync()
DBOptionsInterface
DBOptionsInterface.bytesPerSync()
, but applies to WAL files
Default: 0, turned offwalBytesPerSync
in interface DBOptionsInterface<DBOptions>
public DBOptions setEnableThreadTracking(boolean enableThreadTracking)
DBOptionsInterface
setEnableThreadTracking
in interface DBOptionsInterface<DBOptions>
enableThreadTracking
- true to enable trackingpublic boolean enableThreadTracking()
DBOptionsInterface
enableThreadTracking
in interface DBOptionsInterface<DBOptions>
public DBOptions setDelayedWriteRate(long delayedWriteRate)
DBOptionsInterface
ColumnFamilyOptions.softPendingCompactionBytesLimit()
or
ColumnFamilyOptions.level0SlowdownWritesTrigger()
is triggered,
or we are writing to the last mem table allowed and we allow more than 3
mem tables. It is calculated using size of user write requests before
compression. RocksDB may decide to slow down more if the compaction still
gets behind further.
Unit: bytes per second.
Default: 16MB/ssetDelayedWriteRate
in interface DBOptionsInterface<DBOptions>
delayedWriteRate
- the rate in bytes per secondpublic long delayedWriteRate()
DBOptionsInterface
ColumnFamilyOptions.softPendingCompactionBytesLimit()
or
ColumnFamilyOptions.level0SlowdownWritesTrigger()
is triggered,
or we are writing to the last mem table allowed and we allow more than 3
mem tables. It is calculated using size of user write requests before
compression. RocksDB may decide to slow down more if the compaction still
gets behind further.
Unit: bytes per second.
Default: 16MB/sdelayedWriteRate
in interface DBOptionsInterface<DBOptions>
public DBOptions setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
DBOptionsInterface
DBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean)
if you are going to use
this feature.
Default: falsesetAllowConcurrentMemtableWrite
in interface DBOptionsInterface<DBOptions>
allowConcurrentMemtableWrite
- true to enable concurrent writes
for the memtablepublic boolean allowConcurrentMemtableWrite()
DBOptionsInterface
DBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean)
if you are going to use
this feature.
Default: falseallowConcurrentMemtableWrite
in interface DBOptionsInterface<DBOptions>
public DBOptions setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
DBOptionsInterface
DBOptionsInterface.writeThreadMaxYieldUsec()
before blocking on a
mutex. This can substantially improve throughput for concurrent workloads,
regardless of whether DBOptionsInterface.allowConcurrentMemtableWrite()
is enabled.
Default: falsesetEnableWriteThreadAdaptiveYield
in interface DBOptionsInterface<DBOptions>
enableWriteThreadAdaptiveYield
- true to enable adaptive yield for the
write threadspublic boolean enableWriteThreadAdaptiveYield()
DBOptionsInterface
DBOptionsInterface.writeThreadMaxYieldUsec()
before blocking on a
mutex. This can substantially improve throughput for concurrent workloads,
regardless of whether DBOptionsInterface.allowConcurrentMemtableWrite()
is enabled.
Default: falseenableWriteThreadAdaptiveYield
in interface DBOptionsInterface<DBOptions>
public DBOptions setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
DBOptionsInterface
DBOptionsInterface.writeThreadSlowYieldUsec()
is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100setWriteThreadMaxYieldUsec
in interface DBOptionsInterface<DBOptions>
writeThreadMaxYieldUsec
- maximum number of microsecondspublic long writeThreadMaxYieldUsec()
DBOptionsInterface
DBOptionsInterface.writeThreadSlowYieldUsec()
is
set properly) increasing this value is likely to increase RocksDB
throughput at the expense of increased CPU usage.
Default: 100writeThreadMaxYieldUsec
in interface DBOptionsInterface<DBOptions>
public DBOptions setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
DBOptionsInterface
setWriteThreadSlowYieldUsec
in interface DBOptionsInterface<DBOptions>
writeThreadSlowYieldUsec
- the latency in microsecondspublic long writeThreadSlowYieldUsec()
DBOptionsInterface
writeThreadSlowYieldUsec
in interface DBOptionsInterface<DBOptions>
public DBOptions setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
DBOptionsInterface
setSkipStatsUpdateOnDbOpen
in interface DBOptionsInterface<DBOptions>
skipStatsUpdateOnDbOpen
- true if updating stats will be skippedpublic boolean skipStatsUpdateOnDbOpen()
DBOptionsInterface
skipStatsUpdateOnDbOpen
in interface DBOptionsInterface<DBOptions>
public DBOptions setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
DBOptionsInterface
WALRecoveryMode.PointInTimeRecovery
setWalRecoveryMode
in interface DBOptionsInterface<DBOptions>
walRecoveryMode
- The WAL recover modepublic WALRecoveryMode walRecoveryMode()
DBOptionsInterface
WALRecoveryMode.PointInTimeRecovery
walRecoveryMode
in interface DBOptionsInterface<DBOptions>
public DBOptions setAllow2pc(boolean allow2pc)
DBOptionsInterface
setAllow2pc
in interface DBOptionsInterface<DBOptions>
allow2pc
- true if two-phase-commit is enabledpublic boolean allow2pc()
DBOptionsInterface
allow2pc
in interface DBOptionsInterface<DBOptions>
public DBOptions setRowCache(Cache rowCache)
DBOptionsInterface
setRowCache
in interface DBOptionsInterface<DBOptions>
rowCache
- The global row cachepublic Cache rowCache()
DBOptionsInterface
rowCache
in interface DBOptionsInterface<DBOptions>
public DBOptions setFailIfOptionsFileError(boolean failIfOptionsFileError)
DBOptionsInterface
setFailIfOptionsFileError
in interface DBOptionsInterface<DBOptions>
failIfOptionsFileError
- true if we should fail if there is an error
in the options filepublic boolean failIfOptionsFileError()
DBOptionsInterface
failIfOptionsFileError
in interface DBOptionsInterface<DBOptions>
public DBOptions setDumpMallocStats(boolean dumpMallocStats)
DBOptionsInterface
setDumpMallocStats
in interface DBOptionsInterface<DBOptions>
dumpMallocStats
- true if malloc stats should be printed to LOGpublic boolean dumpMallocStats()
DBOptionsInterface
dumpMallocStats
in interface DBOptionsInterface<DBOptions>
public DBOptions setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
DBOptionsInterface
setAvoidFlushDuringRecovery
in interface DBOptionsInterface<DBOptions>
avoidFlushDuringRecovery
- true to try to avoid (but not guarantee
not to) flush during recoverypublic boolean avoidFlushDuringRecovery()
DBOptionsInterface
avoidFlushDuringRecovery
in interface DBOptionsInterface<DBOptions>
public DBOptions setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
DBOptionsInterface
RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
API.setAvoidFlushDuringShutdown
in interface DBOptionsInterface<DBOptions>
avoidFlushDuringShutdown
- true if we should avoid flush during
shutdownpublic boolean avoidFlushDuringShutdown()
DBOptionsInterface
RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
API.avoidFlushDuringShutdown
in interface DBOptionsInterface<DBOptions>
protected final void disposeInternal(long handle)
disposeInternal
in class RocksObject