public class DBOptions extends RocksObject implements DBOptionsInterface<DBOptions>, MutableDBOptionsInterface<DBOptions>
RocksDB (i.e., RocksDB.open()).
As a descendent of AbstractNativeReference, this class is AutoCloseable
and will be automatically released if opened in the preamble of a try with resources block.
nativeHandle_owningHandle_| 构造器和说明 |
|---|
DBOptions()
Construct DBOptions.
|
DBOptions(DBOptions other)
Copy constructor for DBOptions.
|
DBOptions(Options options)
Constructor from Options
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 |
avoidFlushDuringShutdown()
By default RocksDB will flush all memtables on DB close if there are
unpersisted data (i.e. with WAL disabled) The flush can be skip to speedup
DB close.
|
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.
|
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 |
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
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(ConfigOptions cfgOpts,
java.util.Properties properties)
Method to get a options instance by using pre-configured
property values.
|
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.
|
java.util.List<AbstractEventListener> |
listeners()
Sets the
EventListeners 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 |
maxBackgroundCompactions()
已过时。
|
int |
maxBackgroundFlushes()
已过时。
|
int |
maxBackgroundJobs()
Returns the maximum number of concurrent background jobs (both flushes
and compactions combined).
|
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 |
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 write-ahead log size.
|
long |
maxWriteBatchGroupSizeBytes()
The maximum limit of number of bytes that are written in a single batch
of WAL or memtable write.
|
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.
|
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.
|
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 |
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).
|
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 |
setAtomicFlush(boolean atomicFlush)
If true, RocksDB supports flushing multiple column families and committing
their results atomically to MANIFEST.
|
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. with WAL disabled) The flush can be skip to speedup
DB close.
|
DBOptions |
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.
|
DBOptions |
setBestEffortsRecovery(boolean bestEffortsRecovery)
By default, RocksDB recovery fails if any table file referenced in
MANIFEST are missing after scanning the MANIFEST.
|
DBOptions |
setBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)
If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.
|
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
Default: false
|
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 |
setEnablePipelinedWrite(boolean enablePipelinedWrite)
By default, a single write thread queue is maintained.
|
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. to read/write files, schedule background work, etc.
|
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 |
setListeners(java.util.List<AbstractEventListener> listeners)
Sets the
EventListeners whose callback functions
will be called when specific RocksDB event happens. |
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 |
setLogReadaheadSize(long logReadaheadSize)
The number of bytes to prefetch when reading the log.
|
DBOptions |
setManifestPreallocationSize(long size)
Number of bytes to preallocate (via fallocate) the manifest
files.
|
DBOptions |
setManualWalFlush(boolean manualWalFlush)
If true WAL is not flushed automatically after each write.
|
DBOptions |
setMaxBackgroundCompactions(int maxBackgroundCompactions)
已过时。
|
DBOptions |
setMaxBackgroundFlushes(int maxBackgroundFlushes)
已过时。
|
DBOptions |
setMaxBackgroundJobs(int maxBackgroundJobs)
Specifies the maximum number of concurrent background jobs (both flushes
and compactions combined).
|
DBOptions |
setMaxBgErrorResumeCount(int maxBgerrorResumeCount)
It defines how many times db resume is called by a separate thread when
background retryable IO Error happens.
|
DBOptions |
setMaxFileOpeningThreads(int maxFileOpeningThreads)
If
MutableDBOptionsInterface.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.
|
DBOptions |
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)
Set the max total write-ahead log size.
|
DBOptions |
setMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)
The maximum limit of number of bytes that are written in a single batch
of WAL or memtable write.
|
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 |
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.
|
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 |
setSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)
If true, then
RocksDB.open(String) will not fetch and check sizes of all sst files. |
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 |
setStatsHistoryBufferSize(long statsHistoryBufferSize)
If not zero, periodically take stats snapshots and store in memory, the
memory size for stats snapshots is capped at
statsHistoryBufferSize
Default: 1MB |
DBOptions |
setStatsPersistPeriodSec(int statsPersistPeriodSec)
If not zero, dump rocksdb.stats to RocksDB every
statsPersistPeriodSec
Default: 600 |
DBOptions |
setStrictBytesPerSync(boolean strictBytesPerSync)
When true, guarantees WAL files have at most
MutableDBOptionsInterface.walBytesPerSync()
bytes submitted for writeback at any given time, and SST files have at most
MutableDBOptionsInterface.bytesPerSync() bytes pending writeback at any given time. |
DBOptions |
setTableCacheNumshardbits(int tableCacheNumshardbits)
Number of shards used for table cache.
|
DBOptions |
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.
|
DBOptions |
setUnorderedWrite(boolean unorderedWrite)
Setting
DBOptionsInterface.unorderedWrite() to true trades higher write throughput with
relaxing the immutability guarantee of snapshots. |
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
MutableDBOptionsInterface.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 |
setWalFilter(AbstractWalFilter walFilter)
A filter object supplied to be invoked while processing write-ahead-logs
(WALs) during recovery.
|
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 |
setWriteBufferManager(WriteBufferManager writeBufferManager)
Use passed
WriteBufferManager to control memory usage across
multiple column families and/or DB instances. |
DBOptions |
setWriteDbidToManifest(boolean writeDbidToManifest)
Historically DB ID has always been stored in Identity File in DB folder.
|
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 |
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 |
statsDumpPeriodSec()
If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
Default: 600 (10 minutes)
|
long |
statsHistoryBufferSize()
If not zero, periodically take stats snapshots and store in memory, the
memory size for stats snapshots is capped at
statsHistoryBufferSize |
int |
statsPersistPeriodSec()
If not zero, dump rocksdb.stats to RocksDB every
statsPersistPeriodSec |
boolean |
strictBytesPerSync()
Return the strict byte limit per sync.
|
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.
|
long |
walBytesPerSync()
Same as
MutableDBOptionsInterface.bytesPerSync() , but applies to WAL files
Default: 0, turned off |
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()
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.
|
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.
|
disposeInternal, getNativeHandleclose, disOwnNativeHandle, isOwningHandlepublic DBOptions()
This constructor will create (by allocating a block of memory)
an rocksdb::DBOptions in the c++ side.
public DBOptions(DBOptions other)
NOTE: This does a shallow copy, which means env, rate_limiter, sst_file_manager, info_log and other pointers will be cloned!
other - The DBOptions to copy.public DBOptions(Options options)
options - The options.public static DBOptions getDBOptionsFromProps(ConfigOptions cfgOpts, 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.
cfgOpts - The ConfigOptions to control how the string is processed.properties - Properties instance.instance
or null.java.lang.IllegalArgumentException - if null or empty
Properties instance is passed to the method call.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()
DBOptionsInterfaceoptimizeForSmallDb 在接口中 DBOptionsInterface<DBOptions>public DBOptions 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 在接口中 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)
DBOptionsInterfaceRocksDB.open().
Default: falsesetCreateIfMissing 在接口中 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()
DBOptionsInterfacecreateIfMissing 在接口中 DBOptionsInterface<DBOptions>DBOptionsInterface.setCreateIfMissing(boolean)public DBOptions setCreateMissingColumnFamilies(boolean flag)
DBOptionsInterfaceIf true, missing column families will be automatically created
Default: false
setCreateMissingColumnFamilies 在接口中 DBOptionsInterface<DBOptions>flag - a flag indicating if missing column families shall be
created automatically.public boolean createMissingColumnFamilies()
DBOptionsInterfacecreateMissingColumnFamilies 在接口中 DBOptionsInterface<DBOptions>DBOptionsInterface.setCreateMissingColumnFamilies(boolean)public DBOptions setErrorIfExists(boolean errorIfExists)
DBOptionsInterfacesetErrorIfExists 在接口中 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()
DBOptionsInterfaceerrorIfExists 在接口中 DBOptionsInterface<DBOptions>public DBOptions setParanoidChecks(boolean paranoidChecks)
DBOptionsInterfacesetParanoidChecks 在接口中 DBOptionsInterface<DBOptions>paranoidChecks - a flag to indicate whether paranoid-check
is on.public boolean paranoidChecks()
DBOptionsInterfaceparanoidChecks 在接口中 DBOptionsInterface<DBOptions>public DBOptions setEnv(Env env)
DBOptionsInterfaceEnv.getDefault()setEnv 在接口中 DBOptionsInterface<DBOptions>env - Env instance.public Env getEnv()
DBOptionsInterfacegetEnv 在接口中 DBOptionsInterface<DBOptions>RocksEnv instance set in the options.public DBOptions setRateLimiter(RateLimiter rateLimiter)
DBOptionsInterfacesetRateLimiter 在接口中 DBOptionsInterface<DBOptions>rateLimiter - RateLimiter instance.public DBOptions setSstFileManager(SstFileManager sstFileManager)
DBOptionsInterfacesetSstFileManager 在接口中 DBOptionsInterface<DBOptions>sstFileManager - The SST File Manager for the db.public DBOptions 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 在接口中 DBOptionsInterface<DBOptions>logger - Logger instance.public DBOptions setInfoLogLevel(InfoLogLevel infoLogLevel)
DBOptionsInterfaceSets the RocksDB log level. Default level is INFO
setInfoLogLevel 在接口中 DBOptionsInterface<DBOptions>infoLogLevel - log level to set.public InfoLogLevel infoLogLevel()
DBOptionsInterfaceReturns currently set log level.
infoLogLevel 在接口中 DBOptionsInterface<DBOptions>InfoLogLevel instance.public DBOptions setMaxOpenFiles(int maxOpenFiles)
MutableDBOptionsInterfacetarget_file_size_base and target_file_size_multiplier
for level-based compaction. For universal-style compaction, you can usually
set it to -1.
Default: -1setMaxOpenFiles 在接口中 MutableDBOptionsInterface<DBOptions>maxOpenFiles - the maximum number of open files.public int maxOpenFiles()
MutableDBOptionsInterfacetarget_file_size_base and target_file_size_multiplier
for level-based compaction. For universal-style compaction, you can usually
set it to -1.
Default: -1maxOpenFiles 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setMaxFileOpeningThreads(int maxFileOpeningThreads)
DBOptionsInterfaceMutableDBOptionsInterface.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 在接口中 DBOptionsInterface<DBOptions>maxFileOpeningThreads - the maximum number of threads to use to
open filespublic int maxFileOpeningThreads()
DBOptionsInterfaceMutableDBOptionsInterface.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 在接口中 DBOptionsInterface<DBOptions>public DBOptions setMaxTotalWalSize(long maxTotalWalSize)
MutableDBOptionsInterfaceSet the max total write-ahead log 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
The oldest WAL files are the ones that are causing all the space amplification.
For example, with 15 column families, each withwrite_buffer_size = 128 MB
max_write_buffer_number = 6
max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 =
45GB
The RocksDB wiki has some discussion about how the WAL interacts with memtables and flushing of column families, at ...
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] * 4
This option takes effect only when there are more than one column family as otherwise the wal size is dictated by the write_buffer_size.
Default: 0
setMaxTotalWalSize 在接口中 MutableDBOptionsInterface<DBOptions>maxTotalWalSize - max total wal size.public long maxTotalWalSize()
MutableDBOptionsInterfaceReturns the max total write-ahead log 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.
The oldest WAL files are the ones that are causing all the space amplification.
For example, with 15 column families, each withwrite_buffer_size = 128 MB
max_write_buffer_number = 6
max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 =
45GB
The RocksDB wiki has some discussion about how the WAL interacts with memtables and flushing of column families, at ...
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] * 4
This option takes effect only when there are more than one column family as otherwise the wal size is dictated by the write_buffer_size.
Default: 0
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] * 4
maxTotalWalSize 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setStatistics(Statistics statistics)
DBOptionsInterfaceSets 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 在接口中 DBOptionsInterface<DBOptions>statistics - The statistics to setRocksDB.open(org.rocksdb.Options, String)public Statistics statistics()
DBOptionsInterfaceReturns statistics object.
statistics 在接口中 DBOptionsInterface<DBOptions>DBOptionsInterface.setStatistics(Statistics)public DBOptions 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 在接口中 DBOptionsInterface<DBOptions>useFsync - a boolean flag to specify whether to use fsyncpublic 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 在接口中 DBOptionsInterface<DBOptions>public DBOptions setDbPaths(java.util.Collection<DbPath> dbPaths)
DBOptionsInterfacesetDbPaths 在接口中 DBOptionsInterface<DBOptions>dbPaths - the paths and target sizespublic java.util.List<DbPath> dbPaths()
DBOptionsInterfaceCollections.emptyList()dbPaths 在接口中 DBOptionsInterface<DBOptions>public DBOptions setDbLogDir(java.lang.String dbLogDir)
DBOptionsInterfacesetDbLogDir 在接口中 DBOptionsInterface<DBOptions>dbLogDir - the path to the info log directorypublic java.lang.String dbLogDir()
DBOptionsInterfacedbLogDir 在接口中 DBOptionsInterface<DBOptions>public DBOptions setWalDir(java.lang.String walDir)
DBOptionsInterfacesetWalDir 在接口中 DBOptionsInterface<DBOptions>walDir - the path to the write-ahead-log directory.public java.lang.String walDir()
DBOptionsInterfacewalDir 在接口中 DBOptionsInterface<DBOptions>public DBOptions setDeleteObsoleteFilesPeriodMicros(long micros)
DBOptionsInterfacesetDeleteObsoleteFilesPeriodMicros 在接口中 DBOptionsInterface<DBOptions>setDeleteObsoleteFilesPeriodMicros 在接口中 MutableDBOptionsInterface<DBOptions>micros - the time interval in microspublic long deleteObsoleteFilesPeriodMicros()
DBOptionsInterfacedeleteObsoleteFilesPeriodMicros 在接口中 DBOptionsInterface<DBOptions>deleteObsoleteFilesPeriodMicros 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setMaxBackgroundJobs(int maxBackgroundJobs)
MutableDBOptionsInterfacesetMaxBackgroundJobs 在接口中 MutableDBOptionsInterface<DBOptions>maxBackgroundJobs - number of max concurrent background jobspublic int maxBackgroundJobs()
MutableDBOptionsInterfacemaxBackgroundJobs 在接口中 MutableDBOptionsInterface<DBOptions>@Deprecated public DBOptions setMaxBackgroundCompactions(int maxBackgroundCompactions)
MutableDBOptionsInterfaceSpecifies the maximum number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. If you're increasing this, also consider increasing number of threads in LOW priority thread pool. For more information, see Default: -1
setMaxBackgroundCompactions 在接口中 MutableDBOptionsInterface<DBOptions>maxBackgroundCompactions - the maximum number of background
compaction jobs.Env.setBackgroundThreads(int),
Env.setBackgroundThreads(int, Priority),
DBOptionsInterface.maxBackgroundFlushes()@Deprecated public int maxBackgroundCompactions()
MutableDBOptionsInterfaceReturns the maximum number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. When increasing this number, we may also want to consider increasing number of threads in LOW priority thread pool. Default: -1
maxBackgroundCompactions 在接口中 MutableDBOptionsInterface<DBOptions>Env.setBackgroundThreads(int),
Env.setBackgroundThreads(int, Priority)public DBOptions setMaxSubcompactions(int maxSubcompactions)
DBOptionsInterfacesetMaxSubcompactions 在接口中 DBOptionsInterface<DBOptions>maxSubcompactions - The maximum number of threads that will
concurrently perform a compaction jobpublic int maxSubcompactions()
DBOptionsInterfacemaxSubcompactions 在接口中 DBOptionsInterface<DBOptions>@Deprecated public DBOptions setMaxBackgroundFlushes(int maxBackgroundFlushes)
DBOptionsInterfacesetMaxBackgroundFlushes 在接口中 DBOptionsInterface<DBOptions>maxBackgroundFlushes - number of max concurrent flush jobsEnv.setBackgroundThreads(int),
Env.setBackgroundThreads(int, Priority),
MutableDBOptionsInterface.maxBackgroundCompactions()@Deprecated public int maxBackgroundFlushes()
DBOptionsInterfacemaxBackgroundFlushes 在接口中 DBOptionsInterface<DBOptions>Env.setBackgroundThreads(int),
Env.setBackgroundThreads(int, Priority)public DBOptions setMaxLogFileSize(long maxLogFileSize)
DBOptionsInterfacesetMaxLogFileSize 在接口中 DBOptionsInterface<DBOptions>maxLogFileSize - the maximum size of a info log file.public long maxLogFileSize()
DBOptionsInterfacemaxLogFileSize 在接口中 DBOptionsInterface<DBOptions>public DBOptions setLogFileTimeToRoll(long logFileTimeToRoll)
DBOptionsInterfacesetLogFileTimeToRoll 在接口中 DBOptionsInterface<DBOptions>logFileTimeToRoll - the time interval in seconds.public long logFileTimeToRoll()
DBOptionsInterfacelogFileTimeToRoll 在接口中 DBOptionsInterface<DBOptions>public DBOptions setKeepLogFileNum(long keepLogFileNum)
DBOptionsInterfacesetKeepLogFileNum 在接口中 DBOptionsInterface<DBOptions>keepLogFileNum - the maximum number of info log files to be kept.public long keepLogFileNum()
DBOptionsInterfacekeepLogFileNum 在接口中 DBOptionsInterface<DBOptions>public DBOptions setRecycleLogFileNum(long recycleLogFileNum)
DBOptionsInterfacesetRecycleLogFileNum 在接口中 DBOptionsInterface<DBOptions>recycleLogFileNum - the number of log files to keep for recyclingpublic long recycleLogFileNum()
DBOptionsInterfacerecycleLogFileNum 在接口中 DBOptionsInterface<DBOptions>public DBOptions setMaxManifestFileSize(long maxManifestFileSize)
DBOptionsInterfacesetMaxManifestFileSize 在接口中 DBOptionsInterface<DBOptions>maxManifestFileSize - the size limit of a manifest file.public long maxManifestFileSize()
DBOptionsInterfacemaxManifestFileSize 在接口中 DBOptionsInterface<DBOptions>public DBOptions setTableCacheNumshardbits(int tableCacheNumshardbits)
DBOptionsInterfacesetTableCacheNumshardbits 在接口中 DBOptionsInterface<DBOptions>tableCacheNumshardbits - the number of chardspublic int tableCacheNumshardbits()
DBOptionsInterfacetableCacheNumshardbits 在接口中 DBOptionsInterface<DBOptions>public DBOptions setWalTtlSeconds(long walTtlSeconds)
DBOptionsInterfaceDBOptionsInterface.walTtlSeconds() and DBOptionsInterface.walSizeLimitMB() affect how archived logs
will be deleted.
setWalTtlSeconds 在接口中 DBOptionsInterface<DBOptions>walTtlSeconds - the ttl secondsDBOptionsInterface.setWalSizeLimitMB(long)public long walTtlSeconds()
DBOptionsInterfacewalTtlSeconds 在接口中 DBOptionsInterface<DBOptions>DBOptionsInterface.walSizeLimitMB()public DBOptions setWalSizeLimitMB(long sizeLimitMB)
DBOptionsInterfacesetWalSizeLimitMB 在接口中 DBOptionsInterface<DBOptions>sizeLimitMB - size limit in mega-bytes.DBOptionsInterface.setWalSizeLimitMB(long)public long walSizeLimitMB()
DBOptionsInterfaceDBOptionsInterface.walTtlSeconds() and #walSizeLimitMB() affect how archived logs
will be deleted.
walSizeLimitMB 在接口中 DBOptionsInterface<DBOptions>DBOptionsInterface.walSizeLimitMB()public DBOptions setMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)
DBOptionsInterfacesetMaxWriteBatchGroupSizeBytes 在接口中 DBOptionsInterface<DBOptions>maxWriteBatchGroupSizeBytes - the maximum limit of number of bytes, see description.public long maxWriteBatchGroupSizeBytes()
DBOptionsInterfacemaxWriteBatchGroupSizeBytes 在接口中 DBOptionsInterface<DBOptions>public DBOptions setManifestPreallocationSize(long size)
DBOptionsInterfacesetManifestPreallocationSize 在接口中 DBOptionsInterface<DBOptions>size - the size in bytepublic long manifestPreallocationSize()
DBOptionsInterfacemanifestPreallocationSize 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAllowMmapReads(boolean allowMmapReads)
DBOptionsInterfacesetAllowMmapReads 在接口中 DBOptionsInterface<DBOptions>allowMmapReads - true if mmap reads are allowed.public boolean allowMmapReads()
DBOptionsInterfaceallowMmapReads 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAllowMmapWrites(boolean allowMmapWrites)
DBOptionsInterfacesetAllowMmapWrites 在接口中 DBOptionsInterface<DBOptions>allowMmapWrites - true if mmap writes are allowd.public boolean allowMmapWrites()
DBOptionsInterfaceallowMmapWrites 在接口中 DBOptionsInterface<DBOptions>public DBOptions setUseDirectReads(boolean useDirectReads)
DBOptionsInterfacesetUseDirectReads 在接口中 DBOptionsInterface<DBOptions>useDirectReads - if true, then direct read is enabledpublic boolean useDirectReads()
DBOptionsInterfaceuseDirectReads 在接口中 DBOptionsInterface<DBOptions>public DBOptions setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
DBOptionsInterfacesetUseDirectIoForFlushAndCompaction 在接口中 DBOptionsInterface<DBOptions>useDirectIoForFlushAndCompaction - if true, then direct
I/O will be enabled for background flush and compactionspublic boolean useDirectIoForFlushAndCompaction()
DBOptionsInterfaceuseDirectIoForFlushAndCompaction 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAllowFAllocate(boolean allowFAllocate)
DBOptionsInterfacesetAllowFAllocate 在接口中 DBOptionsInterface<DBOptions>allowFAllocate - false if fallocate() calls are bypassedpublic boolean allowFAllocate()
DBOptionsInterfaceallowFAllocate 在接口中 DBOptionsInterface<DBOptions>public DBOptions setIsFdCloseOnExec(boolean isFdCloseOnExec)
DBOptionsInterfacesetIsFdCloseOnExec 在接口中 DBOptionsInterface<DBOptions>isFdCloseOnExec - true if child process inheriting open
files is disabled.public boolean isFdCloseOnExec()
DBOptionsInterfaceisFdCloseOnExec 在接口中 DBOptionsInterface<DBOptions>public DBOptions setStatsDumpPeriodSec(int statsDumpPeriodSec)
MutableDBOptionsInterfacesetStatsDumpPeriodSec 在接口中 MutableDBOptionsInterface<DBOptions>statsDumpPeriodSec - time interval in seconds.public int statsDumpPeriodSec()
MutableDBOptionsInterfacestatsDumpPeriodSec 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setStatsPersistPeriodSec(int statsPersistPeriodSec)
MutableDBOptionsInterfacestatsPersistPeriodSec
Default: 600setStatsPersistPeriodSec 在接口中 MutableDBOptionsInterface<DBOptions>statsPersistPeriodSec - time interval in seconds.public int statsPersistPeriodSec()
MutableDBOptionsInterfacestatsPersistPeriodSecstatsPersistPeriodSec 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setStatsHistoryBufferSize(long statsHistoryBufferSize)
MutableDBOptionsInterfacestatsHistoryBufferSize
Default: 1MBsetStatsHistoryBufferSize 在接口中 MutableDBOptionsInterface<DBOptions>statsHistoryBufferSize - the size of the buffer.public long statsHistoryBufferSize()
MutableDBOptionsInterfacestatsHistoryBufferSizestatsHistoryBufferSize 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
DBOptionsInterfacesetAdviseRandomOnOpen 在接口中 DBOptionsInterface<DBOptions>adviseRandomOnOpen - true if hinting random access is on.public boolean adviseRandomOnOpen()
DBOptionsInterfaceadviseRandomOnOpen 在接口中 DBOptionsInterface<DBOptions>public DBOptions setDbWriteBufferSize(long dbWriteBufferSize)
DBOptionsInterfaceColumnFamilyOptions.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 在接口中 DBOptionsInterface<DBOptions>dbWriteBufferSize - the size of the write bufferpublic DBOptions setWriteBufferManager(WriteBufferManager writeBufferManager)
DBOptionsInterfaceWriteBufferManager 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 itsetWriteBufferManager 在接口中 DBOptionsInterface<DBOptions>writeBufferManager - The WriteBufferManager to usepublic WriteBufferManager writeBufferManager()
DBOptionsInterfaceWriteBufferManager used by it. writeBufferManager 在接口中 DBOptionsInterface<DBOptions>public long dbWriteBufferSize()
DBOptionsInterfaceColumnFamilyOptions.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 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAccessHintOnCompactionStart(AccessHint accessHint)
DBOptionsInterfaceAccessHint.NORMALsetAccessHintOnCompactionStart 在接口中 DBOptionsInterface<DBOptions>accessHint - The access hintpublic AccessHint accessHintOnCompactionStart()
DBOptionsInterfaceAccessHint.NORMALaccessHintOnCompactionStart 在接口中 DBOptionsInterface<DBOptions>public DBOptions setCompactionReadaheadSize(long compactionReadaheadSize)
MutableDBOptionsInterfaceThat way RocksDB's compaction is doing sequential instead of random reads.
Default: 0
setCompactionReadaheadSize 在接口中 MutableDBOptionsInterface<DBOptions>compactionReadaheadSize - The compaction read-ahead sizepublic long compactionReadaheadSize()
MutableDBOptionsInterfaceThat way RocksDB's compaction is doing sequential instead of random reads.
Default: 0
compactionReadaheadSize 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
DBOptionsInterfaceMutableDBOptionsInterface.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 在接口中 DBOptionsInterface<DBOptions>randomAccessMaxBufferSize - the maximum size of the random access
bufferpublic long randomAccessMaxBufferSize()
DBOptionsInterfaceMutableDBOptionsInterface.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 在接口中 DBOptionsInterface<DBOptions>public DBOptions setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
MutableDBOptionsInterfaceDefault: 1024 * 1024 (1 MB)
setWritableFileMaxBufferSize 在接口中 MutableDBOptionsInterface<DBOptions>writableFileMaxBufferSize - the maximum buffer sizepublic long writableFileMaxBufferSize()
MutableDBOptionsInterfaceDefault: 1024 * 1024 (1 MB)
writableFileMaxBufferSize 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setUseAdaptiveMutex(boolean useAdaptiveMutex)
DBOptionsInterfacesetUseAdaptiveMutex 在接口中 DBOptionsInterface<DBOptions>useAdaptiveMutex - true if adaptive mutex is used.public boolean useAdaptiveMutex()
DBOptionsInterfaceuseAdaptiveMutex 在接口中 DBOptionsInterface<DBOptions>public DBOptions setBytesPerSync(long bytesPerSync)
MutableDBOptionsInterfacesetBytesPerSync 在接口中 MutableDBOptionsInterface<DBOptions>bytesPerSync - size in bytespublic long bytesPerSync()
MutableDBOptionsInterfacebytesPerSync 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setWalBytesPerSync(long walBytesPerSync)
MutableDBOptionsInterfaceMutableDBOptionsInterface.setBytesPerSync(long) , but applies to WAL files
Default: 0, turned off
setWalBytesPerSync 在接口中 MutableDBOptionsInterface<DBOptions>walBytesPerSync - size in bytespublic long walBytesPerSync()
MutableDBOptionsInterfaceMutableDBOptionsInterface.bytesPerSync() , but applies to WAL files
Default: 0, turned off
walBytesPerSync 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setStrictBytesPerSync(boolean strictBytesPerSync)
MutableDBOptionsInterfaceMutableDBOptionsInterface.walBytesPerSync()
bytes submitted for writeback at any given time, and SST files have at most
MutableDBOptionsInterface.bytesPerSync() bytes pending writeback at any given time. This
can be used to handle cases where processing speed exceeds I/O speed
during file generation, which can lead to a huge sync when the file is
finished, even with MutableDBOptionsInterface.bytesPerSync() / MutableDBOptionsInterface.walBytesPerSync()
properly configured.
- If `sync_file_range` is supported it achieves this by waiting for any prior `sync_file_range`s to finish before proceeding. In this way, processing (compression, etc.) can proceed uninhibited in the gap between `sync_file_range`s, and we block only when I/O falls behind. - Otherwise the `WritableFile::Sync` method is used. Note this mechanism always blocks, thus preventing the interleaving of I/O and processing.
Note: Enabling this option does not provide any additional persistence guarantees, as it may use `sync_file_range`, which does not write out metadata.
Default: false
setStrictBytesPerSync 在接口中 MutableDBOptionsInterface<DBOptions>strictBytesPerSync - the bytes per syncpublic boolean strictBytesPerSync()
MutableDBOptionsInterface
See MutableDBOptionsInterface.setStrictBytesPerSync(boolean)
strictBytesPerSync 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setListeners(java.util.List<AbstractEventListener> listeners)
DBOptionsInterfaceEventListeners 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++.setListeners 在接口中 DBOptionsInterface<DBOptions>listeners - the listeners who should be notified on various events.public java.util.List<AbstractEventListener> listeners()
DBOptionsInterfaceEventListeners 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 在接口中 DBOptionsInterface<DBOptions>public DBOptions setEnableThreadTracking(boolean enableThreadTracking)
DBOptionsInterfacesetEnableThreadTracking 在接口中 DBOptionsInterface<DBOptions>enableThreadTracking - true to enable trackingpublic boolean enableThreadTracking()
DBOptionsInterfaceenableThreadTracking 在接口中 DBOptionsInterface<DBOptions>public DBOptions setDelayedWriteRate(long delayedWriteRate)
MutableDBOptionsInterfaceColumnFamilyOptions.softPendingCompactionBytesLimit() or
ColumnFamilyOptions.level0SlowdownWritesTrigger() is triggered,
or we are writing to the last mem table allowed and we allow more than 3
mem tables. It is calculated using size of user write requests before
compression. RocksDB may decide to slow down more if the compaction still
gets behind further.
If the value is 0, we will infer a value from `rater_limiter` value
if it is not empty, or 16MB if `rater_limiter` is empty. Note that
if users change the rate in `rate_limiter` after DB is opened,
`delayed_write_rate` won't be adjusted.
Unit: bytes per second.
Default: 0
Dynamically changeable through RocksDB.setDBOptions(MutableDBOptions).
setDelayedWriteRate 在接口中 MutableDBOptionsInterface<DBOptions>delayedWriteRate - the rate in bytes per secondpublic long delayedWriteRate()
MutableDBOptionsInterfaceColumnFamilyOptions.softPendingCompactionBytesLimit() or
ColumnFamilyOptions.level0SlowdownWritesTrigger() is triggered,
or we are writing to the last mem table allowed and we allow more than 3
mem tables. It is calculated using size of user write requests before
compression. RocksDB may decide to slow down more if the compaction still
gets behind further.
If the value is 0, we will infer a value from `rater_limiter` value
if it is not empty, or 16MB if `rater_limiter` is empty. Note that
if users change the rate in `rate_limiter` after DB is opened,
`delayed_write_rate` won't be adjusted.
Unit: bytes per second.
Default: 0
Dynamically changeable through RocksDB.setDBOptions(MutableDBOptions).
delayedWriteRate 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setEnablePipelinedWrite(boolean enablePipelinedWrite)
DBOptionsInterfaceDBOptionsInterface.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: falsesetEnablePipelinedWrite 在接口中 DBOptionsInterface<DBOptions>enablePipelinedWrite - true to enabled pipelined writespublic boolean enablePipelinedWrite()
DBOptionsInterfaceDBOptionsInterface.setEnablePipelinedWrite(boolean).enablePipelinedWrite 在接口中 DBOptionsInterface<DBOptions>public DBOptions setUnorderedWrite(boolean unorderedWrite)
DBOptionsInterfaceDBOptionsInterface.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
DBOptionsInterface.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.setUnorderedWrite 在接口中 DBOptionsInterface<DBOptions>unorderedWrite - true to enabled unordered writepublic boolean unorderedWrite()
DBOptionsInterfaceDBOptionsInterface.setUnorderedWrite(boolean).unorderedWrite 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
DBOptionsInterfaceDBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean) if you are going to use
this feature.
Default: truesetAllowConcurrentMemtableWrite 在接口中 DBOptionsInterface<DBOptions>allowConcurrentMemtableWrite - true to enable concurrent writes
for the memtablepublic boolean allowConcurrentMemtableWrite()
DBOptionsInterfaceDBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean) if you are going to use
this feature.
Default: trueallowConcurrentMemtableWrite 在接口中 DBOptionsInterface<DBOptions>public DBOptions 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: truesetEnableWriteThreadAdaptiveYield 在接口中 DBOptionsInterface<DBOptions>enableWriteThreadAdaptiveYield - 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: trueenableWriteThreadAdaptiveYield 在接口中 DBOptionsInterface<DBOptions>public DBOptions 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 在接口中 DBOptionsInterface<DBOptions>writeThreadMaxYieldUsec - 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 在接口中 DBOptionsInterface<DBOptions>public DBOptions setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
DBOptionsInterfacesetWriteThreadSlowYieldUsec 在接口中 DBOptionsInterface<DBOptions>writeThreadSlowYieldUsec - the latency in microsecondspublic long writeThreadSlowYieldUsec()
DBOptionsInterfacewriteThreadSlowYieldUsec 在接口中 DBOptionsInterface<DBOptions>public DBOptions setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
DBOptionsInterfacesetSkipStatsUpdateOnDbOpen 在接口中 DBOptionsInterface<DBOptions>skipStatsUpdateOnDbOpen - true if updating stats will be skippedpublic boolean skipStatsUpdateOnDbOpen()
DBOptionsInterfaceskipStatsUpdateOnDbOpen 在接口中 DBOptionsInterface<DBOptions>public DBOptions setSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)
DBOptionsInterfaceRocksDB.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: falsesetSkipCheckingSstFileSizesOnDbOpen 在接口中 DBOptionsInterface<DBOptions>skipCheckingSstFileSizesOnDbOpen - if true, then SST file sizes will not be checked
when calling RocksDB.open(String).public boolean skipCheckingSstFileSizesOnDbOpen()
DBOptionsInterfaceRocksDB.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 在接口中 DBOptionsInterface<DBOptions>RocksDB.open(String).public DBOptions setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
DBOptionsInterfaceWALRecoveryMode.PointInTimeRecoverysetWalRecoveryMode 在接口中 DBOptionsInterface<DBOptions>walRecoveryMode - The WAL recover modepublic WALRecoveryMode walRecoveryMode()
DBOptionsInterfaceWALRecoveryMode.PointInTimeRecoverywalRecoveryMode 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAllow2pc(boolean allow2pc)
DBOptionsInterfacesetAllow2pc 在接口中 DBOptionsInterface<DBOptions>allow2pc - true if two-phase-commit is enabledpublic boolean allow2pc()
DBOptionsInterfaceallow2pc 在接口中 DBOptionsInterface<DBOptions>public DBOptions setRowCache(Cache rowCache)
DBOptionsInterfacesetRowCache 在接口中 DBOptionsInterface<DBOptions>rowCache - The global row cachepublic Cache rowCache()
DBOptionsInterfacerowCache 在接口中 DBOptionsInterface<DBOptions>public DBOptions setWalFilter(AbstractWalFilter walFilter)
DBOptionsInterfacesetWalFilter 在接口中 DBOptionsInterface<DBOptions>walFilter - the filter for processing WALs during recovery.public WalFilter walFilter()
DBOptionsInterfaceDBOptionsInterface.setWalFilter(AbstractWalFilter).walFilter 在接口中 DBOptionsInterface<DBOptions>public DBOptions setFailIfOptionsFileError(boolean failIfOptionsFileError)
DBOptionsInterfacesetFailIfOptionsFileError 在接口中 DBOptionsInterface<DBOptions>failIfOptionsFileError - true if we should fail if there is an error
in the options filepublic boolean failIfOptionsFileError()
DBOptionsInterfacefailIfOptionsFileError 在接口中 DBOptionsInterface<DBOptions>public DBOptions setDumpMallocStats(boolean dumpMallocStats)
DBOptionsInterfacesetDumpMallocStats 在接口中 DBOptionsInterface<DBOptions>dumpMallocStats - true if malloc stats should be printed to LOGpublic boolean dumpMallocStats()
DBOptionsInterfacedumpMallocStats 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
DBOptionsInterfacesetAvoidFlushDuringRecovery 在接口中 DBOptionsInterface<DBOptions>avoidFlushDuringRecovery - true to try to avoid (but not guarantee
not to) flush during recoverypublic boolean avoidFlushDuringRecovery()
DBOptionsInterfaceavoidFlushDuringRecovery 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
MutableDBOptionsInterfaceDEFAULT: false
Dynamically changeable through
RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
API.
setAvoidFlushDuringShutdown 在接口中 MutableDBOptionsInterface<DBOptions>avoidFlushDuringShutdown - true if we should avoid flush during
shutdownpublic boolean avoidFlushDuringShutdown()
MutableDBOptionsInterfaceDEFAULT: false
Dynamically changeable through
RocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)
API.
avoidFlushDuringShutdown 在接口中 MutableDBOptionsInterface<DBOptions>public DBOptions setAllowIngestBehind(boolean allowIngestBehind)
DBOptionsInterfacesetAllowIngestBehind 在接口中 DBOptionsInterface<DBOptions>allowIngestBehind - true to allow ingest behind, false to disallow.public boolean allowIngestBehind()
DBOptionsInterfaceDBOptionsInterface.setAllowIngestBehind(boolean).allowIngestBehind 在接口中 DBOptionsInterface<DBOptions>public DBOptions setTwoWriteQueues(boolean twoWriteQueues)
DBOptionsInterfacesetTwoWriteQueues 在接口中 DBOptionsInterface<DBOptions>twoWriteQueues - true to enable two write queues, false otherwise.public boolean twoWriteQueues()
DBOptionsInterfacetwoWriteQueues 在接口中 DBOptionsInterface<DBOptions>public DBOptions setManualWalFlush(boolean manualWalFlush)
DBOptionsInterfacesetManualWalFlush 在接口中 DBOptionsInterface<DBOptions>manualWalFlush - true to set disable automatic WAL flushing,
false otherwise.public boolean manualWalFlush()
DBOptionsInterfaceDBOptionsInterface.setManualWalFlush(boolean).manualWalFlush 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAtomicFlush(boolean atomicFlush)
DBOptionsInterfaceRocksDB.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.setAtomicFlush 在接口中 DBOptionsInterface<DBOptions>atomicFlush - true to enable atomic flush of multiple column families.public boolean atomicFlush()
DBOptionsInterfaceDBOptionsInterface.setAtomicFlush(boolean).atomicFlush 在接口中 DBOptionsInterface<DBOptions>public DBOptions setAvoidUnnecessaryBlockingIO(boolean avoidUnnecessaryBlockingIO)
DBOptionsInterfaceReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean).setAvoidUnnecessaryBlockingIO 在接口中 DBOptionsInterface<DBOptions>avoidUnnecessaryBlockingIO - If true, working thread may avoid doing unnecessary
operation.public boolean avoidUnnecessaryBlockingIO()
DBOptionsInterfaceReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean).avoidUnnecessaryBlockingIO 在接口中 DBOptionsInterface<DBOptions>public DBOptions setPersistStatsToDisk(boolean persistStatsToDisk)
DBOptionsInterfacesetPersistStatsToDisk 在接口中 DBOptionsInterface<DBOptions>persistStatsToDisk - true if stats should be persisted to hidden column family.public boolean persistStatsToDisk()
DBOptionsInterfacepersistStatsToDisk 在接口中 DBOptionsInterface<DBOptions>public DBOptions setWriteDbidToManifest(boolean writeDbidToManifest)
DBOptionsInterfacesetWriteDbidToManifest 在接口中 DBOptionsInterface<DBOptions>writeDbidToManifest - if true, then DB ID will be written to Manifest file.public boolean writeDbidToManifest()
DBOptionsInterfacewriteDbidToManifest 在接口中 DBOptionsInterface<DBOptions>public DBOptions setLogReadaheadSize(long logReadaheadSize)
DBOptionsInterfacesetLogReadaheadSize 在接口中 DBOptionsInterface<DBOptions>logReadaheadSize - the number of bytes to prefetch when reading the log.public long logReadaheadSize()
DBOptionsInterfacelogReadaheadSize 在接口中 DBOptionsInterface<DBOptions>public DBOptions setBestEffortsRecovery(boolean bestEffortsRecovery)
DBOptionsInterfacesetBestEffortsRecovery 在接口中 DBOptionsInterface<DBOptions>bestEffortsRecovery - if true, RocksDB will use best-efforts mode when recovering.public boolean bestEffortsRecovery()
DBOptionsInterfacebestEffortsRecovery 在接口中 DBOptionsInterface<DBOptions>public DBOptions setMaxBgErrorResumeCount(int maxBgerrorResumeCount)
DBOptionsInterfacesetMaxBgErrorResumeCount 在接口中 DBOptionsInterface<DBOptions>maxBgerrorResumeCount - maximum number of times db resume should be called when IO Error
happens.public int maxBgerrorResumeCount()
DBOptionsInterfacemaxBgerrorResumeCount 在接口中 DBOptionsInterface<DBOptions>public DBOptions setBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)
DBOptionsInterfacesetBgerrorResumeRetryInterval 在接口中 DBOptionsInterface<DBOptions>bgerrorResumeRetryInterval - how many microseconds to wait between DB resume attempts.public long bgerrorResumeRetryInterval()
DBOptionsInterfacebgerrorResumeRetryInterval 在接口中 DBOptionsInterface<DBOptions>protected final void disposeInternal(long handle)
disposeInternal 在类中 RocksObject