Package org.rocksdb
Class EnvOptions
- All Implemented Interfaces:
AutoCloseable
Options while opening a file to read/write
-
Field Summary
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_ -
Constructor Summary
ConstructorsConstructorDescriptionConstruct with default OptionsEnvOptions(DBOptions dbOptions) Construct fromDBOptions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if fallocate calls are used.longGet the number of incremental bytes per sync written in the background.longprotected final voiddisposeInternal(long handle) booleanDetermine if file is preallocated.longGet the write rate limiter for flush and compaction.setAllowFallocate(boolean allowFallocate) Enable/Disable fallocate calls.setBytesPerSync(long bytesPerSync) Allows OS to incrementally sync files to disk while they are being written, in the background.setCompactionReadaheadSize(long compactionReadaheadSize) setFallocateWithKeepSize(boolean fallocateWithKeepSize) If true, we will preallocate the file withFALLOC_FL_KEEP_SIZEflag, which means that file size won't change as part of preallocation.booleanDetermine i ftheFD_CLOEXECbit is set when opening file descriptors.setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize) setRateLimiter(RateLimiter rateLimiter) Set the write rate limiter for flush and compaction.setSetFdCloexec(boolean setFdCloexec) Enable/Disable theFD_CLOEXECbit when opening file descriptors.setUseDirectReads(boolean useDirectReads) Enable/Disable direct reads, i.e.setUseDirectWrites(boolean useDirectWrites) Enable/Disable direct writes, i.e.setUseMmapReads(boolean useMmapReads) Enable/Disable memory mapped reads.setUseMmapWrites(boolean useMmapWrites) Enable/Disable memory mapped Writes.setWritableFileMaxBufferSize(long writableFileMaxBufferSize) booleanDetermine if direct reads are in-use.booleanDetermine if direct writes are in-use.booleanDetermine if memory mapped reads are in-use.booleanDetermine if memory mapped writes are in-use.longMethods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Constructor Details
-
EnvOptions
public EnvOptions()Construct with default Options -
EnvOptions
Construct fromDBOptions.- Parameters:
dbOptions- the database options.
-
-
Method Details
-
setUseMmapReads
Enable/Disable memory mapped reads.Default: false
- Parameters:
useMmapReads- true to enable memory mapped reads, false to disable.- Returns:
- the reference to these options.
-
useMmapReads
public boolean useMmapReads()Determine if memory mapped reads are in-use.- Returns:
- true if memory mapped reads are in-use, false otherwise.
-
setUseMmapWrites
Enable/Disable memory mapped Writes.Default: true
- Parameters:
useMmapWrites- true to enable memory mapped writes, false to disable.- Returns:
- the reference to these options.
-
useMmapWrites
public boolean useMmapWrites()Determine if memory mapped writes are in-use.- Returns:
- true if memory mapped writes are in-use, false otherwise.
-
setUseDirectReads
Enable/Disable direct reads, i.e.O_DIRECT.Default: false
- Parameters:
useDirectReads- true to enable direct reads, false to disable.- Returns:
- the reference to these options.
-
useDirectReads
public boolean useDirectReads()Determine if direct reads are in-use.- Returns:
- true if direct reads are in-use, false otherwise.
-
setUseDirectWrites
Enable/Disable direct writes, i.e.O_DIRECT.Default: false
- Parameters:
useDirectWrites- true to enable direct writes, false to disable.- Returns:
- the reference to these options.
-
useDirectWrites
public boolean useDirectWrites()Determine if direct writes are in-use.- Returns:
- true if direct writes are in-use, false otherwise.
-
setAllowFallocate
Enable/Disable fallocate calls.Default: true
If false,
fallocate()calls are bypassed.- Parameters:
allowFallocate- true to enable fallocate calls, false to disable.- Returns:
- the reference to these options.
-
allowFallocate
public boolean allowFallocate()Determine if fallocate calls are used.- Returns:
- true if fallocate calls are used, false otherwise.
-
setSetFdCloexec
Enable/Disable theFD_CLOEXECbit when opening file descriptors.Default: true
- Parameters:
setFdCloexec- true to enable theFB_CLOEXECbit, false to disable.- Returns:
- the reference to these options.
-
setFdCloexec
public boolean setFdCloexec()Determine i ftheFD_CLOEXECbit is set when opening file descriptors.- Returns:
- true if the
FB_CLOEXECbit is enabled, false otherwise.
-
setBytesPerSync
Allows OS to incrementally sync files to disk while they are being written, in the background. Issue one request for everybytesPerSyncwritten.Default: 0
- Parameters:
bytesPerSync- 0 to disable, otherwise the number of bytes.- Returns:
- the reference to these options.
-
bytesPerSync
public long bytesPerSync()Get the number of incremental bytes per sync written in the background.- Returns:
- 0 if disabled, otherwise the number of bytes.
-
setFallocateWithKeepSize
If true, we will preallocate the file withFALLOC_FL_KEEP_SIZEflag, which means that file size won't change as part of preallocation. If false, preallocation will also change the file size. This option will improve the performance in workloads where you sync the data on every write. By default, we set it to true for MANIFEST writes and false for WAL writes- Parameters:
fallocateWithKeepSize- true to preallocate, false otherwise.- Returns:
- the reference to these options.
-
fallocateWithKeepSize
public boolean fallocateWithKeepSize()Determine if file is preallocated.- Returns:
- true if the file is preallocated, false otherwise.
-
setCompactionReadaheadSize
- Parameters:
compactionReadaheadSize- the compaction read-ahead size.- Returns:
- the reference to these options.
-
compactionReadaheadSize
public long compactionReadaheadSize()- Returns:
- the compaction read-ahead size.
-
setRandomAccessMaxBufferSize
- Parameters:
randomAccessMaxBufferSize- the max buffer size for random access.- Returns:
- the reference to these options.
-
randomAccessMaxBufferSize
public long randomAccessMaxBufferSize()- Returns:
- the max buffer size for random access.
-
setWritableFileMaxBufferSize
- Parameters:
writableFileMaxBufferSize- the max buffer size.- Returns:
- the reference to these options.
-
writableFileMaxBufferSize
public long writableFileMaxBufferSize()- Returns:
- the max buffer size.
-
setRateLimiter
Set the write rate limiter for flush and compaction.- Parameters:
rateLimiter- the rate limiter.- Returns:
- the reference to these options.
-
rateLimiter
Get the write rate limiter for flush and compaction.- Returns:
- the rate limiter.
-
disposeInternal
protected final void disposeInternal(long handle) - Specified by:
disposeInternalin classRocksObject
-