Class DBOptions
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.AutoCloseable,DBOptionsInterface<DBOptions>,MutableDBOptionsInterface<DBOptions>
public class DBOptions extends RocksObject implements DBOptionsInterface<DBOptions>, MutableDBOptionsInterface<DBOptions>
DBOptions to control the behavior of a database. It will be used during the creation of aRocksDB(i.e., RocksDB.open()). IfAbstractNativeReference.dispose()function is not called, then it will be GC'd automatically and native resources will be released as part of the process.
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AccessHintaccessHintOnCompactionStart()Specify the file access pattern once a compaction is started.booleanadviseRandomOnOpen()If set true, will hint the underlying file system that the file access pattern is random, when a sst file is opened.booleanallow2pc()if set to false then recovery will fail when a prepared transaction is encountered in the WAL Default: falsebooleanallowConcurrentMemtableWrite()If true, allow multi-writers to update mem tables in parallel.booleanallowFAllocate()Whether fallocate calls are allowedbooleanallowIngestBehind()Returns true if ingest behind is allowed.booleanallowMmapReads()Allow the OS to mmap file for reading sst tables.booleanallowMmapWrites()Allow the OS to mmap file for writing.booleanatomicFlush()Determine if atomic flush of multiple column families is enabled.booleanavoidFlushDuringRecovery()By default RocksDB replay WAL logs and flush them on DB open, which may create very small SST files.booleanavoidFlushDuringShutdown()By default RocksDB will flush all memtables on DB close if there are unpersisted data (i.e.booleanavoidUnnecessaryBlockingIO()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.intbaseBackgroundCompactions()NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs.booleanbestEffortsRecovery()By default, RocksDB recovery fails if any table file referenced in MANIFEST are missing after scanning the MANIFEST.longbgerrorResumeRetryInterval()If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.longbytesPerSync()Allows OS to incrementally sync files to disk while they are being written, asynchronously, in the background.longcompactionReadaheadSize()If non-zero, we perform bigger reads when doing compaction.booleancreateIfMissing()Return true if the create_if_missing flag is set to true.booleancreateMissingColumnFamilies()Return true if the create_missing_column_families flag is set to true.java.lang.StringdbLogDir()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.longdbWriteBufferSize()Amount of data to build up in memtables across all column families before writing to disk.longdelayedWriteRate()The limited write rate to DB ifColumnFamilyOptions.softPendingCompactionBytesLimit()orColumnFamilyOptions.level0SlowdownWritesTrigger()is triggered, or we are writing to the last mem table allowed and we allow more than 3 mem tables.longdeleteObsoleteFilesPeriodMicros()The periodicity when obsolete files get deleted.protected voiddisposeInternal(long handle)booleandumpMallocStats()If true, then print malloc stats together with rocksdb.stats when printing to LOG.booleanenablePipelinedWrite()Returns true if pipelined writes are enabled.booleanenableThreadTracking()If true, then the status of the threads involved in this DB will be tracked and available via GetThreadList() API.booleanenableWriteThreadAdaptiveYield()If true, threads synchronizing with the write batch group leader will wait for up toDBOptionsInterface.writeThreadMaxYieldUsec()before blocking on a mutex.booleanerrorIfExists()If true, an error will be thrown during RocksDB.open() if the database already exists.booleanfailIfOptionsFileError()If true, then DB::Open / CreateColumnFamily / DropColumnFamily / SetOptions will fail if options file is not detected or properly persisted.static DBOptionsgetDBOptionsFromProps(java.util.Properties properties)Method to get a options instance by using pre-configured property values.static DBOptionsgetDBOptionsFromProps(ConfigOptions cfgOpts, java.util.Properties properties)Method to get a options instance by using pre-configured property values.EnvgetEnv()Returns the set RocksEnv instance.InfoLogLevelinfoLogLevel()Returns currently set log level.booleanisFdCloseOnExec()Disable child process inherit open files.longkeepLogFileNum()Returns the maximum number of info log files to be kept.java.util.List<AbstractEventListener>listeners()Sets theEventListeners whose callback functions will be called when specific RocksDB event happens.longlogFileTimeToRoll()Returns the time interval for the info log file to roll (in seconds).longlogReadaheadSize()The number of bytes to prefetch when reading the log.longmanifestPreallocationSize()Number of bytes to preallocate (via fallocate) the manifest files.booleanmanualWalFlush()Returns true if automatic WAL flushing is disabled.intmaxBackgroundCompactions()Deprecated.intmaxBackgroundFlushes()Deprecated.intmaxBackgroundJobs()Returns the maximum number of concurrent background jobs (both flushes and compactions combined).intmaxBgerrorResumeCount()It defines how many times db resume is called by a separate thread when background retryable IO Error happens.intmaxFileOpeningThreads()IfMutableDBOptionsInterface.maxOpenFiles()is -1, DB will open all files on DB::Open().longmaxLogFileSize()Returns the maximum size of a info log file.longmaxManifestFileSize()Manifest file is rolled over on reaching this limit.intmaxOpenFiles()Number of open files that can be used by the DB.intmaxSubcompactions()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.longmaxTotalWalSize()Returns the max total wal size.longmaxWriteBatchGroupSizeBytes()The maximum limit of number of bytes that are written in a single batch of WAL or memtable write.booleannewTableReaderForCompactionInputs()If true, always create a new file descriptor and new table reader for compaction inputs.DBOptionsoptimizeForSmallDb()Use this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables.booleanparanoidChecks()If true, the implementation will do aggressive checking of the data it is processing and will stop early if it detects any errors.booleanpersistStatsToDisk()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.booleanpreserveDeletes()Returns true if deletes are preserved.longrandomAccessMaxBufferSize()This is a maximum buffer size that is used by WinMmapReadableFile in unbuffered disk I/O mode.longrecycleLogFileNum()Recycle log files.CacherowCache()A global cache for table-level rows.DBOptionssetAccessHintOnCompactionStart(AccessHint accessHint)Specify the file access pattern once a compaction is started.DBOptionssetAdviseRandomOnOpen(boolean adviseRandomOnOpen)If set true, will hint the underlying file system that the file access pattern is random, when a sst file is opened.DBOptionssetAllow2pc(boolean allow2pc)if set to false then recovery will fail when a prepared transaction is encountered in the WAL Default: falseDBOptionssetAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)If true, allow multi-writers to update mem tables in parallel.DBOptionssetAllowFAllocate(boolean allowFAllocate)Whether fallocate calls are allowedDBOptionssetAllowIngestBehind(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).DBOptionssetAllowMmapReads(boolean allowMmapReads)Allow the OS to mmap file for reading sst tables.DBOptionssetAllowMmapWrites(boolean allowMmapWrites)Allow the OS to mmap file for writing.DBOptionssetAtomicFlush(boolean atomicFlush)If true, RocksDB supports flushing multiple column families and committing their results atomically to MANIFEST.DBOptionssetAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)By default RocksDB replay WAL logs and flush them on DB open, which may create very small SST files.DBOptionssetAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)By default RocksDB will flush all memtables on DB close if there are unpersisted data (i.e.DBOptionssetAvoidUnnecessaryBlockingIO(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.voidsetBaseBackgroundCompactions(int baseBackgroundCompactions)Deprecated.DBOptionssetBestEffortsRecovery(boolean bestEffortsRecovery)By default, RocksDB recovery fails if any table file referenced in MANIFEST are missing after scanning the MANIFEST.DBOptionssetBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.DBOptionssetBytesPerSync(long bytesPerSync)Allows OS to incrementally sync files to disk while they are being written, asynchronously, in the background.DBOptionssetCompactionReadaheadSize(long compactionReadaheadSize)If non-zero, we perform bigger reads when doing compaction.DBOptionssetCreateIfMissing(boolean flag)If this value is set to true, then the database will be created if it is missing duringRocksDB.open().DBOptionssetCreateMissingColumnFamilies(boolean flag)If true, missing column families will be automatically createdDBOptionssetDbLogDir(java.lang.String dbLogDir)This specifies the info LOG dir.DBOptionssetDbPaths(java.util.Collection<DbPath> dbPaths)A list of paths where SST files can be put into, with its target size.DBOptionssetDbWriteBufferSize(long dbWriteBufferSize)Amount of data to build up in memtables across all column families before writing to disk.DBOptionssetDelayedWriteRate(long delayedWriteRate)The limited write rate to DB ifColumnFamilyOptions.softPendingCompactionBytesLimit()orColumnFamilyOptions.level0SlowdownWritesTrigger()is triggered, or we are writing to the last mem table allowed and we allow more than 3 mem tables.DBOptionssetDeleteObsoleteFilesPeriodMicros(long micros)The periodicity when obsolete files get deleted.DBOptionssetDumpMallocStats(boolean dumpMallocStats)If true, then print malloc stats together with rocksdb.stats when printing to LOG.DBOptionssetEnablePipelinedWrite(boolean enablePipelinedWrite)By default, a single write thread queue is maintained.DBOptionssetEnableThreadTracking(boolean enableThreadTracking)If true, then the status of the threads involved in this DB will be tracked and available via GetThreadList() API.DBOptionssetEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)If true, threads synchronizing with the write batch group leader will wait for up toDBOptionsInterface.writeThreadMaxYieldUsec()before blocking on a mutex.DBOptionssetEnv(Env env)Use the specified object to interact with the environment, e.g.DBOptionssetErrorIfExists(boolean errorIfExists)If true, an error will be thrown during RocksDB.open() if the database already exists.DBOptionssetFailIfOptionsFileError(boolean failIfOptionsFileError)If true, then DB::Open / CreateColumnFamily / DropColumnFamily / SetOptions will fail if options file is not detected or properly persisted.DBOptionssetIncreaseParallelism(int totalThreads)By default, RocksDB uses only one background thread for flush and compaction.DBOptionssetInfoLogLevel(InfoLogLevel infoLogLevel)Sets the RocksDB log level.DBOptionssetIsFdCloseOnExec(boolean isFdCloseOnExec)Disable child process inherit open files.DBOptionssetKeepLogFileNum(long keepLogFileNum)Specifies the maximum number of info log files to be kept.DBOptionssetListeners(java.util.List<AbstractEventListener> listeners)Sets theEventListeners whose callback functions will be called when specific RocksDB event happens.DBOptionssetLogFileTimeToRoll(long logFileTimeToRoll)Specifies the time interval for the info log file to roll (in seconds).DBOptionssetLogger(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.DBOptionssetLogReadaheadSize(long logReadaheadSize)The number of bytes to prefetch when reading the log.DBOptionssetManifestPreallocationSize(long size)Number of bytes to preallocate (via fallocate) the manifest files.DBOptionssetManualWalFlush(boolean manualWalFlush)If true WAL is not flushed automatically after each write.DBOptionssetMaxBackgroundCompactions(int maxBackgroundCompactions)Deprecated.DBOptionssetMaxBackgroundFlushes(int maxBackgroundFlushes)Deprecated.DBOptionssetMaxBackgroundJobs(int maxBackgroundJobs)Specifies the maximum number of concurrent background jobs (both flushes and compactions combined).DBOptionssetMaxBgErrorResumeCount(int maxBgerrorResumeCount)It defines how many times db resume is called by a separate thread when background retryable IO Error happens.DBOptionssetMaxFileOpeningThreads(int maxFileOpeningThreads)IfMutableDBOptionsInterface.maxOpenFiles()is -1, DB will open all files on DB::Open().DBOptionssetMaxLogFileSize(long maxLogFileSize)Specifies the maximum size of a info log file.DBOptionssetMaxManifestFileSize(long maxManifestFileSize)Manifest file is rolled over on reaching this limit.DBOptionssetMaxOpenFiles(int maxOpenFiles)Number of open files that can be used by the DB.DBOptionssetMaxSubcompactions(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.DBOptionssetMaxTotalWalSize(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.DBOptionssetMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)The maximum limit of number of bytes that are written in a single batch of WAL or memtable write.DBOptionssetNewTableReaderForCompactionInputs(boolean newTableReaderForCompactionInputs)If true, always create a new file descriptor and new table reader for compaction inputs.DBOptionssetParanoidChecks(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.DBOptionssetPersistStatsToDisk(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.DBOptionssetPreserveDeletes(boolean preserveDeletes)Needed to support differential snapshots.DBOptionssetRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)This is a maximum buffer size that is used by WinMmapReadableFile in unbuffered disk I/O mode.DBOptionssetRateLimiter(RateLimiter rateLimiter)Use to control write rate of flush and compaction.DBOptionssetRecycleLogFileNum(long recycleLogFileNum)Recycle log files.DBOptionssetRowCache(Cache rowCache)A global cache for table-level rows.DBOptionssetSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)If true, thenRocksDB.open(String)will not fetch and check sizes of all sst files.DBOptionssetSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)If true, then DB::Open() will not update the statistics used to optimize compaction decision by loading table properties from many files.DBOptionssetSstFileManager(SstFileManager sstFileManager)Use to track SST files and control their file deletion rate.DBOptionssetStatistics(Statistics statistics)Sets the statistics object which collects metrics about database operations.DBOptionssetStatsDumpPeriodSec(int statsDumpPeriodSec)if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)DBOptionssetStatsHistoryBufferSize(long statsHistoryBufferSize)If not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped atstatsHistoryBufferSizeDefault: 1MBDBOptionssetStatsPersistPeriodSec(int statsPersistPeriodSec)If not zero, dump rocksdb.stats to RocksDB everystatsPersistPeriodSecDefault: 600DBOptionssetStrictBytesPerSync(boolean strictBytesPerSync)When true, guarantees WAL files have at mostMutableDBOptionsInterface.walBytesPerSync()bytes submitted for writeback at any given time, and SST files have at mostMutableDBOptionsInterface.bytesPerSync()bytes pending writeback at any given time.DBOptionssetTableCacheNumshardbits(int tableCacheNumshardbits)Number of shards used for table cache.DBOptionssetTwoWriteQueues(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.DBOptionssetUnorderedWrite(boolean unorderedWrite)SettingDBOptionsInterface.unorderedWrite()to true trades higher write throughput with relaxing the immutability guarantee of snapshots.DBOptionssetUseAdaptiveMutex(boolean useAdaptiveMutex)Use adaptive mutex, which spins in the user space before resorting to kernel.DBOptionssetUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)Enable the OS to use direct reads and writes in flush and compaction Default: falseDBOptionssetUseDirectReads(boolean useDirectReads)Enable the OS to use direct I/O for reading sst tables.DBOptionssetUseFsync(boolean useFsync)If true, then every store to stable storage will issue a fsync.DBOptionssetWalBytesPerSync(long walBytesPerSync)Same asMutableDBOptionsInterface.setBytesPerSync(long), but applies to WAL files Default: 0, turned offDBOptionssetWalDir(java.lang.String walDir)This specifies the absolute dir path for write-ahead logs (WAL).DBOptionssetWalFilter(AbstractWalFilter walFilter)A filter object supplied to be invoked while processing write-ahead-logs (WALs) during recovery.DBOptionssetWalRecoveryMode(WALRecoveryMode walRecoveryMode)Recovery mode to control the consistency while replaying WAL Default:WALRecoveryMode.PointInTimeRecoveryDBOptionssetWalSizeLimitMB(long sizeLimitMB)WalTtlSeconds() and walSizeLimitMB() affect how archived logs will be deleted.DBOptionssetWalTtlSeconds(long walTtlSeconds)DBOptionsInterface.walTtlSeconds()andDBOptionsInterface.walSizeLimitMB()affect how archived logs will be deleted.DBOptionssetWritableFileMaxBufferSize(long writableFileMaxBufferSize)This is the maximum buffer size that is used by WritableFileWriter.DBOptionssetWriteBufferManager(WriteBufferManager writeBufferManager)Use passedWriteBufferManagerto control memory usage across multiple column families and/or DB instances.DBOptionssetWriteDbidToManifest(boolean writeDbidToManifest)Historically DB ID has always been stored in Identity File in DB folder.DBOptionssetWriteThreadMaxYieldUsec(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.DBOptionssetWriteThreadSlowYieldUsec(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.booleanskipCheckingSstFileSizesOnDbOpen()If true, thenRocksDB.open(String)will not fetch and check sizes of all sst files.booleanskipStatsUpdateOnDbOpen()If true, then DB::Open() will not update the statistics used to optimize compaction decision by loading table properties from many files.Statisticsstatistics()Returns statistics object.intstatsDumpPeriodSec()If not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)longstatsHistoryBufferSize()If not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped atstatsHistoryBufferSizeintstatsPersistPeriodSec()If not zero, dump rocksdb.stats to RocksDB everystatsPersistPeriodSecbooleanstrictBytesPerSync()Return the strict byte limit per sync.inttableCacheNumshardbits()Number of shards used for table cache.booleantwoWriteQueues()Returns true if two write queues are enabled.booleanunorderedWrite()Returns true if unordered write are enabled.booleanuseAdaptiveMutex()Use adaptive mutex, which spins in the user space before resorting to kernel.booleanuseDirectIoForFlushAndCompaction()Enable the OS to use direct reads and writes in flush and compactionbooleanuseDirectReads()Enable the OS to use direct I/O for reading sst tables.booleanuseFsync()If true, then every store to stable storage will issue a fsync.longwalBytesPerSync()Same asMutableDBOptionsInterface.bytesPerSync(), but applies to WAL files Default: 0, turned offjava.lang.StringwalDir()Returns the path to the write-ahead-logs (WAL) directory.WalFilterwalFilter()Get's the filter for processing WALs during recovery.WALRecoveryModewalRecoveryMode()Recovery mode to control the consistency while replaying WAL Default:WALRecoveryMode.PointInTimeRecoverylongwalSizeLimitMB()DBOptionsInterface.walTtlSeconds()and#walSizeLimitMB()affect how archived logs will be deleted.longwalTtlSeconds()WalTtlSeconds() and walSizeLimitMB() affect how archived logs will be deleted.longwritableFileMaxBufferSize()This is the maximum buffer size that is used by WritableFileWriter.WriteBufferManagerwriteBufferManager()Reference toWriteBufferManagerused by it.booleanwriteDbidToManifest()Historically DB ID has always been stored in Identity File in DB folder.longwriteThreadMaxYieldUsec()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.longwriteThreadSlowYieldUsec()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.-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Constructor Detail
-
DBOptions
public DBOptions()
Construct DBOptions. This constructor will create (by allocating a block of memory) anrocksdb::DBOptionsin the c++ side.
-
DBOptions
public DBOptions(DBOptions other)
Copy constructor for DBOptions. NOTE: This does a shallow copy, which means env, rate_limiter, sst_file_manager, info_log and other pointers will be cloned!- Parameters:
other- The DBOptions to copy.
-
DBOptions
public DBOptions(Options options)
Constructor from Options- Parameters:
options- The options.
-
-
Method Detail
-
getDBOptionsFromProps
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.- Parameters:
cfgOpts- The ConfigOptions to control how the string is processed.properties-Propertiesinstance.- Returns:
instanceor null.- Throws:
java.lang.IllegalArgumentException- if null or emptyPropertiesinstance is passed to the method call.
-
getDBOptionsFromProps
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.- Parameters:
properties-Propertiesinstance.- Returns:
instanceor null.- Throws:
java.lang.IllegalArgumentException- if null or emptyPropertiesinstance is passed to the method call.
-
optimizeForSmallDb
public DBOptions optimizeForSmallDb()
Description copied from interface:DBOptionsInterfaceUse this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables.- Specified by:
optimizeForSmallDbin interfaceDBOptionsInterface<DBOptions>- Returns:
- the instance of the current object.
-
setIncreaseParallelism
public DBOptions setIncreaseParallelism(int totalThreads)
Description copied from interface: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.
- Specified by:
setIncreaseParallelismin interfaceDBOptionsInterface<DBOptions>- Parameters:
totalThreads- The total number of threads to be used by RocksDB. A good value is the number of cores.- Returns:
- the instance of the current Options
-
setCreateIfMissing
public DBOptions setCreateIfMissing(boolean flag)
Description copied from interface:DBOptionsInterfaceIf this value is set to true, then the database will be created if it is missing duringRocksDB.open(). Default: false- Specified by:
setCreateIfMissingin interfaceDBOptionsInterface<DBOptions>- Parameters:
flag- a flag indicating whether to create a database the specified database inRocksDB.open(org.rocksdb.Options, String)operation is missing.- Returns:
- the instance of the current Options
- See Also:
RocksDB.open(org.rocksdb.Options, String)
-
createIfMissing
public boolean createIfMissing()
Description copied from interface:DBOptionsInterfaceReturn true if the create_if_missing flag is set to true. If true, the database will be created if it is missing.- Specified by:
createIfMissingin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if the createIfMissing option is set to true.
- See Also:
DBOptionsInterface.setCreateIfMissing(boolean)
-
setCreateMissingColumnFamilies
public DBOptions setCreateMissingColumnFamilies(boolean flag)
Description copied from interface:DBOptionsInterfaceIf true, missing column families will be automatically created
Default: false
- Specified by:
setCreateMissingColumnFamiliesin interfaceDBOptionsInterface<DBOptions>- Parameters:
flag- a flag indicating if missing column families shall be created automatically.- Returns:
- true if missing column families shall be created automatically on open.
-
createMissingColumnFamilies
public boolean createMissingColumnFamilies()
Description copied from interface:DBOptionsInterfaceReturn true if the create_missing_column_families flag is set to true. If true column families be created if missing.- Specified by:
createMissingColumnFamiliesin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if the createMissingColumnFamilies is set to true.
- See Also:
DBOptionsInterface.setCreateMissingColumnFamilies(boolean)
-
setErrorIfExists
public DBOptions setErrorIfExists(boolean errorIfExists)
Description copied from interface:DBOptionsInterfaceIf true, an error will be thrown during RocksDB.open() if the database already exists. Default: false- Specified by:
setErrorIfExistsin interfaceDBOptionsInterface<DBOptions>- Parameters:
errorIfExists- if true, an exception will be thrown duringRocksDB.open()if the database already exists.- Returns:
- the reference to the current option.
- See Also:
RocksDB.open(org.rocksdb.Options, String)
-
errorIfExists
public boolean errorIfExists()
Description copied from interface:DBOptionsInterfaceIf true, an error will be thrown during RocksDB.open() if the database already exists.- Specified by:
errorIfExistsin interfaceDBOptionsInterface<DBOptions>- Returns:
- if true, an error is raised when the specified database already exists before open.
-
setParanoidChecks
public DBOptions setParanoidChecks(boolean paranoidChecks)
Description copied from interface:DBOptionsInterfaceIf true, the implementation will do aggressive checking of the data it is processing and will stop early if it detects any errors. This may have unforeseen ramifications: for example, a corruption of one DB entry may cause a large number of entries to become unreadable or for the entire DB to become unopenable. If any of the writes to the database fails (Put, Delete, Merge, Write), the database will switch to read-only mode and fail all other Write operations. Default: true- Specified by:
setParanoidChecksin interfaceDBOptionsInterface<DBOptions>- Parameters:
paranoidChecks- a flag to indicate whether paranoid-check is on.- Returns:
- the reference to the current option.
-
paranoidChecks
public boolean paranoidChecks()
Description copied from interface:DBOptionsInterfaceIf true, the implementation will do aggressive checking of the data it is processing and will stop early if it detects any errors. This may have unforeseen ramifications: for example, a corruption of one DB entry may cause a large number of entries to become unreadable or for the entire DB to become unopenable. If any of the writes to the database fails (Put, Delete, Merge, Write), the database will switch to read-only mode and fail all other Write operations.- Specified by:
paranoidChecksin interfaceDBOptionsInterface<DBOptions>- Returns:
- a boolean indicating whether paranoid-check is on.
-
setEnv
public DBOptions setEnv(Env env)
Description copied from interface:DBOptionsInterfaceUse the specified object to interact with the environment, e.g. to read/write files, schedule background work, etc. Default:Env.getDefault()- Specified by:
setEnvin interfaceDBOptionsInterface<DBOptions>- Parameters:
env-Envinstance.- Returns:
- the instance of the current Options.
-
getEnv
public Env getEnv()
Description copied from interface:DBOptionsInterfaceReturns the set RocksEnv instance.- Specified by:
getEnvin interfaceDBOptionsInterface<DBOptions>- Returns:
RocksEnvinstance set in the options.
-
setRateLimiter
public DBOptions setRateLimiter(RateLimiter rateLimiter)
Description copied from interface:DBOptionsInterfaceUse to control write rate of flush and compaction. Flush has higher priority than compaction. Rate limiting is disabled if nullptr. Default: nullptr- Specified by:
setRateLimiterin interfaceDBOptionsInterface<DBOptions>- Parameters:
rateLimiter-RateLimiterinstance.- Returns:
- the instance of the current object.
-
setSstFileManager
public DBOptions setSstFileManager(SstFileManager sstFileManager)
Description copied from interface:DBOptionsInterfaceUse to track SST files and control their file deletion rate. Features: - Throttle the deletion rate of the SST files. - Keep track the total size of all SST files. - Set a maximum allowed space limit for SST files that when reached the DB wont do any further flushes or compactions and will set the background error. - Can be shared between multiple dbs. Limitations: - Only track and throttle deletes of SST files in first db_path (db_name if db_paths is empty).- Specified by:
setSstFileManagerin interfaceDBOptionsInterface<DBOptions>- Parameters:
sstFileManager- The SST File Manager for the db.- Returns:
- the instance of the current object.
-
setLogger
public DBOptions setLogger(Logger logger)
Description copied from interface: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
- Specified by:
setLoggerin interfaceDBOptionsInterface<DBOptions>- Parameters:
logger-Loggerinstance.- Returns:
- the instance of the current object.
-
setInfoLogLevel
public DBOptions setInfoLogLevel(InfoLogLevel infoLogLevel)
Description copied from interface:DBOptionsInterfaceSets the RocksDB log level. Default level is INFO
- Specified by:
setInfoLogLevelin interfaceDBOptionsInterface<DBOptions>- Parameters:
infoLogLevel- log level to set.- Returns:
- the instance of the current object.
-
infoLogLevel
public InfoLogLevel infoLogLevel()
Description copied from interface:DBOptionsInterfaceReturns currently set log level.
- Specified by:
infoLogLevelin interfaceDBOptionsInterface<DBOptions>- Returns:
InfoLogLevelinstance.
-
setMaxOpenFiles
public DBOptions setMaxOpenFiles(int maxOpenFiles)
Description copied from interface:MutableDBOptionsInterfaceNumber of open files that can be used by the DB. You may need to increase this if your database has a large working set. Value -1 means files opened are always kept open. You can estimate number of files based ontarget_file_size_baseandtarget_file_size_multiplierfor level-based compaction. For universal-style compaction, you can usually set it to -1. Default: -1- Specified by:
setMaxOpenFilesin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
maxOpenFiles- the maximum number of open files.- Returns:
- the instance of the current object.
-
maxOpenFiles
public int maxOpenFiles()
Description copied from interface:MutableDBOptionsInterfaceNumber of open files that can be used by the DB. You may need to increase this if your database has a large working set. Value -1 means files opened are always kept open. You can estimate number of files based ontarget_file_size_baseandtarget_file_size_multiplierfor level-based compaction. For universal-style compaction, you can usually set it to -1. Default: -1- Specified by:
maxOpenFilesin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the maximum number of open files.
-
setMaxFileOpeningThreads
public DBOptions setMaxFileOpeningThreads(int maxFileOpeningThreads)
Description copied from interface:DBOptionsInterfaceIfMutableDBOptionsInterface.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: 16- Specified by:
setMaxFileOpeningThreadsin interfaceDBOptionsInterface<DBOptions>- Parameters:
maxFileOpeningThreads- the maximum number of threads to use to open files- Returns:
- the reference to the current options.
-
maxFileOpeningThreads
public int maxFileOpeningThreads()
Description copied from interface:DBOptionsInterfaceIfMutableDBOptionsInterface.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: 16- Specified by:
maxFileOpeningThreadsin interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum number of threads to use to open files
-
setMaxTotalWalSize
public DBOptions setMaxTotalWalSize(long maxTotalWalSize)
Description copied from interface:MutableDBOptionsInterfaceOnce 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
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
- Specified by:
setMaxTotalWalSizein interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
maxTotalWalSize- max total wal size.- Returns:
- the instance of the current object.
-
maxTotalWalSize
public long maxTotalWalSize()
Description copied from interface:MutableDBOptionsInterfaceReturns 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
- Specified by:
maxTotalWalSizein interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- max total wal size
-
setStatistics
public DBOptions setStatistics(Statistics statistics)
Description copied from interface: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.
- Specified by:
setStatisticsin interfaceDBOptionsInterface<DBOptions>- Parameters:
statistics- The statistics to set- Returns:
- the instance of the current object.
- See Also:
RocksDB.open(org.rocksdb.Options, String)
-
statistics
public Statistics statistics()
Description copied from interface:DBOptionsInterfaceReturns statistics object.
- Specified by:
statisticsin interfaceDBOptionsInterface<DBOptions>- Returns:
- the instance of the statistics object or null if there is no statistics object.
- See Also:
DBOptionsInterface.setStatistics(Statistics)
-
setUseFsync
public DBOptions setUseFsync(boolean useFsync)
Description copied from interface: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
- Specified by:
setUseFsyncin interfaceDBOptionsInterface<DBOptions>- Parameters:
useFsync- a boolean flag to specify whether to use fsync- Returns:
- the instance of the current object.
-
useFsync
public boolean useFsync()
Description copied from interface: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.
- Specified by:
useFsyncin interfaceDBOptionsInterface<DBOptions>- Returns:
- boolean value indicating if fsync is used.
-
setDbPaths
public DBOptions setDbPaths(java.util.Collection<DbPath> dbPaths)
Description copied from interface:DBOptionsInterfaceA list of paths where SST files can be put into, with its target size. Newer data is placed into paths specified earlier in the vector while older data gradually moves to paths specified later in the vector. For example, you have a flash device with 10GB allocated for the DB, as well as a hard drive of 2TB, you should config it to be: [{"/flash_path", 10GB}, {"/hard_drive", 2TB}] The system will try to guarantee data under each path is close to but not larger than the target size. But current and future file sizes used by determining where to place a file are based on best-effort estimation, which means there is a chance that the actual size under the directory is slightly more than target size under some workloads. User should give some buffer room for those cases. If none of the paths has sufficient room to place a file, the file will be placed to the last path anyway, despite to the target size. Placing newer data to earlier paths is also best-efforts. User should expect user files to be placed in higher levels in some extreme cases. If left empty, only one path will be used, which is db_name passed when opening the DB. Default: empty- Specified by:
setDbPathsin interfaceDBOptionsInterface<DBOptions>- Parameters:
dbPaths- the paths and target sizes- Returns:
- the reference to the current options
-
dbPaths
public java.util.List<DbPath> dbPaths()
Description copied from interface:DBOptionsInterfaceA list of paths where SST files can be put into, with its target size. Newer data is placed into paths specified earlier in the vector while older data gradually moves to paths specified later in the vector. For example, you have a flash device with 10GB allocated for the DB, as well as a hard drive of 2TB, you should config it to be: [{"/flash_path", 10GB}, {"/hard_drive", 2TB}] The system will try to guarantee data under each path is close to but not larger than the target size. But current and future file sizes used by determining where to place a file are based on best-effort estimation, which means there is a chance that the actual size under the directory is slightly more than target size under some workloads. User should give some buffer room for those cases. If none of the paths has sufficient room to place a file, the file will be placed to the last path anyway, despite to the target size. Placing newer data to earlier paths is also best-efforts. User should expect user files to be placed in higher levels in some extreme cases. If left empty, only one path will be used, which is db_name passed when opening the DB. Default:Collections.emptyList()- Specified by:
dbPathsin interfaceDBOptionsInterface<DBOptions>- Returns:
- dbPaths the paths and target sizes
-
setDbLogDir
public DBOptions setDbLogDir(java.lang.String dbLogDir)
Description copied from interface:DBOptionsInterfaceThis specifies the info LOG dir. If it is empty, the log files will be in the same dir as data. If it is non empty, the log files will be in the specified dir, and the db data dir's absolute path will be used as the log file name's prefix.- Specified by:
setDbLogDirin interfaceDBOptionsInterface<DBOptions>- Parameters:
dbLogDir- the path to the info log directory- Returns:
- the instance of the current object.
-
dbLogDir
public java.lang.String dbLogDir()
Description copied from interface:DBOptionsInterfaceReturns the directory of info log. If it is empty, the log files will be in the same dir as data. If it is non empty, the log files will be in the specified dir, and the db data dir's absolute path will be used as the log file name's prefix.- Specified by:
dbLogDirin interfaceDBOptionsInterface<DBOptions>- Returns:
- the path to the info log directory
-
setWalDir
public DBOptions setWalDir(java.lang.String walDir)
Description copied from interface:DBOptionsInterfaceThis specifies the absolute dir path for write-ahead logs (WAL). If it is empty, the log files will be in the same dir as data, dbname is used as the data dir by default If it is non empty, the log files will be in kept the specified dir. When destroying the db, all log files in wal_dir and the dir itself is deleted- Specified by:
setWalDirin interfaceDBOptionsInterface<DBOptions>- Parameters:
walDir- the path to the write-ahead-log directory.- Returns:
- the instance of the current object.
-
walDir
public java.lang.String walDir()
Description copied from interface:DBOptionsInterfaceReturns the path to the write-ahead-logs (WAL) directory. If it is empty, the log files will be in the same dir as data, dbname is used as the data dir by default If it is non empty, the log files will be in kept the specified dir. When destroying the db, all log files in wal_dir and the dir itself is deleted- Specified by:
walDirin interfaceDBOptionsInterface<DBOptions>- Returns:
- the path to the write-ahead-logs (WAL) directory.
-
setDeleteObsoleteFilesPeriodMicros
public DBOptions setDeleteObsoleteFilesPeriodMicros(long micros)
Description copied from interface:DBOptionsInterfaceThe periodicity when obsolete files get deleted. The default value is 6 hours. The files that get out of scope by compaction process will still get automatically delete on every compaction, regardless of this setting- Specified by:
setDeleteObsoleteFilesPeriodMicrosin interfaceDBOptionsInterface<DBOptions>- Specified by:
setDeleteObsoleteFilesPeriodMicrosin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
micros- the time interval in micros- Returns:
- the instance of the current object.
-
deleteObsoleteFilesPeriodMicros
public long deleteObsoleteFilesPeriodMicros()
Description copied from interface:DBOptionsInterfaceThe periodicity when obsolete files get deleted. The default value is 6 hours. The files that get out of scope by compaction process will still get automatically delete on every compaction, regardless of this setting- Specified by:
deleteObsoleteFilesPeriodMicrosin interfaceDBOptionsInterface<DBOptions>- Specified by:
deleteObsoleteFilesPeriodMicrosin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the time interval in micros when obsolete files will be deleted.
-
setMaxBackgroundJobs
public DBOptions setMaxBackgroundJobs(int maxBackgroundJobs)
Description copied from interface:MutableDBOptionsInterfaceSpecifies the maximum number of concurrent background jobs (both flushes and compactions combined). Default: 2- Specified by:
setMaxBackgroundJobsin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
maxBackgroundJobs- number of max concurrent background jobs- Returns:
- the instance of the current object.
-
maxBackgroundJobs
public int maxBackgroundJobs()
Description copied from interface:MutableDBOptionsInterfaceReturns the maximum number of concurrent background jobs (both flushes and compactions combined). Default: 2- Specified by:
maxBackgroundJobsin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the maximum number of concurrent background jobs.
-
setBaseBackgroundCompactions
@Deprecated public void setBaseBackgroundCompactions(int baseBackgroundCompactions)
Deprecated.Description copied from interface:MutableDBOptionsInterfaceNOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. This option is ignored. Suggested number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. Default: -1- Specified by:
setBaseBackgroundCompactionsin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
baseBackgroundCompactions- Suggested number of background compaction jobs
-
baseBackgroundCompactions
public int baseBackgroundCompactions()
Description copied from interface:MutableDBOptionsInterfaceNOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. This option is ignored. Suggested number of concurrent background compaction jobs, submitted to the default LOW priority thread pool. Default: -1- Specified by:
baseBackgroundCompactionsin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- Suggested number of background compaction jobs
-
setMaxBackgroundCompactions
@Deprecated public DBOptions setMaxBackgroundCompactions(int maxBackgroundCompactions)
Deprecated.Description copied from interface:MutableDBOptionsInterfaceNOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes` (we replace -1 by 1 in case one option is unset). Specifies 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- Specified by:
setMaxBackgroundCompactionsin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
maxBackgroundCompactions- the maximum number of background compaction jobs.- Returns:
- the instance of the current object.
- See Also:
Env.setBackgroundThreads(int),Env.setBackgroundThreads(int, Priority),DBOptionsInterface.maxBackgroundFlushes()
-
maxBackgroundCompactions
@Deprecated public int maxBackgroundCompactions()
Deprecated.Description copied from interface:MutableDBOptionsInterfaceNOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes` (we replace -1 by 1 in case one option is unset). Returns 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- Specified by:
maxBackgroundCompactionsin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the maximum number of concurrent background compaction jobs.
- See Also:
Env.setBackgroundThreads(int),Env.setBackgroundThreads(int, Priority)
-
setMaxSubcompactions
public DBOptions setMaxSubcompactions(int maxSubcompactions)
Description copied from interface:DBOptionsInterfaceThis 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. Default: 1 (i.e. no subcompactions)- Specified by:
setMaxSubcompactionsin interfaceDBOptionsInterface<DBOptions>- Parameters:
maxSubcompactions- The maximum number of threads that will concurrently perform a compaction job- Returns:
- the instance of the current object.
-
maxSubcompactions
public int maxSubcompactions()
Description copied from interface:DBOptionsInterfaceThis 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. Default: 1 (i.e. no subcompactions)- Specified by:
maxSubcompactionsin interfaceDBOptionsInterface<DBOptions>- Returns:
- The maximum number of threads that will concurrently perform a compaction job
-
setMaxBackgroundFlushes
@Deprecated public DBOptions setMaxBackgroundFlushes(int maxBackgroundFlushes)
Deprecated.Description copied from interface:DBOptionsInterfaceNOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes`. Specifies the maximum number of concurrent background flush jobs. If you're increasing this, also consider increasing number of threads in HIGH priority thread pool. For more information, see Default: -1- Specified by:
setMaxBackgroundFlushesin interfaceDBOptionsInterface<DBOptions>- Parameters:
maxBackgroundFlushes- number of max concurrent flush jobs- Returns:
- the instance of the current object.
- See Also:
Env.setBackgroundThreads(int),Env.setBackgroundThreads(int, Priority),MutableDBOptionsInterface.maxBackgroundCompactions()
-
maxBackgroundFlushes
@Deprecated public int maxBackgroundFlushes()
Deprecated.Description copied from interface:DBOptionsInterfaceNOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the value of max_background_jobs. For backwards compatibility we will set `max_background_jobs = max_background_compactions + max_background_flushes` in the case where user sets at least one of `max_background_compactions` or `max_background_flushes`. Returns the maximum number of concurrent background flush jobs. If you're increasing this, also consider increasing number of threads in HIGH priority thread pool. For more information, see Default: -1- Specified by:
maxBackgroundFlushesin interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum number of concurrent background flush jobs.
- See Also:
Env.setBackgroundThreads(int),Env.setBackgroundThreads(int, Priority)
-
setMaxLogFileSize
public DBOptions setMaxLogFileSize(long maxLogFileSize)
Description copied from interface:DBOptionsInterfaceSpecifies the maximum size of a info log file. If the current log file is larger than `max_log_file_size`, a new info log file will be created. If 0, all logs will be written to one log file.- Specified by:
setMaxLogFileSizein interfaceDBOptionsInterface<DBOptions>- Parameters:
maxLogFileSize- the maximum size of a info log file.- Returns:
- the instance of the current object.
-
maxLogFileSize
public long maxLogFileSize()
Description copied from interface:DBOptionsInterfaceReturns the maximum size of a info log file. If the current log file is larger than this size, a new info log file will be created. If 0, all logs will be written to one log file.- Specified by:
maxLogFileSizein interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum size of the info log file.
-
setLogFileTimeToRoll
public DBOptions setLogFileTimeToRoll(long logFileTimeToRoll)
Description copied from interface:DBOptionsInterfaceSpecifies the time interval for the info log file to roll (in seconds). If specified with non-zero value, log file will be rolled if it has been active longer than `log_file_time_to_roll`. Default: 0 (disabled)- Specified by:
setLogFileTimeToRollin interfaceDBOptionsInterface<DBOptions>- Parameters:
logFileTimeToRoll- the time interval in seconds.- Returns:
- the instance of the current object.
-
logFileTimeToRoll
public long logFileTimeToRoll()
Description copied from interface:DBOptionsInterfaceReturns the time interval for the info log file to roll (in seconds). If specified with non-zero value, log file will be rolled if it has been active longer than `log_file_time_to_roll`. Default: 0 (disabled)- Specified by:
logFileTimeToRollin interfaceDBOptionsInterface<DBOptions>- Returns:
- the time interval in seconds.
-
setKeepLogFileNum
public DBOptions setKeepLogFileNum(long keepLogFileNum)
Description copied from interface:DBOptionsInterfaceSpecifies the maximum number of info log files to be kept. Default: 1000- Specified by:
setKeepLogFileNumin interfaceDBOptionsInterface<DBOptions>- Parameters:
keepLogFileNum- the maximum number of info log files to be kept.- Returns:
- the instance of the current object.
-
keepLogFileNum
public long keepLogFileNum()
Description copied from interface:DBOptionsInterfaceReturns the maximum number of info log files to be kept. Default: 1000- Specified by:
keepLogFileNumin interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum number of info log files to be kept.
-
setRecycleLogFileNum
public DBOptions setRecycleLogFileNum(long recycleLogFileNum)
Description copied from interface:DBOptionsInterfaceRecycle log files. If non-zero, we will reuse previously written log files for new logs, overwriting the old data. The value indicates how many such files we will keep around at any point in time for later use. This is more efficient because the blocks are already allocated and fdatasync does not need to update the inode after each write. Default: 0- Specified by:
setRecycleLogFileNumin interfaceDBOptionsInterface<DBOptions>- Parameters:
recycleLogFileNum- the number of log files to keep for recycling- Returns:
- the reference to the current options
-
recycleLogFileNum
public long recycleLogFileNum()
Description copied from interface:DBOptionsInterfaceRecycle log files. If non-zero, we will reuse previously written log files for new logs, overwriting the old data. The value indicates how many such files we will keep around at any point in time for later use. This is more efficient because the blocks are already allocated and fdatasync does not need to update the inode after each write. Default: 0- Specified by:
recycleLogFileNumin interfaceDBOptionsInterface<DBOptions>- Returns:
- the number of log files kept for recycling
-
setMaxManifestFileSize
public DBOptions setMaxManifestFileSize(long maxManifestFileSize)
Description copied from interface:DBOptionsInterfaceManifest file is rolled over on reaching this limit. The older manifest file be deleted. The default value is 1GB so that the manifest file can grow, but not reach the limit of storage capacity.- Specified by:
setMaxManifestFileSizein interfaceDBOptionsInterface<DBOptions>- Parameters:
maxManifestFileSize- the size limit of a manifest file.- Returns:
- the instance of the current object.
-
maxManifestFileSize
public long maxManifestFileSize()
Description copied from interface:DBOptionsInterfaceManifest file is rolled over on reaching this limit. The older manifest file be deleted. The default value is 1GB so that the manifest file can grow, but not reach the limit of storage capacity.- Specified by:
maxManifestFileSizein interfaceDBOptionsInterface<DBOptions>- Returns:
- the size limit of a manifest file.
-
setTableCacheNumshardbits
public DBOptions setTableCacheNumshardbits(int tableCacheNumshardbits)
Description copied from interface:DBOptionsInterfaceNumber of shards used for table cache.- Specified by:
setTableCacheNumshardbitsin interfaceDBOptionsInterface<DBOptions>- Parameters:
tableCacheNumshardbits- the number of chards- Returns:
- the instance of the current object.
-
tableCacheNumshardbits
public int tableCacheNumshardbits()
Description copied from interface:DBOptionsInterfaceNumber of shards used for table cache.- Specified by:
tableCacheNumshardbitsin interfaceDBOptionsInterface<DBOptions>- Returns:
- the number of shards used for table cache.
-
setWalTtlSeconds
public DBOptions setWalTtlSeconds(long walTtlSeconds)
Description copied from interface:DBOptionsInterfaceDBOptionsInterface.walTtlSeconds()andDBOptionsInterface.walSizeLimitMB()affect how archived logs will be deleted.- If both set to 0, logs will be deleted asap and will not get into the archive.
- If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0, WAL files will be checked every 10 min and if total size is greater then WAL_size_limit_MB, they will be deleted starting with the earliest until size_limit is met. All empty files will be deleted.
- If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then WAL files will be checked every WAL_ttl_seconds / 2 and those that are older than WAL_ttl_seconds will be deleted.
- If both are not 0, WAL files will be checked every 10 min and both checks will be performed with ttl being first.
- Specified by:
setWalTtlSecondsin interfaceDBOptionsInterface<DBOptions>- Parameters:
walTtlSeconds- the ttl seconds- Returns:
- the instance of the current object.
- See Also:
DBOptionsInterface.setWalSizeLimitMB(long)
-
walTtlSeconds
public long walTtlSeconds()
Description copied from interface:DBOptionsInterfaceWalTtlSeconds() and walSizeLimitMB() affect how archived logs will be deleted.- If both set to 0, logs will be deleted asap and will not get into the archive.
- If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0, WAL files will be checked every 10 min and if total size is greater then WAL_size_limit_MB, they will be deleted starting with the earliest until size_limit is met. All empty files will be deleted.
- If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then WAL files will be checked every WAL_ttl_seconds / 2 and those that are older than WAL_ttl_seconds will be deleted.
- If both are not 0, WAL files will be checked every 10 min and both checks will be performed with ttl being first.
- Specified by:
walTtlSecondsin interfaceDBOptionsInterface<DBOptions>- Returns:
- the wal-ttl seconds
- See Also:
DBOptionsInterface.walSizeLimitMB()
-
setWalSizeLimitMB
public DBOptions setWalSizeLimitMB(long sizeLimitMB)
Description copied from interface:DBOptionsInterfaceWalTtlSeconds() and walSizeLimitMB() affect how archived logs will be deleted.- If both set to 0, logs will be deleted asap and will not get into the archive.
- If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0, WAL files will be checked every 10 min and if total size is greater then WAL_size_limit_MB, they will be deleted starting with the earliest until size_limit is met. All empty files will be deleted.
- If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then WAL files will be checked every WAL_ttl_secondsi / 2 and those that are older than WAL_ttl_seconds will be deleted.
- If both are not 0, WAL files will be checked every 10 min and both checks will be performed with ttl being first.
- Specified by:
setWalSizeLimitMBin interfaceDBOptionsInterface<DBOptions>- Parameters:
sizeLimitMB- size limit in mega-bytes.- Returns:
- the instance of the current object.
- See Also:
DBOptionsInterface.setWalSizeLimitMB(long)
-
walSizeLimitMB
public long walSizeLimitMB()
Description copied from interface:DBOptionsInterfaceDBOptionsInterface.walTtlSeconds()and#walSizeLimitMB()affect how archived logs will be deleted.- If both set to 0, logs will be deleted asap and will not get into the archive.
- If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0, WAL files will be checked every 10 min and if total size is greater then WAL_size_limit_MB, they will be deleted starting with the earliest until size_limit is met. All empty files will be deleted.
- If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then WAL files will be checked every WAL_ttl_seconds i / 2 and those that are older than WAL_ttl_seconds will be deleted.
- If both are not 0, WAL files will be checked every 10 min and both checks will be performed with ttl being first.
- Specified by:
walSizeLimitMBin interfaceDBOptionsInterface<DBOptions>- Returns:
- size limit in mega-bytes.
- See Also:
DBOptionsInterface.walSizeLimitMB()
-
setMaxWriteBatchGroupSizeBytes
public DBOptions setMaxWriteBatchGroupSizeBytes(long maxWriteBatchGroupSizeBytes)
Description copied from interface:DBOptionsInterfaceThe maximum limit of number of bytes that are written in a single batch of WAL or memtable write. It is followed when the leader write size is larger than 1/8 of this limit. Default: 1 MB- Specified by:
setMaxWriteBatchGroupSizeBytesin interfaceDBOptionsInterface<DBOptions>- Parameters:
maxWriteBatchGroupSizeBytes- the maximum limit of number of bytes, see description.- Returns:
- the instance of the current object.
-
maxWriteBatchGroupSizeBytes
public long maxWriteBatchGroupSizeBytes()
Description copied from interface:DBOptionsInterfaceThe maximum limit of number of bytes that are written in a single batch of WAL or memtable write. It is followed when the leader write size is larger than 1/8 of this limit. Default: 1 MB- Specified by:
maxWriteBatchGroupSizeBytesin interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum limit of number of bytes, see description.
-
setManifestPreallocationSize
public DBOptions setManifestPreallocationSize(long size)
Description copied from interface:DBOptionsInterfaceNumber of bytes to preallocate (via fallocate) the manifest files. Default is 4mb, which is reasonable to reduce random IO as well as prevent overallocation for mounts that preallocate large amounts of data (such as xfs's allocsize option).- Specified by:
setManifestPreallocationSizein interfaceDBOptionsInterface<DBOptions>- Parameters:
size- the size in byte- Returns:
- the instance of the current object.
-
manifestPreallocationSize
public long manifestPreallocationSize()
Description copied from interface:DBOptionsInterfaceNumber of bytes to preallocate (via fallocate) the manifest files. Default is 4mb, which is reasonable to reduce random IO as well as prevent overallocation for mounts that preallocate large amounts of data (such as xfs's allocsize option).- Specified by:
manifestPreallocationSizein interfaceDBOptionsInterface<DBOptions>- Returns:
- size in bytes.
-
setAllowMmapReads
public DBOptions setAllowMmapReads(boolean allowMmapReads)
Description copied from interface:DBOptionsInterfaceAllow the OS to mmap file for reading sst tables. Default: false- Specified by:
setAllowMmapReadsin interfaceDBOptionsInterface<DBOptions>- Parameters:
allowMmapReads- true if mmap reads are allowed.- Returns:
- the instance of the current object.
-
allowMmapReads
public boolean allowMmapReads()
Description copied from interface:DBOptionsInterfaceAllow the OS to mmap file for reading sst tables. Default: false- Specified by:
allowMmapReadsin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if mmap reads are allowed.
-
setAllowMmapWrites
public DBOptions setAllowMmapWrites(boolean allowMmapWrites)
Description copied from interface:DBOptionsInterfaceAllow the OS to mmap file for writing. Default: false- Specified by:
setAllowMmapWritesin interfaceDBOptionsInterface<DBOptions>- Parameters:
allowMmapWrites- true if mmap writes are allowd.- Returns:
- the instance of the current object.
-
allowMmapWrites
public boolean allowMmapWrites()
Description copied from interface:DBOptionsInterfaceAllow the OS to mmap file for writing. Default: false- Specified by:
allowMmapWritesin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if mmap writes are allowed.
-
setUseDirectReads
public DBOptions setUseDirectReads(boolean useDirectReads)
Description copied from interface:DBOptionsInterfaceEnable the OS to use direct I/O for reading sst tables. Default: false- Specified by:
setUseDirectReadsin interfaceDBOptionsInterface<DBOptions>- Parameters:
useDirectReads- if true, then direct read is enabled- Returns:
- the instance of the current object.
-
useDirectReads
public boolean useDirectReads()
Description copied from interface:DBOptionsInterfaceEnable the OS to use direct I/O for reading sst tables. Default: false- Specified by:
useDirectReadsin interfaceDBOptionsInterface<DBOptions>- Returns:
- if true, then direct reads are enabled
-
setUseDirectIoForFlushAndCompaction
public DBOptions setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction)
Description copied from interface:DBOptionsInterfaceEnable the OS to use direct reads and writes in flush and compaction Default: false- Specified by:
setUseDirectIoForFlushAndCompactionin interfaceDBOptionsInterface<DBOptions>- Parameters:
useDirectIoForFlushAndCompaction- if true, then direct I/O will be enabled for background flush and compactions- Returns:
- the instance of the current object.
-
useDirectIoForFlushAndCompaction
public boolean useDirectIoForFlushAndCompaction()
Description copied from interface:DBOptionsInterfaceEnable the OS to use direct reads and writes in flush and compaction- Specified by:
useDirectIoForFlushAndCompactionin interfaceDBOptionsInterface<DBOptions>- Returns:
- if true, then direct I/O is enabled for flush and compaction
-
setAllowFAllocate
public DBOptions setAllowFAllocate(boolean allowFAllocate)
Description copied from interface:DBOptionsInterfaceWhether fallocate calls are allowed- Specified by:
setAllowFAllocatein interfaceDBOptionsInterface<DBOptions>- Parameters:
allowFAllocate- false if fallocate() calls are bypassed- Returns:
- the reference to the current options.
-
allowFAllocate
public boolean allowFAllocate()
Description copied from interface:DBOptionsInterfaceWhether fallocate calls are allowed- Specified by:
allowFAllocatein interfaceDBOptionsInterface<DBOptions>- Returns:
- false if fallocate() calls are bypassed
-
setIsFdCloseOnExec
public DBOptions setIsFdCloseOnExec(boolean isFdCloseOnExec)
Description copied from interface:DBOptionsInterfaceDisable child process inherit open files. Default: true- Specified by:
setIsFdCloseOnExecin interfaceDBOptionsInterface<DBOptions>- Parameters:
isFdCloseOnExec- true if child process inheriting open files is disabled.- Returns:
- the instance of the current object.
-
isFdCloseOnExec
public boolean isFdCloseOnExec()
Description copied from interface:DBOptionsInterfaceDisable child process inherit open files. Default: true- Specified by:
isFdCloseOnExecin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if child process inheriting open files is disabled.
-
setStatsDumpPeriodSec
public DBOptions setStatsDumpPeriodSec(int statsDumpPeriodSec)
Description copied from interface:MutableDBOptionsInterfaceif not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)- Specified by:
setStatsDumpPeriodSecin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
statsDumpPeriodSec- time interval in seconds.- Returns:
- the instance of the current object.
-
statsDumpPeriodSec
public int statsDumpPeriodSec()
Description copied from interface:MutableDBOptionsInterfaceIf not zero, dump rocksdb.stats to LOG every stats_dump_period_sec Default: 600 (10 minutes)- Specified by:
statsDumpPeriodSecin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- time interval in seconds.
-
setStatsPersistPeriodSec
public DBOptions setStatsPersistPeriodSec(int statsPersistPeriodSec)
Description copied from interface:MutableDBOptionsInterfaceIf not zero, dump rocksdb.stats to RocksDB everystatsPersistPeriodSecDefault: 600- Specified by:
setStatsPersistPeriodSecin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
statsPersistPeriodSec- time interval in seconds.- Returns:
- the instance of the current object.
-
statsPersistPeriodSec
public int statsPersistPeriodSec()
Description copied from interface:MutableDBOptionsInterfaceIf not zero, dump rocksdb.stats to RocksDB everystatsPersistPeriodSec- Specified by:
statsPersistPeriodSecin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- time interval in seconds.
-
setStatsHistoryBufferSize
public DBOptions setStatsHistoryBufferSize(long statsHistoryBufferSize)
Description copied from interface:MutableDBOptionsInterfaceIf not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped atstatsHistoryBufferSizeDefault: 1MB- Specified by:
setStatsHistoryBufferSizein interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
statsHistoryBufferSize- the size of the buffer.- Returns:
- the instance of the current object.
-
statsHistoryBufferSize
public long statsHistoryBufferSize()
Description copied from interface:MutableDBOptionsInterfaceIf not zero, periodically take stats snapshots and store in memory, the memory size for stats snapshots is capped atstatsHistoryBufferSize- Specified by:
statsHistoryBufferSizein interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the size of the buffer.
-
setAdviseRandomOnOpen
public DBOptions setAdviseRandomOnOpen(boolean adviseRandomOnOpen)
Description copied from interface:DBOptionsInterfaceIf set true, will hint the underlying file system that the file access pattern is random, when a sst file is opened. Default: true- Specified by:
setAdviseRandomOnOpenin interfaceDBOptionsInterface<DBOptions>- Parameters:
adviseRandomOnOpen- true if hinting random access is on.- Returns:
- the instance of the current object.
-
adviseRandomOnOpen
public boolean adviseRandomOnOpen()
Description copied from interface:DBOptionsInterfaceIf set true, will hint the underlying file system that the file access pattern is random, when a sst file is opened. Default: true- Specified by:
adviseRandomOnOpenin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if hinting random access is on.
-
setDbWriteBufferSize
public DBOptions setDbWriteBufferSize(long dbWriteBufferSize)
Description copied from interface:DBOptionsInterfaceAmount of data to build up in memtables across all column families before writing to disk. This is distinct fromColumnFamilyOptions.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)- Specified by:
setDbWriteBufferSizein interfaceDBOptionsInterface<DBOptions>- Parameters:
dbWriteBufferSize- the size of the write buffer- Returns:
- the reference to the current options.
-
setWriteBufferManager
public DBOptions setWriteBufferManager(WriteBufferManager writeBufferManager)
Description copied from interface:DBOptionsInterfaceUse passedWriteBufferManagerto 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 it- Specified by:
setWriteBufferManagerin interfaceDBOptionsInterface<DBOptions>- Parameters:
writeBufferManager- The WriteBufferManager to use- Returns:
- the reference of the current options.
-
writeBufferManager
public WriteBufferManager writeBufferManager()
Description copied from interface:DBOptionsInterfaceReference toWriteBufferManagerused by it.
Default: null (Disabled)- Specified by:
writeBufferManagerin interfaceDBOptionsInterface<DBOptions>- Returns:
- a reference to WriteBufferManager
-
dbWriteBufferSize
public long dbWriteBufferSize()
Description copied from interface:DBOptionsInterfaceAmount of data to build up in memtables across all column families before writing to disk. This is distinct fromColumnFamilyOptions.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)- Specified by:
dbWriteBufferSizein interfaceDBOptionsInterface<DBOptions>- Returns:
- the size of the write buffer
-
setAccessHintOnCompactionStart
public DBOptions setAccessHintOnCompactionStart(AccessHint accessHint)
Description copied from interface:DBOptionsInterfaceSpecify the file access pattern once a compaction is started. It will be applied to all input files of a compaction. Default:AccessHint.NORMAL- Specified by:
setAccessHintOnCompactionStartin interfaceDBOptionsInterface<DBOptions>- Parameters:
accessHint- The access hint- Returns:
- the reference to the current options.
-
accessHintOnCompactionStart
public AccessHint accessHintOnCompactionStart()
Description copied from interface:DBOptionsInterfaceSpecify the file access pattern once a compaction is started. It will be applied to all input files of a compaction. Default:AccessHint.NORMAL- Specified by:
accessHintOnCompactionStartin interfaceDBOptionsInterface<DBOptions>- Returns:
- The access hint
-
setNewTableReaderForCompactionInputs
public DBOptions setNewTableReaderForCompactionInputs(boolean newTableReaderForCompactionInputs)
Description copied from interface:DBOptionsInterfaceIf true, always create a new file descriptor and new table reader for compaction inputs. Turn this parameter on may introduce extra memory usage in the table reader, if it allocates extra memory for indexes. This will allow file descriptor prefetch options to be set for compaction input files and not to impact file descriptors for the same file used by user queries. Suggest to enableBlockBasedTableConfig.cacheIndexAndFilterBlocks()for this mode if using block-based table. Default: false- Specified by:
setNewTableReaderForCompactionInputsin interfaceDBOptionsInterface<DBOptions>- Parameters:
newTableReaderForCompactionInputs- true if a new file descriptor and table reader should be created for compaction inputs- Returns:
- the reference to the current options.
-
newTableReaderForCompactionInputs
public boolean newTableReaderForCompactionInputs()
Description copied from interface:DBOptionsInterfaceIf true, always create a new file descriptor and new table reader for compaction inputs. Turn this parameter on may introduce extra memory usage in the table reader, if it allocates extra memory for indexes. This will allow file descriptor prefetch options to be set for compaction input files and not to impact file descriptors for the same file used by user queries. Suggest to enableBlockBasedTableConfig.cacheIndexAndFilterBlocks()for this mode if using block-based table. Default: false- Specified by:
newTableReaderForCompactionInputsin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if a new file descriptor and table reader are created for compaction inputs
-
setCompactionReadaheadSize
public DBOptions setCompactionReadaheadSize(long compactionReadaheadSize)
Description copied from interface:MutableDBOptionsInterfaceIf non-zero, we perform bigger reads when doing compaction. If you're running RocksDB on spinning disks, you should set this to at least 2MB. That way RocksDB's compaction is doing sequential instead of random reads. When non-zero, we also forceDBOptionsInterface.newTableReaderForCompactionInputs()to true. Default: 0- Specified by:
setCompactionReadaheadSizein interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
compactionReadaheadSize- The compaction read-ahead size- Returns:
- the reference to the current options.
-
compactionReadaheadSize
public long compactionReadaheadSize()
Description copied from interface:MutableDBOptionsInterfaceIf non-zero, we perform bigger reads when doing compaction. If you're running RocksDB on spinning disks, you should set this to at least 2MB. That way RocksDB's compaction is doing sequential instead of random reads. When non-zero, we also forceDBOptionsInterface.newTableReaderForCompactionInputs()to true. Default: 0- Specified by:
compactionReadaheadSizein interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- The compaction read-ahead size
-
setRandomAccessMaxBufferSize
public DBOptions setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
Description copied from interface:DBOptionsInterfaceThis is a maximum buffer size that is used by WinMmapReadableFile in unbuffered disk I/O mode. We need to maintain an aligned buffer for reads. We allow the buffer to grow until the specified value and then for bigger requests allocate one shot buffers. In unbuffered mode we always bypass read-ahead buffer at ReadaheadRandomAccessFile When read-ahead is required we then make use ofMutableDBOptionsInterface.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.- Specified by:
setRandomAccessMaxBufferSizein interfaceDBOptionsInterface<DBOptions>- Parameters:
randomAccessMaxBufferSize- the maximum size of the random access buffer- Returns:
- the reference to the current options.
-
randomAccessMaxBufferSize
public long randomAccessMaxBufferSize()
Description copied from interface:DBOptionsInterfaceThis is a maximum buffer size that is used by WinMmapReadableFile in unbuffered disk I/O mode. We need to maintain an aligned buffer for reads. We allow the buffer to grow until the specified value and then for bigger requests allocate one shot buffers. In unbuffered mode we always bypass read-ahead buffer at ReadaheadRandomAccessFile When read-ahead is required we then make use ofMutableDBOptionsInterface.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.- Specified by:
randomAccessMaxBufferSizein interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum size of the random access buffer
-
setWritableFileMaxBufferSize
public DBOptions setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
Description copied from interface:MutableDBOptionsInterfaceThis is the maximum buffer size that is used by WritableFileWriter. On Windows, we need to maintain an aligned buffer for writes. We allow the buffer to grow until it's size hits the limit. Default: 1024 * 1024 (1 MB)- Specified by:
setWritableFileMaxBufferSizein interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
writableFileMaxBufferSize- the maximum buffer size- Returns:
- the reference to the current options.
-
writableFileMaxBufferSize
public long writableFileMaxBufferSize()
Description copied from interface:MutableDBOptionsInterfaceThis is the maximum buffer size that is used by WritableFileWriter. On Windows, we need to maintain an aligned buffer for writes. We allow the buffer to grow until it's size hits the limit. Default: 1024 * 1024 (1 MB)- Specified by:
writableFileMaxBufferSizein interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the maximum buffer size
-
setUseAdaptiveMutex
public DBOptions setUseAdaptiveMutex(boolean useAdaptiveMutex)
Description copied from interface:DBOptionsInterfaceUse adaptive mutex, which spins in the user space before resorting to kernel. This could reduce context switch when the mutex is not heavily contended. However, if the mutex is hot, we could end up wasting spin time. Default: false- Specified by:
setUseAdaptiveMutexin interfaceDBOptionsInterface<DBOptions>- Parameters:
useAdaptiveMutex- true if adaptive mutex is used.- Returns:
- the instance of the current object.
-
useAdaptiveMutex
public boolean useAdaptiveMutex()
Description copied from interface:DBOptionsInterfaceUse adaptive mutex, which spins in the user space before resorting to kernel. This could reduce context switch when the mutex is not heavily contended. However, if the mutex is hot, we could end up wasting spin time. Default: false- Specified by:
useAdaptiveMutexin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if adaptive mutex is used.
-
setBytesPerSync
public DBOptions setBytesPerSync(long bytesPerSync)
Description copied from interface:MutableDBOptionsInterfaceAllows OS to incrementally sync files to disk while they are being written, asynchronously, in the background. Issue one request for every bytes_per_sync written. 0 turns it off. Default: 0- Specified by:
setBytesPerSyncin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
bytesPerSync- size in bytes- Returns:
- the instance of the current object.
-
bytesPerSync
public long bytesPerSync()
Description copied from interface:MutableDBOptionsInterfaceAllows OS to incrementally sync files to disk while they are being written, asynchronously, in the background. Issue one request for every bytes_per_sync written. 0 turns it off. Default: 0- Specified by:
bytesPerSyncin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- size in bytes
-
setWalBytesPerSync
public DBOptions setWalBytesPerSync(long walBytesPerSync)
Description copied from interface:MutableDBOptionsInterfaceSame asMutableDBOptionsInterface.setBytesPerSync(long), but applies to WAL files Default: 0, turned off- Specified by:
setWalBytesPerSyncin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
walBytesPerSync- size in bytes- Returns:
- the instance of the current object.
-
walBytesPerSync
public long walBytesPerSync()
Description copied from interface:MutableDBOptionsInterfaceSame asMutableDBOptionsInterface.bytesPerSync(), but applies to WAL files Default: 0, turned off- Specified by:
walBytesPerSyncin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- size in bytes
-
setStrictBytesPerSync
public DBOptions setStrictBytesPerSync(boolean strictBytesPerSync)
Description copied from interface:MutableDBOptionsInterfaceWhen true, guarantees WAL files have at mostMutableDBOptionsInterface.walBytesPerSync()bytes submitted for writeback at any given time, and SST files have at mostMutableDBOptionsInterface.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 withMutableDBOptionsInterface.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- Specified by:
setStrictBytesPerSyncin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
strictBytesPerSync- the bytes per sync- Returns:
- the instance of the current object.
-
strictBytesPerSync
public boolean strictBytesPerSync()
Description copied from interface:MutableDBOptionsInterfaceReturn the strict byte limit per sync. SeeMutableDBOptionsInterface.setStrictBytesPerSync(boolean)- Specified by:
strictBytesPerSyncin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the limit in bytes.
-
setListeners
public DBOptions setListeners(java.util.List<AbstractEventListener> listeners)
Description copied from interface:DBOptionsInterfaceSets theEventListeners 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++.- Specified by:
setListenersin interfaceDBOptionsInterface<DBOptions>- Parameters:
listeners- the listeners who should be notified on various events.- Returns:
- the instance of the current object.
-
listeners
public java.util.List<AbstractEventListener> listeners()
Description copied from interface:DBOptionsInterfaceSets theEventListeners 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++.- Specified by:
listenersin interfaceDBOptionsInterface<DBOptions>- Returns:
- the instance of the current object.
-
setEnableThreadTracking
public DBOptions setEnableThreadTracking(boolean enableThreadTracking)
Description copied from interface:DBOptionsInterfaceIf true, then the status of the threads involved in this DB will be tracked and available via GetThreadList() API. Default: false- Specified by:
setEnableThreadTrackingin interfaceDBOptionsInterface<DBOptions>- Parameters:
enableThreadTracking- true to enable tracking- Returns:
- the reference to the current options.
-
enableThreadTracking
public boolean enableThreadTracking()
Description copied from interface:DBOptionsInterfaceIf true, then the status of the threads involved in this DB will be tracked and available via GetThreadList() API. Default: false- Specified by:
enableThreadTrackingin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if tracking is enabled
-
setDelayedWriteRate
public DBOptions setDelayedWriteRate(long delayedWriteRate)
Description copied from interface:MutableDBOptionsInterfaceThe limited write rate to DB ifColumnFamilyOptions.softPendingCompactionBytesLimit()orColumnFamilyOptions.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 throughRocksDB.setDBOptions(MutableDBOptions).- Specified by:
setDelayedWriteRatein interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
delayedWriteRate- the rate in bytes per second- Returns:
- the reference to the current options.
-
delayedWriteRate
public long delayedWriteRate()
Description copied from interface:MutableDBOptionsInterfaceThe limited write rate to DB ifColumnFamilyOptions.softPendingCompactionBytesLimit()orColumnFamilyOptions.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 throughRocksDB.setDBOptions(MutableDBOptions).- Specified by:
delayedWriteRatein interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- the rate in bytes per second
-
setEnablePipelinedWrite
public DBOptions setEnablePipelinedWrite(boolean enablePipelinedWrite)
Description copied from interface:DBOptionsInterfaceBy default, a single write thread queue is maintained. The thread gets to the head of the queue becomes write batch group leader and responsible for writing to WAL and memtable for the batch group. IfDBOptionsInterface.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: false- Specified by:
setEnablePipelinedWritein interfaceDBOptionsInterface<DBOptions>- Parameters:
enablePipelinedWrite- true to enabled pipelined writes- Returns:
- the reference to the current options.
-
enablePipelinedWrite
public boolean enablePipelinedWrite()
Description copied from interface:DBOptionsInterfaceReturns true if pipelined writes are enabled. SeeDBOptionsInterface.setEnablePipelinedWrite(boolean).- Specified by:
enablePipelinedWritein interfaceDBOptionsInterface<DBOptions>- Returns:
- true if pipelined writes are enabled, false otherwise.
-
setUnorderedWrite
public DBOptions setUnorderedWrite(boolean unorderedWrite)
Description copied from interface:DBOptionsInterfaceSettingDBOptionsInterface.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 andDBOptionsInterface.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.- Specified by:
setUnorderedWritein interfaceDBOptionsInterface<DBOptions>- Parameters:
unorderedWrite- true to enabled unordered write- Returns:
- the reference to the current options.
-
unorderedWrite
public boolean unorderedWrite()
Description copied from interface:DBOptionsInterfaceReturns true if unordered write are enabled. SeeDBOptionsInterface.setUnorderedWrite(boolean).- Specified by:
unorderedWritein interfaceDBOptionsInterface<DBOptions>- Returns:
- true if unordered write are enabled, false otherwise.
-
setAllowConcurrentMemtableWrite
public DBOptions setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite)
Description copied from interface:DBOptionsInterfaceIf true, allow multi-writers to update mem tables in parallel. Only some memtable factorys support concurrent writes; currently it is implemented only for SkipListFactory. Concurrent memtable writes are not compatible with inplace_update_support or filter_deletes. It is strongly recommended to setDBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean)if you are going to use this feature. Default: true- Specified by:
setAllowConcurrentMemtableWritein interfaceDBOptionsInterface<DBOptions>- Parameters:
allowConcurrentMemtableWrite- true to enable concurrent writes for the memtable- Returns:
- the reference to the current options.
-
allowConcurrentMemtableWrite
public boolean allowConcurrentMemtableWrite()
Description copied from interface:DBOptionsInterfaceIf true, allow multi-writers to update mem tables in parallel. Only some memtable factorys support concurrent writes; currently it is implemented only for SkipListFactory. Concurrent memtable writes are not compatible with inplace_update_support or filter_deletes. It is strongly recommended to setDBOptionsInterface.setEnableWriteThreadAdaptiveYield(boolean)if you are going to use this feature. Default: true- Specified by:
allowConcurrentMemtableWritein interfaceDBOptionsInterface<DBOptions>- Returns:
- true if concurrent writes are enabled for the memtable
-
setEnableWriteThreadAdaptiveYield
public DBOptions setEnableWriteThreadAdaptiveYield(boolean enableWriteThreadAdaptiveYield)
Description copied from interface:DBOptionsInterfaceIf true, threads synchronizing with the write batch group leader will wait for up toDBOptionsInterface.writeThreadMaxYieldUsec()before blocking on a mutex. This can substantially improve throughput for concurrent workloads, regardless of whetherDBOptionsInterface.allowConcurrentMemtableWrite()is enabled. Default: true- Specified by:
setEnableWriteThreadAdaptiveYieldin interfaceDBOptionsInterface<DBOptions>- Parameters:
enableWriteThreadAdaptiveYield- true to enable adaptive yield for the write threads- Returns:
- the reference to the current options.
-
enableWriteThreadAdaptiveYield
public boolean enableWriteThreadAdaptiveYield()
Description copied from interface:DBOptionsInterfaceIf true, threads synchronizing with the write batch group leader will wait for up toDBOptionsInterface.writeThreadMaxYieldUsec()before blocking on a mutex. This can substantially improve throughput for concurrent workloads, regardless of whetherDBOptionsInterface.allowConcurrentMemtableWrite()is enabled. Default: true- Specified by:
enableWriteThreadAdaptiveYieldin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if adaptive yield is enabled for the writing threads
-
setWriteThreadMaxYieldUsec
public DBOptions setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec)
Description copied from interface:DBOptionsInterfaceThe 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. (AssumingDBOptionsInterface.writeThreadSlowYieldUsec()is set properly) increasing this value is likely to increase RocksDB throughput at the expense of increased CPU usage. Default: 100- Specified by:
setWriteThreadMaxYieldUsecin interfaceDBOptionsInterface<DBOptions>- Parameters:
writeThreadMaxYieldUsec- maximum number of microseconds- Returns:
- the reference to the current options.
-
writeThreadMaxYieldUsec
public long writeThreadMaxYieldUsec()
Description copied from interface:DBOptionsInterfaceThe 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. (AssumingDBOptionsInterface.writeThreadSlowYieldUsec()is set properly) increasing this value is likely to increase RocksDB throughput at the expense of increased CPU usage. Default: 100- Specified by:
writeThreadMaxYieldUsecin interfaceDBOptionsInterface<DBOptions>- Returns:
- the maximum number of microseconds
-
setWriteThreadSlowYieldUsec
public DBOptions setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec)
Description copied from interface:DBOptionsInterfaceThe 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. Increasing this makes writer threads more likely to take CPU by spinning, which will show up as an increase in the number of involuntary context switches. Default: 3- Specified by:
setWriteThreadSlowYieldUsecin interfaceDBOptionsInterface<DBOptions>- Parameters:
writeThreadSlowYieldUsec- the latency in microseconds- Returns:
- the reference to the current options.
-
writeThreadSlowYieldUsec
public long writeThreadSlowYieldUsec()
Description copied from interface:DBOptionsInterfaceThe 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. Increasing this makes writer threads more likely to take CPU by spinning, which will show up as an increase in the number of involuntary context switches. Default: 3- Specified by:
writeThreadSlowYieldUsecin interfaceDBOptionsInterface<DBOptions>- Returns:
- writeThreadSlowYieldUsec the latency in microseconds
-
setSkipStatsUpdateOnDbOpen
public DBOptions setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen)
Description copied from interface:DBOptionsInterfaceIf true, then DB::Open() will not update the statistics used to optimize compaction decision by loading table properties from many files. Turning off this feature will improve DBOpen time especially in disk environment. Default: false- Specified by:
setSkipStatsUpdateOnDbOpenin interfaceDBOptionsInterface<DBOptions>- Parameters:
skipStatsUpdateOnDbOpen- true if updating stats will be skipped- Returns:
- the reference to the current options.
-
skipStatsUpdateOnDbOpen
public boolean skipStatsUpdateOnDbOpen()
Description copied from interface:DBOptionsInterfaceIf true, then DB::Open() will not update the statistics used to optimize compaction decision by loading table properties from many files. Turning off this feature will improve DBOpen time especially in disk environment. Default: false- Specified by:
skipStatsUpdateOnDbOpenin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if updating stats will be skipped
-
setSkipCheckingSstFileSizesOnDbOpen
public DBOptions setSkipCheckingSstFileSizesOnDbOpen(boolean skipCheckingSstFileSizesOnDbOpen)
Description copied from interface:DBOptionsInterfaceIf true, thenRocksDB.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. Ifparanoid_checksis false, this option is ignored, and sst files are not checked at all. Default: false- Specified by:
setSkipCheckingSstFileSizesOnDbOpenin interfaceDBOptionsInterface<DBOptions>- Parameters:
skipCheckingSstFileSizesOnDbOpen- if true, then SST file sizes will not be checked when callingRocksDB.open(String).- Returns:
- the reference to the current options.
-
skipCheckingSstFileSizesOnDbOpen
public boolean skipCheckingSstFileSizesOnDbOpen()
Description copied from interface:DBOptionsInterfaceIf true, thenRocksDB.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. Ifparanoid_checksis false, this option is ignored, and sst files are not checked at all. Default: false- Specified by:
skipCheckingSstFileSizesOnDbOpenin interfaceDBOptionsInterface<DBOptions>- Returns:
- true, if file sizes will not be checked when calling
RocksDB.open(String).
-
setWalRecoveryMode
public DBOptions setWalRecoveryMode(WALRecoveryMode walRecoveryMode)
Description copied from interface:DBOptionsInterfaceRecovery mode to control the consistency while replaying WAL Default:WALRecoveryMode.PointInTimeRecovery- Specified by:
setWalRecoveryModein interfaceDBOptionsInterface<DBOptions>- Parameters:
walRecoveryMode- The WAL recover mode- Returns:
- the reference to the current options.
-
walRecoveryMode
public WALRecoveryMode walRecoveryMode()
Description copied from interface:DBOptionsInterfaceRecovery mode to control the consistency while replaying WAL Default:WALRecoveryMode.PointInTimeRecovery- Specified by:
walRecoveryModein interfaceDBOptionsInterface<DBOptions>- Returns:
- The WAL recover mode
-
setAllow2pc
public DBOptions setAllow2pc(boolean allow2pc)
Description copied from interface:DBOptionsInterfaceif set to false then recovery will fail when a prepared transaction is encountered in the WAL Default: false- Specified by:
setAllow2pcin interfaceDBOptionsInterface<DBOptions>- Parameters:
allow2pc- true if two-phase-commit is enabled- Returns:
- the reference to the current options.
-
allow2pc
public boolean allow2pc()
Description copied from interface:DBOptionsInterfaceif set to false then recovery will fail when a prepared transaction is encountered in the WAL Default: false- Specified by:
allow2pcin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if two-phase-commit is enabled
-
setRowCache
public DBOptions setRowCache(Cache rowCache)
Description copied from interface:DBOptionsInterfaceA global cache for table-level rows. Default: null (disabled)- Specified by:
setRowCachein interfaceDBOptionsInterface<DBOptions>- Parameters:
rowCache- The global row cache- Returns:
- the reference to the current options.
-
rowCache
public Cache rowCache()
Description copied from interface:DBOptionsInterfaceA global cache for table-level rows. Default: null (disabled)- Specified by:
rowCachein interfaceDBOptionsInterface<DBOptions>- Returns:
- The global row cache
-
setWalFilter
public DBOptions setWalFilter(AbstractWalFilter walFilter)
Description copied from interface:DBOptionsInterfaceA filter object supplied to be invoked while processing write-ahead-logs (WALs) during recovery. The filter provides a way to inspect log records, ignoring a particular record or skipping replay. The filter is invoked at startup and is invoked from a single-thread currently.- Specified by:
setWalFilterin interfaceDBOptionsInterface<DBOptions>- Parameters:
walFilter- the filter for processing WALs during recovery.- Returns:
- the reference to the current options.
-
walFilter
public WalFilter walFilter()
Description copied from interface:DBOptionsInterfaceGet's the filter for processing WALs during recovery. SeeDBOptionsInterface.setWalFilter(AbstractWalFilter).- Specified by:
walFilterin interfaceDBOptionsInterface<DBOptions>- Returns:
- the filter used for processing WALs during recovery.
-
setFailIfOptionsFileError
public DBOptions setFailIfOptionsFileError(boolean failIfOptionsFileError)
Description copied from interface:DBOptionsInterfaceIf true, then DB::Open / CreateColumnFamily / DropColumnFamily / SetOptions will fail if options file is not detected or properly persisted. DEFAULT: false- Specified by:
setFailIfOptionsFileErrorin interfaceDBOptionsInterface<DBOptions>- Parameters:
failIfOptionsFileError- true if we should fail if there is an error in the options file- Returns:
- the reference to the current options.
-
failIfOptionsFileError
public boolean failIfOptionsFileError()
Description copied from interface:DBOptionsInterfaceIf true, then DB::Open / CreateColumnFamily / DropColumnFamily / SetOptions will fail if options file is not detected or properly persisted. DEFAULT: false- Specified by:
failIfOptionsFileErrorin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if we should fail if there is an error in the options file
-
setDumpMallocStats
public DBOptions setDumpMallocStats(boolean dumpMallocStats)
Description copied from interface:DBOptionsInterfaceIf true, then print malloc stats together with rocksdb.stats when printing to LOG. DEFAULT: false- Specified by:
setDumpMallocStatsin interfaceDBOptionsInterface<DBOptions>- Parameters:
dumpMallocStats- true if malloc stats should be printed to LOG- Returns:
- the reference to the current options.
-
dumpMallocStats
public boolean dumpMallocStats()
Description copied from interface:DBOptionsInterfaceIf true, then print malloc stats together with rocksdb.stats when printing to LOG. DEFAULT: false- Specified by:
dumpMallocStatsin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if malloc stats should be printed to LOG
-
setAvoidFlushDuringRecovery
public DBOptions setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery)
Description copied from interface:DBOptionsInterfaceBy default RocksDB replay WAL logs and flush them on DB open, which may create very small SST files. If this option is enabled, RocksDB will try to avoid (but not guarantee not to) flush during recovery. Also, existing WAL logs will be kept, so that if crash happened before flush, we still have logs to recover from. DEFAULT: false- Specified by:
setAvoidFlushDuringRecoveryin interfaceDBOptionsInterface<DBOptions>- Parameters:
avoidFlushDuringRecovery- true to try to avoid (but not guarantee not to) flush during recovery- Returns:
- the reference to the current options.
-
avoidFlushDuringRecovery
public boolean avoidFlushDuringRecovery()
Description copied from interface:DBOptionsInterfaceBy default RocksDB replay WAL logs and flush them on DB open, which may create very small SST files. If this option is enabled, RocksDB will try to avoid (but not guarantee not to) flush during recovery. Also, existing WAL logs will be kept, so that if crash happened before flush, we still have logs to recover from. DEFAULT: false- Specified by:
avoidFlushDuringRecoveryin interfaceDBOptionsInterface<DBOptions>- Returns:
- true to try to avoid (but not guarantee not to) flush during recovery
-
setAvoidFlushDuringShutdown
public DBOptions setAvoidFlushDuringShutdown(boolean avoidFlushDuringShutdown)
Description copied from interface:MutableDBOptionsInterfaceBy 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. Unpersisted data WILL BE LOST. DEFAULT: false Dynamically changeable throughRocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)API.- Specified by:
setAvoidFlushDuringShutdownin interfaceMutableDBOptionsInterface<DBOptions>- Parameters:
avoidFlushDuringShutdown- true if we should avoid flush during shutdown- Returns:
- the reference to the current options.
-
avoidFlushDuringShutdown
public boolean avoidFlushDuringShutdown()
Description copied from interface:MutableDBOptionsInterfaceBy 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. Unpersisted data WILL BE LOST. DEFAULT: false Dynamically changeable throughRocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions)API.- Specified by:
avoidFlushDuringShutdownin interfaceMutableDBOptionsInterface<DBOptions>- Returns:
- true if we should avoid flush during shutdown
-
setAllowIngestBehind
public DBOptions setAllowIngestBehind(boolean allowIngestBehind)
Description copied from interface:DBOptionsInterfaceSet 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). Setting this option to true will affect 2 things: 1) Disable some internal optimizations around SST file compression 2) Reserve bottom-most level for ingested files only. 3) Note that num_levels should be >= 3 if this option is turned on. DEFAULT: false- Specified by:
setAllowIngestBehindin interfaceDBOptionsInterface<DBOptions>- Parameters:
allowIngestBehind- true to allow ingest behind, false to disallow.- Returns:
- the reference to the current options.
-
allowIngestBehind
public boolean allowIngestBehind()
Description copied from interface:DBOptionsInterfaceReturns true if ingest behind is allowed. SeeDBOptionsInterface.setAllowIngestBehind(boolean).- Specified by:
allowIngestBehindin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if ingest behind is allowed, false otherwise.
-
setPreserveDeletes
public DBOptions setPreserveDeletes(boolean preserveDeletes)
Description copied from interface:DBOptionsInterfaceNeeded to support differential snapshots. If set to true then DB will only process deletes with sequence number less than what was set by SetPreserveDeletesSequenceNumber(uint64_t ts). Clients are responsible to periodically call this method to advance the cutoff time. If this method is never called and preserve_deletes is set to true NO deletes will ever be processed. At the moment this only keeps normal deletes, SingleDeletes will not be preserved. DEFAULT: false- Specified by:
setPreserveDeletesin interfaceDBOptionsInterface<DBOptions>- Parameters:
preserveDeletes- true to preserve deletes.- Returns:
- the reference to the current options.
-
preserveDeletes
public boolean preserveDeletes()
Description copied from interface:DBOptionsInterfaceReturns true if deletes are preserved. SeeDBOptionsInterface.setPreserveDeletes(boolean).- Specified by:
preserveDeletesin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if deletes are preserved, false otherwise.
-
setTwoWriteQueues
public DBOptions setTwoWriteQueues(boolean twoWriteQueues)
Description copied from interface:DBOptionsInterfaceIf enabled it uses two queues for writes, one for the ones with disable_memtable and one for the ones that also write to memtable. This allows the memtable writes not to lag behind other writes. It can be used to optimize MySQL 2PC in which only the commits, which are serial, write to memtable. DEFAULT: false- Specified by:
setTwoWriteQueuesin interfaceDBOptionsInterface<DBOptions>- Parameters:
twoWriteQueues- true to enable two write queues, false otherwise.- Returns:
- the reference to the current options.
-
twoWriteQueues
public boolean twoWriteQueues()
Description copied from interface:DBOptionsInterfaceReturns true if two write queues are enabled.- Specified by:
twoWriteQueuesin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if two write queues are enabled, false otherwise.
-
setManualWalFlush
public DBOptions setManualWalFlush(boolean manualWalFlush)
Description copied from interface:DBOptionsInterfaceIf true WAL is not flushed automatically after each write. Instead it relies on manual invocation of FlushWAL to write the WAL buffer to its file. DEFAULT: false- Specified by:
setManualWalFlushin interfaceDBOptionsInterface<DBOptions>- Parameters:
manualWalFlush- true to set disable automatic WAL flushing, false otherwise.- Returns:
- the reference to the current options.
-
manualWalFlush
public boolean manualWalFlush()
Description copied from interface:DBOptionsInterfaceReturns true if automatic WAL flushing is disabled. SeeDBOptionsInterface.setManualWalFlush(boolean).- Specified by:
manualWalFlushin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if automatic WAL flushing is disabled, false otherwise.
-
setAtomicFlush
public DBOptions setAtomicFlush(boolean atomicFlush)
Description copied from interface:DBOptionsInterfaceIf true, RocksDB supports flushing multiple column families and committing their results atomically to MANIFEST. Note that it is not necessary to set atomic_flush to true if WAL is always enabled since WAL allows the database to be restored to the last persistent state in WAL. This option is useful when there are column families with writes NOT protected by WAL. For manual flush, application has to specify which column families to flush atomically inRocksDB.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.- Specified by:
setAtomicFlushin interfaceDBOptionsInterface<DBOptions>- Parameters:
atomicFlush- true to enable atomic flush of multiple column families.- Returns:
- the reference to the current options.
-
atomicFlush
public boolean atomicFlush()
Description copied from interface:DBOptionsInterfaceDetermine if atomic flush of multiple column families is enabled. SeeDBOptionsInterface.setAtomicFlush(boolean).- Specified by:
atomicFlushin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if atomic flush is enabled.
-
setAvoidUnnecessaryBlockingIO
public DBOptions setAvoidUnnecessaryBlockingIO(boolean avoidUnnecessaryBlockingIO)
Description copied from interface:DBOptionsInterfaceIf 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. Use it if you're latency-sensitive. If set to true, takes precedence overReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean).- Specified by:
setAvoidUnnecessaryBlockingIOin interfaceDBOptionsInterface<DBOptions>- Parameters:
avoidUnnecessaryBlockingIO- If true, working thread may avoid doing unnecessary operation.- Returns:
- the reference to the current options.
-
avoidUnnecessaryBlockingIO
public boolean avoidUnnecessaryBlockingIO()
Description copied from interface:DBOptionsInterfaceIf 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. Use it if you're latency-sensitive. If set to true, takes precedence overReadOptions.setBackgroundPurgeOnIteratorCleanup(boolean).- Specified by:
avoidUnnecessaryBlockingIOin interfaceDBOptionsInterface<DBOptions>- Returns:
- true, if working thread may avoid doing unnecessary operation.
-
setPersistStatsToDisk
public DBOptions setPersistStatsToDisk(boolean persistStatsToDisk)
Description copied from interface:DBOptionsInterfaceIf 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. User can query through `GetStatsHistory` API. If user attempts to create a column family with the same name on a DB which have previously set persist_stats_to_disk to true, the column family creation will fail, but the hidden column family will survive, as well as the previously persisted statistics. When peristing stats to disk, the stat name will be limited at 100 bytes. Default: false- Specified by:
setPersistStatsToDiskin interfaceDBOptionsInterface<DBOptions>- Parameters:
persistStatsToDisk- true if stats should be persisted to hidden column family.- Returns:
- the instance of the current object.
-
persistStatsToDisk
public boolean persistStatsToDisk()
Description copied from interface:DBOptionsInterfaceIf 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. User can query through `GetStatsHistory` API. If user attempts to create a column family with the same name on a DB which have previously set persist_stats_to_disk to true, the column family creation will fail, but the hidden column family will survive, as well as the previously persisted statistics. When peristing stats to disk, the stat name will be limited at 100 bytes. Default: false- Specified by:
persistStatsToDiskin interfaceDBOptionsInterface<DBOptions>- Returns:
- true if stats should be persisted to hidden column family.
-
setWriteDbidToManifest
public DBOptions setWriteDbidToManifest(boolean writeDbidToManifest)
Description copied from interface:DBOptionsInterfaceHistorically DB ID has always been stored in Identity File in DB folder. If this flag is true, the DB ID is written to Manifest file in addition to the Identity file. By doing this 2 problems are solved 1. We don't checksum the Identity file where as Manifest file is. 2. Since the source of truth for DB is Manifest file DB ID will sit with the source of truth. Previously the Identity file could be copied independent of Manifest and that can result in wrong DB ID. We recommend setting this flag to true. Default: false- Specified by:
setWriteDbidToManifestin interfaceDBOptionsInterface<DBOptions>- Parameters:
writeDbidToManifest- if true, then DB ID will be written to Manifest file.- Returns:
- the instance of the current object.
-
writeDbidToManifest
public boolean writeDbidToManifest()
Description copied from interface:DBOptionsInterfaceHistorically DB ID has always been stored in Identity File in DB folder. If this flag is true, the DB ID is written to Manifest file in addition to the Identity file. By doing this 2 problems are solved 1. We don't checksum the Identity file where as Manifest file is. 2. Since the source of truth for DB is Manifest file DB ID will sit with the source of truth. Previously the Identity file could be copied independent of Manifest and that can result in wrong DB ID. We recommend setting this flag to true. Default: false- Specified by:
writeDbidToManifestin interfaceDBOptionsInterface<DBOptions>- Returns:
- true, if DB ID will be written to Manifest file.
-
setLogReadaheadSize
public DBOptions setLogReadaheadSize(long logReadaheadSize)
Description copied from interface:DBOptionsInterfaceThe number of bytes to prefetch when reading the log. This is mostly useful for reading a remotely located log, as it can save the number of round-trips. If 0, then the prefetching is disabled. Default: 0- Specified by:
setLogReadaheadSizein interfaceDBOptionsInterface<DBOptions>- Parameters:
logReadaheadSize- the number of bytes to prefetch when reading the log.- Returns:
- the instance of the current object.
-
logReadaheadSize
public long logReadaheadSize()
Description copied from interface:DBOptionsInterfaceThe number of bytes to prefetch when reading the log. This is mostly useful for reading a remotely located log, as it can save the number of round-trips. If 0, then the prefetching is disabled. Default: 0- Specified by:
logReadaheadSizein interfaceDBOptionsInterface<DBOptions>- Returns:
- the number of bytes to prefetch when reading the log.
-
setBestEffortsRecovery
public DBOptions setBestEffortsRecovery(boolean bestEffortsRecovery)
Description copied from interface:DBOptionsInterfaceBy default, RocksDB recovery fails if any table file referenced in MANIFEST are missing after scanning the MANIFEST. Best-efforts recovery is another recovery mode that tries to restore the database to the most recent point in time without missing file. Currently not compatible with atomic flush. Furthermore, WAL files will not be used for recovery if best_efforts_recovery is true. Default: false- Specified by:
setBestEffortsRecoveryin interfaceDBOptionsInterface<DBOptions>- Parameters:
bestEffortsRecovery- if true, RocksDB will use best-efforts mode when recovering.- Returns:
- the instance of the current object.
-
bestEffortsRecovery
public boolean bestEffortsRecovery()
Description copied from interface:DBOptionsInterfaceBy default, RocksDB recovery fails if any table file referenced in MANIFEST are missing after scanning the MANIFEST. Best-efforts recovery is another recovery mode that tries to restore the database to the most recent point in time without missing file. Currently not compatible with atomic flush. Furthermore, WAL files will not be used for recovery if best_efforts_recovery is true. Default: false- Specified by:
bestEffortsRecoveryin interfaceDBOptionsInterface<DBOptions>- Returns:
- true, if RocksDB uses best-efforts mode when recovering.
-
setMaxBgErrorResumeCount
public DBOptions setMaxBgErrorResumeCount(int maxBgerrorResumeCount)
Description copied from interface:DBOptionsInterfaceIt defines how many times db resume is called by a separate thread when background retryable IO Error happens. When background retryable IO Error happens, SetBGError is called to deal with the error. If the error can be auto-recovered (e.g., retryable IO Error during Flush or WAL write), then db resume is called in background to recover from the error. If this value is 0 or negative, db resume will not be called. Default: INT_MAX- Specified by:
setMaxBgErrorResumeCountin interfaceDBOptionsInterface<DBOptions>- Parameters:
maxBgerrorResumeCount- maximum number of times db resume should be called when IO Error happens.- Returns:
- the instance of the current object.
-
maxBgerrorResumeCount
public int maxBgerrorResumeCount()
Description copied from interface:DBOptionsInterfaceIt defines how many times db resume is called by a separate thread when background retryable IO Error happens. When background retryable IO Error happens, SetBGError is called to deal with the error. If the error can be auto-recovered (e.g., retryable IO Error during Flush or WAL write), then db resume is called in background to recover from the error. If this value is 0 or negative, db resume will not be called. Default: INT_MAX- Specified by:
maxBgerrorResumeCountin interfaceDBOptionsInterface<DBOptions>- Returns:
- maximum number of times db resume should be called when IO Error happens.
-
setBgerrorResumeRetryInterval
public DBOptions setBgerrorResumeRetryInterval(long bgerrorResumeRetryInterval)
Description copied from interface:DBOptionsInterfaceIf max_bgerror_resume_count is ≥ 2, db resume is called multiple times. This option decides how long to wait to retry the next resume if the previous resume fails and satisfy redo resume conditions. Default: 1000000 (microseconds).- Specified by:
setBgerrorResumeRetryIntervalin interfaceDBOptionsInterface<DBOptions>- Parameters:
bgerrorResumeRetryInterval- how many microseconds to wait between DB resume attempts.- Returns:
- the instance of the current object.
-
bgerrorResumeRetryInterval
public long bgerrorResumeRetryInterval()
Description copied from interface:DBOptionsInterfaceIf max_bgerror_resume_count is ≥ 2, db resume is called multiple times. This option decides how long to wait to retry the next resume if the previous resume fails and satisfy redo resume conditions. Default: 1000000 (microseconds).- Specified by:
bgerrorResumeRetryIntervalin interfaceDBOptionsInterface<DBOptions>- Returns:
- the instance of the current object.
-
disposeInternal
protected final void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-