Class CompactionOptionsUniversal
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOption to optimize the universal multi level compaction by enabling trivial move for non overlapping files.intIf this option is set to be -1 (the default value), all the output files will follow compression type specified.protected final voiddisposeInternal(long handle) intThe maximum number of files in a single compaction run.intThe size amplification is defined as the amount (in percentage) of additional storage needed to store a single byte of data in the database.intThe minimum number of files in a single compaction run.setAllowTrivialMove(boolean allowTrivialMove) Option to optimize the universal multi level compaction by enabling trivial move for non overlapping files.setCompressionSizePercent(int compressionSizePercent) If this option is set to be -1 (the default value), all the output files will follow compression type specified.setMaxMergeWidth(int maxMergeWidth) The maximum number of files in a single compaction run.setMaxSizeAmplificationPercent(int maxSizeAmplificationPercent) The size amplification is defined as the amount (in percentage) of additional storage needed to store a single byte of data in the database.setMinMergeWidth(int minMergeWidth) The minimum number of files in a single compaction run.setSizeRatio(int sizeRatio) Percentage flexibility while comparing file size.setStopStyle(CompactionStopStyle compactionStopStyle) The algorithm used to stop picking files into a single compaction runintPercentage flexibility while comparing file size.The algorithm used to stop picking files into a single compaction runMethods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Constructor Details
-
CompactionOptionsUniversal
public CompactionOptionsUniversal()
-
-
Method Details
-
setSizeRatio
Percentage flexibility while comparing file size. If the candidate file(s) size is 1% smaller than the next file's size, then include next file into this candidate set.Default: 1
- Parameters:
sizeRatio- The size ratio to use- Returns:
- the reference to the current options.
-
sizeRatio
public int sizeRatio()Percentage flexibility while comparing file size. If the candidate file(s) size is 1% smaller than the next file's size, then include next file into this candidate set.Default: 1
- Returns:
- The size ratio in use
-
setMinMergeWidth
The minimum number of files in a single compaction run.Default: 2
- Parameters:
minMergeWidth- minimum number of files in a single compaction run- Returns:
- the reference to the current options.
-
minMergeWidth
public int minMergeWidth()The minimum number of files in a single compaction run.Default: 2
- Returns:
- minimum number of files in a single compaction run
-
setMaxMergeWidth
The maximum number of files in a single compaction run.Default:
Long.MAX_VALUE- Parameters:
maxMergeWidth- maximum number of files in a single compaction run- Returns:
- the reference to the current options.
-
maxMergeWidth
public int maxMergeWidth()The maximum number of files in a single compaction run.Default:
Long.MAX_VALUE- Returns:
- maximum number of files in a single compaction run
-
setMaxSizeAmplificationPercent
The size amplification is defined as the amount (in percentage) of additional storage needed to store a single byte of data in the database. For example, a size amplification of 2% means that a database that contains 100 bytes of user-data may occupy upto 102 bytes of physical storage. By this definition, a fully compacted database has a size amplification of 0%. Rocksdb uses the following heuristic to calculate size amplification: it assumes that all files excluding the earliest file contribute to the size amplification.Default: 200, which means that a 100 byte database could require upto 300 bytes of storage.
- Parameters:
maxSizeAmplificationPercent- the amount of additional storage needed (as a percentage) to store a single byte in the database- Returns:
- the reference to the current options.
-
maxSizeAmplificationPercent
public int maxSizeAmplificationPercent()The size amplification is defined as the amount (in percentage) of additional storage needed to store a single byte of data in the database. For example, a size amplification of 2% means that a database that contains 100 bytes of user-data may occupy upto 102 bytes of physical storage. By this definition, a fully compacted database has a size amplification of 0%. Rocksdb uses the following heuristic to calculate size amplification: it assumes that all files excluding the earliest file contribute to the size amplification.Default: 200, which means that a 100 byte database could require upto 300 bytes of storage.
- Returns:
- the amount of additional storage needed (as a percentage) to store a single byte in the database
-
setCompressionSizePercent
If this option is set to be -1 (the default value), all the output files will follow compression type specified.If this option is not negative, we will try to make sure compressed size is just above this value. In normal cases, at least this percentage of data will be compressed.
When we are compacting to a new file, here is the criteria whether it needs to be compressed: assuming here are the list of files sorted by generation time: A1...An B1...Bm C1...Ct where A1 is the newest and Ct is the oldest, and we are going to compact B1...Bm, we calculate the total size of all the files as total_size, as well as the total size of C1...Ct as total_C, the compaction output file will be compressed iff total_C / total_size < this percentage
Default: -1
- Parameters:
compressionSizePercent- percentage of size for compression- Returns:
- the reference to the current options.
-
compressionSizePercent
public int compressionSizePercent()If this option is set to be -1 (the default value), all the output files will follow compression type specified.If this option is not negative, we will try to make sure compressed size is just above this value. In normal cases, at least this percentage of data will be compressed.
When we are compacting to a new file, here is the criteria whether it needs to be compressed: assuming here are the list of files sorted by generation time: A1...An B1...Bm C1...Ct where A1 is the newest and Ct is the oldest, and we are going to compact B1...Bm, we calculate the total size of all the files as total_size, as well as the total size of C1...Ct as total_C, the compaction output file will be compressed iff total_C / total_size < this percentage
Default: -1
- Returns:
- percentage of size for compression
-
setStopStyle
The algorithm used to stop picking files into a single compaction run- Parameters:
compactionStopStyle- The compaction algorithm- Returns:
- the reference to the current options.
-
stopStyle
The algorithm used to stop picking files into a single compaction run- Returns:
- The compaction algorithm
-
setAllowTrivialMove
Option to optimize the universal multi level compaction by enabling trivial move for non overlapping files.Default: false
- Parameters:
allowTrivialMove- true if trivial move is allowed- Returns:
- the reference to the current options.
-
allowTrivialMove
public boolean allowTrivialMove()Option to optimize the universal multi level compaction by enabling trivial move for non overlapping files.Default: false
- Returns:
- true if trivial move is allowed
-
disposeInternal
protected final void disposeInternal(long handle) - Specified by:
disposeInternalin classRocksObject
-