Class ColumnFamilyOptions
- java.lang.Object
-
- org.rocksdb.AbstractNativeReference
-
- org.rocksdb.AbstractImmutableNativeReference
-
- org.rocksdb.RocksObject
-
- org.rocksdb.ColumnFamilyOptions
-
- All Implemented Interfaces:
java.lang.AutoCloseable,AdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>,AdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>,ColumnFamilyOptionsInterface<ColumnFamilyOptions>,MutableColumnFamilyOptionsInterface<ColumnFamilyOptions>
public class ColumnFamilyOptions extends RocksObject implements ColumnFamilyOptionsInterface<ColumnFamilyOptions>, MutableColumnFamilyOptionsInterface<ColumnFamilyOptions>
ColumnFamilyOptions 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_
-
Fields inherited from interface org.rocksdb.ColumnFamilyOptionsInterface
DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET
-
-
Constructor Summary
Constructors Constructor Description ColumnFamilyOptions()Construct ColumnFamilyOptions.ColumnFamilyOptions(ColumnFamilyOptions other)Copy constructor for ColumnFamilyOptions.ColumnFamilyOptions(Options options)Constructor from Options
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longarenaBlockSize()The size of one block in arena memory allocation.intbloomLocality()Control locality of bloom filter probes to improve cache miss rate.CompressionOptionsbottommostCompressionOptions()Get the bottom most compression options.CompressionTypebottommostCompressionType()Compression algorithm that will be used for the bottommost level that contain files.java.util.List<DbPath>cfPaths()AbstractCompactionFilter<? extends AbstractSlice<?>>compactionFilter()Accessor for the CompactionFilter instance in use.AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>>compactionFilterFactory()Accessor for the CompactionFilterFactory instance in use.CompactionOptionsFIFOcompactionOptionsFIFO()The options for FIFO compaction styleCompactionOptionsUniversalcompactionOptionsUniversal()The options needed to support Universal Style compactionsCompactionPrioritycompactionPriority()Get the Compaction priority if level compaction is used for all levelsCompactionStylecompactionStyle()Compaction style for DB.ConcurrentTaskLimitercompactionThreadLimiter()Get compaction thread limiterCompressionOptionscompressionOptions()Get the different options for compression algorithmsjava.util.List<CompressionType>compressionPerLevel()Return the currently setCompressionTypeper instances.CompressionTypecompressionType()Compress blocks using the specified compression algorithm.booleandisableAutoCompactions()Disable automatic compactions.protected voiddisposeInternal(long handle)booleanforceConsistencyChecks()In debug mode, RocksDB run consistency checks on the LSM every time the LSM change (Flush, Compaction, AddFile).static ColumnFamilyOptionsgetColumnFamilyOptionsFromProps(java.util.Properties properties)Method to get a options instance by using pre-configured property values.static ColumnFamilyOptionsgetColumnFamilyOptionsFromProps(ConfigOptions cfgOpts, java.util.Properties properties)Method to get a options instance by using pre-configured property values.longhardPendingCompactionBytesLimit()All writes are stopped if estimated bytes needed to be compaction exceed this threshold.longinplaceUpdateNumLocks()Number of locks used for inplace update Default: 10000, if inplace_update_support = true, else 0.booleaninplaceUpdateSupport()Allows thread-safe inplace updates.intlevel0FileNumCompactionTrigger()Number of files to trigger level-0 compaction.intlevel0SlowdownWritesTrigger()Soft limit on number of level-0 files.intlevel0StopWritesTrigger()Maximum number of level-0 files.booleanlevelCompactionDynamicLevelBytes()Return ifLevelCompactionDynamicLevelBytesis enabled.intlevelZeroFileNumCompactionTrigger()The number of files in level 0 to trigger compaction from level-0 to level-1.intlevelZeroSlowdownWritesTrigger()Soft limit on the number of level-0 files.intlevelZeroStopWritesTrigger()Maximum number of level-0 files.longmaxBytesForLevelBase()The upper-bound of the total size of level-1 files in bytes.doublemaxBytesForLevelMultiplier()The ratio between the total size of level-(L+1) files and the total size of level-L files for all L.int[]maxBytesForLevelMultiplierAdditional()Different max-size multipliers for different levels.longmaxCompactionBytes()Control maximum size of each compaction (not guaranteed)longmaxSequentialSkipInIterations()An iteration->Next() sequentially skips over keys with the same user-key unless this option is set.longmaxSuccessiveMerges()Maximum number of successive merge operations on a key in the memtable.longmaxTableFilesSizeFIFO()FIFO compaction option.intmaxWriteBufferNumber()Returns maximum number of write buffers.intmaxWriteBufferNumberToMaintain()The total maximum number of write buffers to maintain in memory including copies of buffers that have already been flushed.MemTableConfigmemTableConfig()Get the config for mem-table.java.lang.StringmemTableFactoryName()Returns the name of the current mem table representation.longmemtableHugePageSize()Page size for huge page TLB for bloom in memtable.doublememtablePrefixBloomSizeRatio()if prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0, create prefix bloom for memtable with the size of write_buffer_size * memtable_prefix_bloom_size_ratio.intminWriteBufferNumberToMerge()The minimum number of write buffers that will be merged together before writing to storage.intnumLevels()If level-styled compaction is used, then this number determines the total number of levels.ColumnFamilyOptionsoldDefaults(int majorVersion, int minorVersion)The function recovers options to a previous version.booleanoptimizeFiltersForHits()Returns the current state of theoptimize_filters_for_hitssetting.ColumnFamilyOptionsoptimizeForPointLookup(long blockCacheSizeMb)Use this if you don't need to keep the data sorted, i.e.ColumnFamilyOptionsoptimizeForSmallDb()Use this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables.ColumnFamilyOptionsoptimizeForSmallDb(Cache cache)Some functions that make it easier to optimize RocksDB Use this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables.ColumnFamilyOptionsoptimizeLevelStyleCompaction()Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions.ColumnFamilyOptionsoptimizeLevelStyleCompaction(long memtableMemoryBudget)Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions.ColumnFamilyOptionsoptimizeUniversalStyleCompaction()Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions.ColumnFamilyOptionsoptimizeUniversalStyleCompaction(long memtableMemoryBudget)Default values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions.booleanparanoidFileChecks()After writing every SST file, reopen it and read all the keys.booleanreportBgIoStats()Determine whether IO stats in compactions and flushes are being measuredColumnFamilyOptionssetArenaBlockSize(long arenaBlockSize)The size of one block in arena memory allocation.ColumnFamilyOptionssetBloomLocality(int bloomLocality)Control locality of bloom filter probes to improve cache miss rate.ColumnFamilyOptionssetBottommostCompressionOptions(CompressionOptions bottommostCompressionOptions)Set the options for compression algorithms used byColumnFamilyOptionsInterface.bottommostCompressionType()if it is enabled.ColumnFamilyOptionssetBottommostCompressionType(CompressionType bottommostCompressionType)Compression algorithm that will be used for the bottommost level that contain files.ColumnFamilyOptionssetCfPaths(java.util.Collection<DbPath> cfPaths)A list of paths where SST files for this column family can be put into, with its target size.ColumnFamilyOptionssetCompactionFilter(AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter)A single CompactionFilter instance to call into during compaction.ColumnFamilyOptionssetCompactionFilterFactory(AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory)This is a factory that providesAbstractCompactionFilterobjects which allow an application to modify/delete a key-value during background compaction.ColumnFamilyOptionssetCompactionOptionsFIFO(CompactionOptionsFIFO compactionOptionsFIFO)The options for FIFO compaction styleColumnFamilyOptionssetCompactionOptionsUniversal(CompactionOptionsUniversal compactionOptionsUniversal)Set the options needed to support Universal Style compactionsColumnFamilyOptionssetCompactionPriority(CompactionPriority compactionPriority)If levelAdvancedColumnFamilyOptionsInterface.compactionStyle()==CompactionStyle.LEVEL, for each level, which files are prioritized to be picked to compact.ColumnFamilyOptionssetCompactionStyle(CompactionStyle compactionStyle)Set compaction style for DB.ColumnFamilyOptionssetCompactionThreadLimiter(ConcurrentTaskLimiter compactionThreadLimiter)Compaction concurrent thread limiter for the column family.ColumnFamilyOptionssetComparator(AbstractComparator comparator)Use the specified comparator for key ordering.ColumnFamilyOptionssetComparator(BuiltinComparator builtinComparator)SetBuiltinComparatorto be used with RocksDB.ColumnFamilyOptionssetCompressionOptions(CompressionOptions compressionOptions)Set the different options for compression algorithmsColumnFamilyOptionssetCompressionPerLevel(java.util.List<CompressionType> compressionLevels)Different levels can have different compression policies.ColumnFamilyOptionssetCompressionType(CompressionType compressionType)Compress blocks using the specified compression algorithm.ColumnFamilyOptionssetDisableAutoCompactions(boolean disableAutoCompactions)Disable automatic compactions.ColumnFamilyOptionssetForceConsistencyChecks(boolean forceConsistencyChecks)In debug mode, RocksDB run consistency checks on the LSM every time the LSM change (Flush, Compaction, AddFile).ColumnFamilyOptionssetHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)All writes are stopped if estimated bytes needed to be compaction exceed this threshold.ColumnFamilyOptionssetInplaceUpdateNumLocks(long inplaceUpdateNumLocks)Number of locks used for inplace update Default: 10000, if inplace_update_support = true, else 0.ColumnFamilyOptionssetInplaceUpdateSupport(boolean inplaceUpdateSupport)Allows thread-safe inplace updates.ColumnFamilyOptionssetLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger)Number of files to trigger level-0 compaction.ColumnFamilyOptionssetLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger)Soft limit on number of level-0 files.ColumnFamilyOptionssetLevel0StopWritesTrigger(int level0StopWritesTrigger)Maximum number of level-0 files.ColumnFamilyOptionssetLevelCompactionDynamicLevelBytes(boolean enableLevelCompactionDynamicLevelBytes)Iftrue, RocksDB will pick target size of each level dynamically.ColumnFamilyOptionssetLevelZeroFileNumCompactionTrigger(int numFiles)Number of files to trigger level-0 compaction.ColumnFamilyOptionssetLevelZeroSlowdownWritesTrigger(int numFiles)Soft limit on number of level-0 files.ColumnFamilyOptionssetLevelZeroStopWritesTrigger(int numFiles)Maximum number of level-0 files.ColumnFamilyOptionssetMaxBytesForLevelBase(long maxBytesForLevelBase)The upper-bound of the total size of level-1 files in bytes.ColumnFamilyOptionssetMaxBytesForLevelMultiplier(double multiplier)The ratio between the total size of level-(L+1) files and the total size of level-L files for all L.ColumnFamilyOptionssetMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional)Different max-size multipliers for different levels.ColumnFamilyOptionssetMaxCompactionBytes(long maxCompactionBytes)Maximum size of each compaction (not guarantee)ColumnFamilyOptionssetMaxSequentialSkipInIterations(long maxSequentialSkipInIterations)An iteration->Next() sequentially skips over keys with the same user-key unless this option is set.ColumnFamilyOptionssetMaxSuccessiveMerges(long maxSuccessiveMerges)Maximum number of successive merge operations on a key in the memtable.ColumnFamilyOptionssetMaxTableFilesSizeFIFO(long maxTableFilesSize)FIFO compaction option.ColumnFamilyOptionssetMaxWriteBufferNumber(int maxWriteBufferNumber)The maximum number of write buffers that are built up in memory.ColumnFamilyOptionssetMaxWriteBufferNumberToMaintain(int maxWriteBufferNumberToMaintain)The total maximum number of write buffers to maintain in memory including copies of buffers that have already been flushed.ColumnFamilyOptionssetMemTableConfig(MemTableConfig memTableConfig)Set the config for mem-table.ColumnFamilyOptionssetMemtableHugePageSize(long memtableHugePageSize)Page size for huge page TLB for bloom in memtable.ColumnFamilyOptionssetMemtablePrefixBloomSizeRatio(double memtablePrefixBloomSizeRatio)if prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0, create prefix bloom for memtable with the size of write_buffer_size * memtable_prefix_bloom_size_ratio.ColumnFamilyOptionssetMergeOperator(MergeOperator mergeOperator)Set the merge operator to be used for merging two different key/value pairs that share the same key.ColumnFamilyOptionssetMergeOperatorName(java.lang.String name)Set the merge operator to be used for merging two merge operands of the same key.ColumnFamilyOptionssetMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)The minimum number of write buffers that will be merged together before writing to storage.ColumnFamilyOptionssetNumLevels(int numLevels)Set the number of levels for this database If level-styled compaction is used, then this number determines the total number of levels.ColumnFamilyOptionssetOptimizeFiltersForHits(boolean optimizeFiltersForHits)This flag specifies that the implementation should optimize the filters mainly for cases where keys are found rather than also optimize for keys missed.ColumnFamilyOptionssetParanoidFileChecks(boolean paranoidFileChecks)After writing every SST file, reopen it and read all the keys.ColumnFamilyOptionssetReportBgIoStats(boolean reportBgIoStats)Measure IO stats in compactions and flushes, if true.ColumnFamilyOptionssetSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit)All writes will be slowed down to at least delayed_write_rate if estimated bytes needed to be compaction exceed this threshold.ColumnFamilyOptionssetSstPartitionerFactory(SstPartitionerFactory sstPartitionerFactory)If non-nullptr, use the specified factory for a function to determine the partitioning of sst files.ColumnFamilyOptionssetTableFormatConfig(TableFormatConfig tableFormatConfig)Set the config for table format.ColumnFamilyOptionssetTargetFileSizeBase(long targetFileSizeBase)The target file size for compaction.ColumnFamilyOptionssetTargetFileSizeMultiplier(int multiplier)targetFileSizeMultiplier defines the size ratio between a level-L file and level-(L+1) file.ColumnFamilyOptionssetTtl(long ttl)Non-bottom-level files older than TTL will go through the compaction process.ColumnFamilyOptionssetWriteBufferSize(long writeBufferSize)Amount of data to build up in memory (backed by an unsorted log on disk) before converting to a sorted on-disk file.longsoftPendingCompactionBytesLimit()All writes will be slowed down to at least delayed_write_rate if estimated bytes needed to be compaction exceed this threshold.SstPartitionerFactorysstPartitionerFactory()Get SST partitioner factoryjava.lang.StringtableFactoryName()TableFormatConfigtableFormatConfig()Get the config for table format.longtargetFileSizeBase()The target file size for compaction.inttargetFileSizeMultiplier()targetFileSizeMultiplier defines the size ratio between a level-(L+1) file and level-L file.longttl()Get the TTL for Non-bottom-level files that will go through the compaction process.ColumnFamilyOptionsuseCappedPrefixExtractor(int n)Same as fixed length prefix extractor, except that when slice is shorter than the fixed length, it will use the full key.ColumnFamilyOptionsuseFixedLengthPrefixExtractor(int n)This prefix-extractor uses the first n bytes of a key as its prefix.longwriteBufferSize()Return size of write buffer size.-
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
-
ColumnFamilyOptions
public ColumnFamilyOptions()
Construct ColumnFamilyOptions. This constructor will create (by allocating a block of memory) anrocksdb::ColumnFamilyOptionsin the c++ side.
-
ColumnFamilyOptions
public ColumnFamilyOptions(ColumnFamilyOptions other)
Copy constructor for ColumnFamilyOptions. NOTE: This does a shallow copy, which means comparator, merge_operator, compaction_filter, compaction_filter_factory and other pointers will be cloned!- Parameters:
other- The ColumnFamilyOptions to copy.
-
ColumnFamilyOptions
public ColumnFamilyOptions(Options options)
Constructor from Options- Parameters:
options- The options.
-
-
Method Detail
-
getColumnFamilyOptionsFromProps
public static ColumnFamilyOptions getColumnFamilyOptionsFromProps(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
writeBufferSize()has a property key:write_buffer_size.- Parameters:
properties-Propertiesinstance.- Returns:
instanceor null.- Throws:
java.lang.IllegalArgumentException- if null or emptyPropertiesinstance is passed to the method call.
-
getColumnFamilyOptionsFromProps
public static ColumnFamilyOptions getColumnFamilyOptionsFromProps(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
writeBufferSize()has a property key:write_buffer_size.- Parameters:
cfgOpts- ConfigOptions controlling how the properties are parsed.properties-Propertiesinstance.- Returns:
instanceor null.- Throws:
java.lang.IllegalArgumentException- if null or emptyPropertiesinstance is passed to the method call.
-
oldDefaults
public ColumnFamilyOptions oldDefaults(int majorVersion, int minorVersion)
Description copied from interface:ColumnFamilyOptionsInterfaceThe function recovers options to a previous version. Only 4.6 or later versions are supported.- Specified by:
oldDefaultsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the instance of the current object.
-
optimizeForSmallDb
public ColumnFamilyOptions optimizeForSmallDb()
Description copied from interface:ColumnFamilyOptionsInterfaceUse 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 interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the instance of the current object.
-
optimizeForSmallDb
public ColumnFamilyOptions optimizeForSmallDb(Cache cache)
Description copied from interface:ColumnFamilyOptionsInterfaceSome functions that make it easier to optimize RocksDB Use this if your DB is very small (like under 1GB) and you don't want to spend lots of memory for memtables. An optional cache object is passed in to be used as the block cache- Specified by:
optimizeForSmallDbin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the instance of the current object.
-
optimizeForPointLookup
public ColumnFamilyOptions optimizeForPointLookup(long blockCacheSizeMb)
Description copied from interface:ColumnFamilyOptionsInterfaceUse this if you don't need to keep the data sorted, i.e. you'll never use an iterator, only Put() and Get() API calls- Specified by:
optimizeForPointLookupin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
blockCacheSizeMb- Block cache size in MB- Returns:
- the instance of the current object.
-
optimizeLevelStyleCompaction
public ColumnFamilyOptions optimizeLevelStyleCompaction()
Description copied from interface:ColumnFamilyOptionsInterfaceDefault values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for level style compaction.
Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.
Note: we might use more memory than memtable_memory_budget during high write rate period
- Specified by:
optimizeLevelStyleCompactionin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the instance of the current object.
-
optimizeLevelStyleCompaction
public ColumnFamilyOptions optimizeLevelStyleCompaction(long memtableMemoryBudget)
Description copied from interface:ColumnFamilyOptionsInterfaceDefault values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for level style compaction.
Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.
Note: we might use more memory than memtable_memory_budget during high write rate period
- Specified by:
optimizeLevelStyleCompactionin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
memtableMemoryBudget- memory budget in bytes- Returns:
- the instance of the current object.
-
optimizeUniversalStyleCompaction
public ColumnFamilyOptions optimizeUniversalStyleCompaction()
Description copied from interface:ColumnFamilyOptionsInterfaceDefault values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for universal style compaction.
Universal style compaction is focused on reducing Write Amplification Factor for big data sets, but increases Space Amplification.
Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.
Note: we might use more memory than memtable_memory_budget during high write rate period
- Specified by:
optimizeUniversalStyleCompactionin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the instance of the current object.
-
optimizeUniversalStyleCompaction
public ColumnFamilyOptions optimizeUniversalStyleCompaction(long memtableMemoryBudget)
Description copied from interface:ColumnFamilyOptionsInterfaceDefault values for some parameters in ColumnFamilyOptions are not optimized for heavy workloads and big datasets, which means you might observe write stalls under some conditions. As a starting point for tuning RocksDB options, use the following for universal style compaction.
Universal style compaction is focused on reducing Write Amplification Factor for big data sets, but increases Space Amplification.
Make sure to also call IncreaseParallelism(), which will provide the biggest performance gains.
Note: we might use more memory than memtable_memory_budget during high write rate period
- Specified by:
optimizeUniversalStyleCompactionin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
memtableMemoryBudget- memory budget in bytes- Returns:
- the instance of the current object.
-
setComparator
public ColumnFamilyOptions setComparator(BuiltinComparator builtinComparator)
Description copied from interface:ColumnFamilyOptionsInterfaceSetBuiltinComparatorto be used with RocksDB. Note: Comparator can be set once upon database creation. Default: BytewiseComparator.- Specified by:
setComparatorin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
builtinComparator- aBuiltinComparatortype.- Returns:
- the instance of the current object.
-
setComparator
public ColumnFamilyOptions setComparator(AbstractComparator comparator)
Description copied from interface:ColumnFamilyOptionsInterfaceUse the specified comparator for key ordering. Comparator should not be disposed before options instances using this comparator is disposed. If dispose() function is not called, then comparator object will be GC'd automatically. Comparator instance can be re-used in multiple options instances.- Specified by:
setComparatorin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
comparator- java instance.- Returns:
- the instance of the current object.
-
setMergeOperatorName
public ColumnFamilyOptions setMergeOperatorName(java.lang.String name)
Description copied from interface:ColumnFamilyOptionsInterfaceSet the merge operator to be used for merging two merge operands of the same key. The merge function is invoked during compaction and at lookup time, if multiple key/value pairs belonging to the same key are found in the database.
- Specified by:
setMergeOperatorNamein interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
name- the name of the merge function, as defined by the MergeOperators factory (see utilities/MergeOperators.h) The merge function is specified by name and must be one of the standard merge operators provided by RocksDB. The available operators are "put", "uint64add", "stringappend" and "stringappendtest".- Returns:
- the instance of the current object.
-
setMergeOperator
public ColumnFamilyOptions setMergeOperator(MergeOperator mergeOperator)
Description copied from interface:ColumnFamilyOptionsInterfaceSet the merge operator to be used for merging two different key/value pairs that share the same key. The merge function is invoked during compaction and at lookup time, if multiple key/value pairs belonging to the same key are found in the database.
- Specified by:
setMergeOperatorin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
mergeOperator-MergeOperatorinstance.- Returns:
- the instance of the current object.
-
setCompactionFilter
public ColumnFamilyOptions setCompactionFilter(AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter)
Description copied from interface:ColumnFamilyOptionsInterfaceA single CompactionFilter instance to call into during compaction. Allows an application to modify/delete a key-value during background compaction. If the client requires a new compaction filter to be used for different compaction runs, it can specify callColumnFamilyOptionsInterface.setCompactionFilterFactory(AbstractCompactionFilterFactory)instead. The client should specify only set one of the two.ColumnFamilyOptionsInterface.setCompactionFilter(AbstractCompactionFilter)takes precedence overColumnFamilyOptionsInterface.setCompactionFilterFactory(AbstractCompactionFilterFactory)if the client specifies both. If multithreaded compaction is being used, the supplied CompactionFilter instance may be used from different threads concurrently and so should be thread-safe.- Specified by:
setCompactionFilterin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionFilter-AbstractCompactionFilterinstance.- Returns:
- the instance of the current object.
-
compactionFilter
public AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter()
Description copied from interface:ColumnFamilyOptionsInterfaceAccessor for the CompactionFilter instance in use.- Specified by:
compactionFilterin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- Reference to the CompactionFilter, or null if one hasn't been set.
-
setCompactionFilterFactory
public ColumnFamilyOptions setCompactionFilterFactory(AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory)
Description copied from interface:ColumnFamilyOptionsInterfaceThis is a factory that providesAbstractCompactionFilterobjects which allow an application to modify/delete a key-value during background compaction. A new filter will be created on each compaction run. If multithreaded compaction is being used, each created CompactionFilter will only be used from a single thread and so does not need to be thread-safe.- Specified by:
setCompactionFilterFactoryin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionFilterFactory-AbstractCompactionFilterFactoryinstance.- Returns:
- the instance of the current object.
-
compactionFilterFactory
public AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory()
Description copied from interface:ColumnFamilyOptionsInterfaceAccessor for the CompactionFilterFactory instance in use.- Specified by:
compactionFilterFactoryin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- Reference to the CompactionFilterFactory, or null if one hasn't been set.
-
setWriteBufferSize
public ColumnFamilyOptions setWriteBufferSize(long writeBufferSize)
Description copied from interface:MutableColumnFamilyOptionsInterfaceAmount of data to build up in memory (backed by an unsorted log on disk) before converting to a sorted on-disk file. Larger values increase performance, especially during bulk loads. Up tomax_write_buffer_numberwrite buffers may be held in memory at the same time, so you may wish to adjust this parameter to control memory usage. Also, a larger write buffer will result in a longer recovery time the next time the database is opened. Default: 64MB- Specified by:
setWriteBufferSizein interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
writeBufferSize- the size of write buffer.- Returns:
- the instance of the current object.
-
writeBufferSize
public long writeBufferSize()
Description copied from interface:MutableColumnFamilyOptionsInterfaceReturn size of write buffer size.- Specified by:
writeBufferSizein interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- size of write buffer.
- See Also:
MutableColumnFamilyOptionsInterface.setWriteBufferSize(long)
-
setMaxWriteBufferNumber
public ColumnFamilyOptions setMaxWriteBufferNumber(int maxWriteBufferNumber)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceThe maximum number of write buffers that are built up in memory. The default is 2, so that when 1 write buffer is being flushed to storage, new writes can continue to the other write buffer. Default: 2- Specified by:
setMaxWriteBufferNumberin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxWriteBufferNumber- maximum number of write buffers.- Returns:
- the instance of the current options.
-
maxWriteBufferNumber
public int maxWriteBufferNumber()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceReturns maximum number of write buffers.- Specified by:
maxWriteBufferNumberin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- maximum number of write buffers.
- See Also:
AdvancedMutableColumnFamilyOptionsInterface.setMaxWriteBufferNumber(int)
-
setMinWriteBufferNumberToMerge
public ColumnFamilyOptions setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe minimum number of write buffers that will be merged together before writing to storage. If set to 1, then all write buffers are flushed to L0 as individual files and this increases read amplification because a get request has to check in all of these files. Also, an in-memory merge may result in writing lesser data to storage if there are duplicate records in each of these individual write buffers. Default: 1- Specified by:
setMinWriteBufferNumberToMergein interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
minWriteBufferNumberToMerge- the minimum number of write buffers that will be merged together.- Returns:
- the reference to the current options.
-
minWriteBufferNumberToMerge
public int minWriteBufferNumberToMerge()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe minimum number of write buffers that will be merged together before writing to storage. If set to 1, then all write buffers are flushed to L0 as individual files and this increases read amplification because a get request has to check in all of these files. Also, an in-memory merge may result in writing lesser data to storage if there are duplicate records in each of these individual write buffers. Default: 1- Specified by:
minWriteBufferNumberToMergein interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the minimum number of write buffers that will be merged together.
-
useFixedLengthPrefixExtractor
public ColumnFamilyOptions useFixedLengthPrefixExtractor(int n)
Description copied from interface:ColumnFamilyOptionsInterfaceThis prefix-extractor uses the first n bytes of a key as its prefix. In some hash-based memtable representation such as HashLinkedList and HashSkipList, prefixes are used to partition the keys into several buckets. Prefix extractor is used to specify how to extract the prefix given a key.- Specified by:
useFixedLengthPrefixExtractorin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
n- use the first n bytes of a key as its prefix.- Returns:
- the reference to the current option.
-
useCappedPrefixExtractor
public ColumnFamilyOptions useCappedPrefixExtractor(int n)
Description copied from interface:ColumnFamilyOptionsInterfaceSame as fixed length prefix extractor, except that when slice is shorter than the fixed length, it will use the full key.- Specified by:
useCappedPrefixExtractorin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
n- use the first n bytes of a key as its prefix.- Returns:
- the reference to the current option.
-
setCompressionType
public ColumnFamilyOptions setCompressionType(CompressionType compressionType)
Description copied from interface:MutableColumnFamilyOptionsInterfaceCompress blocks using the specified compression algorithm. This parameter can be changed dynamically. Default: SNAPPY_COMPRESSION, which gives lightweight but fast compression.- Specified by:
setCompressionTypein interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compressionType- Compression Type.- Returns:
- the reference to the current option.
-
compressionType
public CompressionType compressionType()
Description copied from interface:MutableColumnFamilyOptionsInterfaceCompress blocks using the specified compression algorithm. This parameter can be changed dynamically. Default: SNAPPY_COMPRESSION, which gives lightweight but fast compression.- Specified by:
compressionTypein interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- Compression type.
-
setCompressionPerLevel
public ColumnFamilyOptions setCompressionPerLevel(java.util.List<CompressionType> compressionLevels)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceDifferent levels can have different compression policies. There are cases where most lower levels would like to use quick compression algorithms while the higher levels (which have more data) use compression algorithms that have better compression but could be slower. This array, if non-empty, should have an entry for each level of the database; these override the value specified in the previous field 'compression'.
NOTICEIf
level_compaction_dynamic_level_bytes=true,compression_per_level[0]still determinesL0, but other elements of the array are based on base level (the levelL0files are merged to), and may not match the level users see from info log for metadata.If
ExampleL0files are merged tolevel - n, then, fori>0,compression_per_level[i]determines compaction type for leveln+i-1.For example, if we have 5 levels, and we determine to merge
L0data toL4(which meansL1..L3will be empty), then the new files go toL4uses compression typecompression_per_level[1].If now
L0is merged toL2. Data goes toL2will be compressed according tocompression_per_level[1],L3usingcompression_per_level[2]andL4usingcompression_per_level[3]. Compaction for each level can change when data grows.Default: empty
- Specified by:
setCompressionPerLevelin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compressionLevels- list ofCompressionTypeinstances.- Returns:
- the reference to the current options.
-
compressionPerLevel
public java.util.List<CompressionType> compressionPerLevel()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceReturn the currently set
CompressionTypeper instances.See:
AdvancedColumnFamilyOptionsInterface.setCompressionPerLevel(java.util.List)- Specified by:
compressionPerLevelin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- list of
CompressionTypeinstances.
-
setBottommostCompressionType
public ColumnFamilyOptions setBottommostCompressionType(CompressionType bottommostCompressionType)
Description copied from interface:ColumnFamilyOptionsInterfaceCompression algorithm that will be used for the bottommost level that contain files. If level-compaction is used, this option will only affect levels after base level. Default:CompressionType.DISABLE_COMPRESSION_OPTION- Specified by:
setBottommostCompressionTypein interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
bottommostCompressionType- The compression type to use for the bottommost level- Returns:
- the reference of the current options.
-
bottommostCompressionType
public CompressionType bottommostCompressionType()
Description copied from interface:ColumnFamilyOptionsInterfaceCompression algorithm that will be used for the bottommost level that contain files. If level-compaction is used, this option will only affect levels after base level. Default:CompressionType.DISABLE_COMPRESSION_OPTION- Specified by:
bottommostCompressionTypein interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The compression type used for the bottommost level
-
setBottommostCompressionOptions
public ColumnFamilyOptions setBottommostCompressionOptions(CompressionOptions bottommostCompressionOptions)
Description copied from interface:ColumnFamilyOptionsInterfaceSet the options for compression algorithms used byColumnFamilyOptionsInterface.bottommostCompressionType()if it is enabled. To enable it, please see the definition ofCompressionOptions.- Specified by:
setBottommostCompressionOptionsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
bottommostCompressionOptions- the bottom most compression options.- Returns:
- the reference of the current options.
-
bottommostCompressionOptions
public CompressionOptions bottommostCompressionOptions()
Description copied from interface:ColumnFamilyOptionsInterfaceGet the bottom most compression options. SeeColumnFamilyOptionsInterface.setBottommostCompressionOptions(CompressionOptions).- Specified by:
bottommostCompressionOptionsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the bottom most compression options.
-
setCompressionOptions
public ColumnFamilyOptions setCompressionOptions(CompressionOptions compressionOptions)
Description copied from interface:ColumnFamilyOptionsInterfaceSet the different options for compression algorithms- Specified by:
setCompressionOptionsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compressionOptions- The compression options- Returns:
- the reference of the current options.
-
compressionOptions
public CompressionOptions compressionOptions()
Description copied from interface:ColumnFamilyOptionsInterfaceGet the different options for compression algorithms- Specified by:
compressionOptionsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The compression options
-
setNumLevels
public ColumnFamilyOptions setNumLevels(int numLevels)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceSet the number of levels for this database If level-styled compaction is used, then this number determines the total number of levels.- Specified by:
setNumLevelsin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
numLevels- the number of levels.- Returns:
- the reference to the current options.
-
numLevels
public int numLevels()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceIf level-styled compaction is used, then this number determines the total number of levels.- Specified by:
numLevelsin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the number of levels.
-
setLevelZeroFileNumCompactionTrigger
public ColumnFamilyOptions setLevelZeroFileNumCompactionTrigger(int numFiles)
Description copied from interface:ColumnFamilyOptionsInterfaceNumber of files to trigger level-0 compaction. A value < 0 means that level-0 compaction will not be triggered by number of files at all. Default: 4- Specified by:
setLevelZeroFileNumCompactionTriggerin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
numFiles- the number of files in level-0 to trigger compaction.- Returns:
- the reference to the current option.
-
levelZeroFileNumCompactionTrigger
public int levelZeroFileNumCompactionTrigger()
Description copied from interface:ColumnFamilyOptionsInterfaceThe number of files in level 0 to trigger compaction from level-0 to level-1. A value < 0 means that level-0 compaction will not be triggered by number of files at all. Default: 4- Specified by:
levelZeroFileNumCompactionTriggerin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the number of files in level 0 to trigger compaction.
-
setLevelZeroSlowdownWritesTrigger
public ColumnFamilyOptions setLevelZeroSlowdownWritesTrigger(int numFiles)
Description copied from interface:ColumnFamilyOptionsInterfaceSoft limit on number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.- Specified by:
setLevelZeroSlowdownWritesTriggerin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
numFiles- soft limit on number of level-0 files.- Returns:
- the reference to the current option.
-
levelZeroSlowdownWritesTrigger
public int levelZeroSlowdownWritesTrigger()
Description copied from interface:ColumnFamilyOptionsInterfaceSoft limit on the number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.- Specified by:
levelZeroSlowdownWritesTriggerin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the soft limit on the number of level-0 files.
-
setLevelZeroStopWritesTrigger
public ColumnFamilyOptions setLevelZeroStopWritesTrigger(int numFiles)
Description copied from interface:ColumnFamilyOptionsInterfaceMaximum number of level-0 files. We stop writes at this point.- Specified by:
setLevelZeroStopWritesTriggerin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
numFiles- the hard limit of the number of level-0 files.- Returns:
- the reference to the current option.
-
levelZeroStopWritesTrigger
public int levelZeroStopWritesTrigger()
Description copied from interface:ColumnFamilyOptionsInterfaceMaximum number of level-0 files. We stop writes at this point.- Specified by:
levelZeroStopWritesTriggerin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the hard limit of the number of level-0 file.
-
setTargetFileSizeBase
public ColumnFamilyOptions setTargetFileSizeBase(long targetFileSizeBase)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceThe target file size for compaction. This targetFileSizeBase determines a level-1 file size. Target file size for level L can be calculated by targetFileSizeBase * (targetFileSizeMultiplier ^ (L-1)) For example, if targetFileSizeBase is 2MB and target_file_size_multiplier is 10, then each file on level-1 will be 2MB, and each file on level 2 will be 20MB, and each file on level-3 will be 200MB. by default targetFileSizeBase is 64MB.- Specified by:
setTargetFileSizeBasein interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
targetFileSizeBase- the target size of a level-0 file.- Returns:
- the reference to the current options.
- See Also:
AdvancedMutableColumnFamilyOptionsInterface.setTargetFileSizeMultiplier(int)
-
targetFileSizeBase
public long targetFileSizeBase()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceThe target file size for compaction. This targetFileSizeBase determines a level-1 file size. Target file size for level L can be calculated by targetFileSizeBase * (targetFileSizeMultiplier ^ (L-1)) For example, if targetFileSizeBase is 2MB and target_file_size_multiplier is 10, then each file on level-1 will be 2MB, and each file on level 2 will be 20MB, and each file on level-3 will be 200MB. by default targetFileSizeBase is 64MB.- Specified by:
targetFileSizeBasein interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the target size of a level-0 file.
- See Also:
AdvancedMutableColumnFamilyOptionsInterface.targetFileSizeMultiplier()
-
setTargetFileSizeMultiplier
public ColumnFamilyOptions setTargetFileSizeMultiplier(int multiplier)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfacetargetFileSizeMultiplier defines the size ratio between a level-L file and level-(L+1) file. By default target_file_size_multiplier is 1, meaning files in different levels have the same target.- Specified by:
setTargetFileSizeMultiplierin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
multiplier- the size ratio between a level-(L+1) file and level-L file.- Returns:
- the reference to the current options.
-
targetFileSizeMultiplier
public int targetFileSizeMultiplier()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfacetargetFileSizeMultiplier defines the size ratio between a level-(L+1) file and level-L file. By default targetFileSizeMultiplier is 1, meaning files in different levels have the same target.- Specified by:
targetFileSizeMultiplierin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the size ratio between a level-(L+1) file and level-L file.
-
setMaxBytesForLevelBase
public ColumnFamilyOptions setMaxBytesForLevelBase(long maxBytesForLevelBase)
Description copied from interface:MutableColumnFamilyOptionsInterfaceThe upper-bound of the total size of level-1 files in bytes. Maximum number of bytes for level L can be calculated as (maxBytesForLevelBase) * (maxBytesForLevelMultiplier ^ (L-1)) For example, if maxBytesForLevelBase is 20MB, and if max_bytes_for_level_multiplier is 10, total data size for level-1 will be 200MB, total file size for level-2 will be 2GB, and total file size for level-3 will be 20GB. by default 'maxBytesForLevelBase' is 256MB.- Specified by:
setMaxBytesForLevelBasein interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxBytesForLevelBase- maximum bytes for level base.- Returns:
- the reference to the current option.
See
AdvancedMutableColumnFamilyOptionsInterface.setMaxBytesForLevelMultiplier(double)
-
maxBytesForLevelBase
public long maxBytesForLevelBase()
Description copied from interface:MutableColumnFamilyOptionsInterfaceThe upper-bound of the total size of level-1 files in bytes. Maximum number of bytes for level L can be calculated as (maxBytesForLevelBase) * (maxBytesForLevelMultiplier ^ (L-1)) For example, if maxBytesForLevelBase is 20MB, and if max_bytes_for_level_multiplier is 10, total data size for level-1 will be 200MB, total file size for level-2 will be 2GB, and total file size for level-3 will be 20GB. by default 'maxBytesForLevelBase' is 256MB.- Specified by:
maxBytesForLevelBasein interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the upper-bound of the total size of level-1 files
in bytes.
See
AdvancedMutableColumnFamilyOptionsInterface.maxBytesForLevelMultiplier()
-
setLevelCompactionDynamicLevelBytes
public ColumnFamilyOptions setLevelCompactionDynamicLevelBytes(boolean enableLevelCompactionDynamicLevelBytes)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceIf
true, RocksDB will pick target size of each level dynamically. We will pick a base level b >= 1. L0 will be directly merged into level b, instead of always into level 1. Level 1 to b-1 need to be empty. We try to pick b and its target size so that- target size is in the range of (max_bytes_for_level_base / max_bytes_for_level_multiplier, max_bytes_for_level_base]
- target size of the last level (level num_levels-1) equals to extra size of the level.
At the same time max_bytes_for_level_multiplier and max_bytes_for_level_multiplier_additional are still satisfied.
With this option on, from an empty DB, we make last level the base level, which means merging L0 data into the last level, until it exceeds max_bytes_for_level_base. And then we make the second last level to be base level, to start to merge L0 data to second last level, with its target size to be
1/max_bytes_for_level_multiplierof the last levels extra size. After the data accumulates more so that we need to move the base level to the third last one, and so on.Example
For example, assume
max_bytes_for_level_multiplier=10,num_levels=6, andmax_bytes_for_level_base=10MB.Target sizes of level 1 to 5 starts with:
[- - - - 10MB]with base level is level. Target sizes of level 1 to 4 are not applicable because they will not be used. Until the size of Level 5 grows to more than 10MB, say 11MB, we make base target to level 4 and now the targets looks like:
[- - - 1.1MB 11MB]While data are accumulated, size targets are tuned based on actual data of level 5. When level 5 has 50MB of data, the target is like:
[- - - 5MB 50MB]Until level 5's actual size is more than 100MB, say 101MB. Now if we keep level 4 to be the base level, its target size needs to be 10.1MB, which doesn't satisfy the target size range. So now we make level 3 the target size and the target sizes of the levels look like:
[- - 1.01MB 10.1MB 101MB]In the same way, while level 5 further grows, all levels' targets grow, like
[- - 5MB 50MB 500MB]Until level 5 exceeds 1000MB and becomes 1001MB, we make level 2 the base level and make levels' target sizes like this:
[- 1.001MB 10.01MB 100.1MB 1001MB]and go on...
By doing it, we give
max_bytes_for_level_multipliera priority againstmax_bytes_for_level_base, for a more predictable LSM tree shape. It is useful to limit worse case space amplification.max_bytes_for_level_multiplier_additionalis ignored with this flag on.Turning this feature on or off for an existing DB can cause unexpected LSM tree structure so it's not recommended.
Caution: this option is experimental
Default: false
- Specified by:
setLevelCompactionDynamicLevelBytesin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
enableLevelCompactionDynamicLevelBytes- boolean value indicating ifLevelCompactionDynamicLevelBytesshall be enabled.- Returns:
- the reference to the current options.
-
levelCompactionDynamicLevelBytes
public boolean levelCompactionDynamicLevelBytes()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceReturn if
LevelCompactionDynamicLevelBytesis enabled.For further information see
AdvancedColumnFamilyOptionsInterface.setLevelCompactionDynamicLevelBytes(boolean)- Specified by:
levelCompactionDynamicLevelBytesin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- boolean value indicating if
levelCompactionDynamicLevelBytesis enabled.
-
setMaxBytesForLevelMultiplier
public ColumnFamilyOptions setMaxBytesForLevelMultiplier(double multiplier)
Description copied from interface:ColumnFamilyOptionsInterfaceThe ratio between the total size of level-(L+1) files and the total size of level-L files for all L. DEFAULT: 10- Specified by:
setMaxBytesForLevelMultiplierin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Specified by:
setMaxBytesForLevelMultiplierin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
multiplier- the ratio between the total size of level-(L+1) files and the total size of level-L files for all L.- Returns:
- the reference to the current option.
-
maxBytesForLevelMultiplier
public double maxBytesForLevelMultiplier()
Description copied from interface:ColumnFamilyOptionsInterfaceThe ratio between the total size of level-(L+1) files and the total size of level-L files for all L. DEFAULT: 10- Specified by:
maxBytesForLevelMultiplierin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Specified by:
maxBytesForLevelMultiplierin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the ratio between the total size of level-(L+1) files and the total size of level-L files for all L.
-
setMaxCompactionBytes
public ColumnFamilyOptions setMaxCompactionBytes(long maxCompactionBytes)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceMaximum size of each compaction (not guarantee)- Specified by:
setMaxCompactionBytesin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Specified by:
setMaxCompactionBytesin interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxCompactionBytes- the compaction size limit- Returns:
- the reference to the current options.
- See Also:
MutableColumnFamilyOptionsInterface.maxCompactionBytes()
-
maxCompactionBytes
public long maxCompactionBytes()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceControl maximum size of each compaction (not guaranteed)- Specified by:
maxCompactionBytesin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Specified by:
maxCompactionBytesin interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- compaction size threshold
- See Also:
MutableColumnFamilyOptionsInterface.setMaxCompactionBytes(long)
-
setArenaBlockSize
public ColumnFamilyOptions setArenaBlockSize(long arenaBlockSize)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceThe size of one block in arena memory allocation. If ≤ 0, a proper value is automatically calculated (usually 1/10 of writer_buffer_size). There are two additional restriction of the specified size: (1) size should be in the range of [4096, 2 << 30] and (2) be the multiple of the CPU word (which helps with the memory alignment). We'll automatically check and adjust the size number to make sure it conforms to the restrictions. Default: 0- Specified by:
setArenaBlockSizein interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
arenaBlockSize- the size of an arena block- Returns:
- the reference to the current options.
-
arenaBlockSize
public long arenaBlockSize()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceThe size of one block in arena memory allocation. If ≤ 0, a proper value is automatically calculated (usually 1/10 of writer_buffer_size). There are two additional restriction of the specified size: (1) size should be in the range of [4096, 2 << 30] and (2) be the multiple of the CPU word (which helps with the memory alignment). We'll automatically check and adjust the size number to make sure it conforms to the restrictions. Default: 0- Specified by:
arenaBlockSizein interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the size of an arena block
-
setDisableAutoCompactions
public ColumnFamilyOptions setDisableAutoCompactions(boolean disableAutoCompactions)
Description copied from interface:MutableColumnFamilyOptionsInterfaceDisable automatic compactions. Manual compactions can still be issued on this column family- Specified by:
setDisableAutoCompactionsin interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
disableAutoCompactions- true if auto-compactions are disabled.- Returns:
- the reference to the current option.
-
disableAutoCompactions
public boolean disableAutoCompactions()
Description copied from interface:MutableColumnFamilyOptionsInterfaceDisable automatic compactions. Manual compactions can still be issued on this column family- Specified by:
disableAutoCompactionsin interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- true if auto-compactions are disabled.
-
setCompactionStyle
public ColumnFamilyOptions setCompactionStyle(CompactionStyle compactionStyle)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceSet compaction style for DB. Default: LEVEL.- Specified by:
setCompactionStylein interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionStyle- Compaction style.- Returns:
- the reference to the current options.
-
compactionStyle
public CompactionStyle compactionStyle()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceCompaction style for DB.- Specified by:
compactionStylein interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- Compaction style.
-
setMaxTableFilesSizeFIFO
public ColumnFamilyOptions setMaxTableFilesSizeFIFO(long maxTableFilesSize)
Description copied from interface:ColumnFamilyOptionsInterfaceFIFO compaction option. The oldest table file will be deleted once the sum of table files reaches this size. The default value is 1GB (1 * 1024 * 1024 * 1024).- Specified by:
setMaxTableFilesSizeFIFOin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxTableFilesSize- the size limit of the total sum of table files.- Returns:
- the instance of the current object.
-
maxTableFilesSizeFIFO
public long maxTableFilesSizeFIFO()
Description copied from interface:ColumnFamilyOptionsInterfaceFIFO compaction option. The oldest table file will be deleted once the sum of table files reaches this size. The default value is 1GB (1 * 1024 * 1024 * 1024).- Specified by:
maxTableFilesSizeFIFOin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the size limit of the total sum of table files.
-
setMaxSequentialSkipInIterations
public ColumnFamilyOptions setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAn iteration->Next() sequentially skips over keys with the same user-key unless this option is set. This number specifies the number of keys (with the same userkey) that will be sequentially skipped before a reseek is issued. Default: 8- Specified by:
setMaxSequentialSkipInIterationsin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxSequentialSkipInIterations- the number of keys could be skipped in a iteration.- Returns:
- the reference to the current options.
-
maxSequentialSkipInIterations
public long maxSequentialSkipInIterations()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAn iteration->Next() sequentially skips over keys with the same user-key unless this option is set. This number specifies the number of keys (with the same userkey) that will be sequentially skipped before a reseek is issued. Default: 8- Specified by:
maxSequentialSkipInIterationsin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the number of keys could be skipped in a iteration.
-
memTableConfig
public MemTableConfig memTableConfig()
Description copied from interface:ColumnFamilyOptionsInterfaceGet the config for mem-table.- Specified by:
memTableConfigin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the mem-table config.
-
setMemTableConfig
public ColumnFamilyOptions setMemTableConfig(MemTableConfig memTableConfig)
Description copied from interface:ColumnFamilyOptionsInterfaceSet the config for mem-table.- Specified by:
setMemTableConfigin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
memTableConfig- the mem-table config.- Returns:
- the instance of the current object.
-
memTableFactoryName
public java.lang.String memTableFactoryName()
Description copied from interface:ColumnFamilyOptionsInterfaceReturns the name of the current mem table representation. Memtable format can be set using setTableFormatConfig.- Specified by:
memTableFactoryNamein interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the name of the currently-used memtable factory.
- See Also:
ColumnFamilyOptionsInterface.setTableFormatConfig(org.rocksdb.TableFormatConfig)
-
tableFormatConfig
public TableFormatConfig tableFormatConfig()
Description copied from interface:ColumnFamilyOptionsInterfaceGet the config for table format.- Specified by:
tableFormatConfigin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the table format config.
-
setTableFormatConfig
public ColumnFamilyOptions setTableFormatConfig(TableFormatConfig tableFormatConfig)
Description copied from interface:ColumnFamilyOptionsInterfaceSet the config for table format.- Specified by:
setTableFormatConfigin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
tableFormatConfig- the table format config.- Returns:
- the reference of the current options.
-
tableFactoryName
public java.lang.String tableFactoryName()
- Specified by:
tableFactoryNamein interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the name of the currently used table factory.
-
setCfPaths
public ColumnFamilyOptions setCfPaths(java.util.Collection<DbPath> cfPaths)
Description copied from interface:ColumnFamilyOptionsInterfaceA list of paths where SST files for this column family can be put into, with its target size. Similar to db_paths, newer data is placed into paths specified earlier in the vector while older data gradually moves to paths specified later in the vector. Note that, if a path is supplied to multiple column families, it would have files and total size from all the column families combined. User should provision for the total size(from all the column families) in such cases. If left empty, db_paths will be used. Default: empty- Specified by:
setCfPathsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
cfPaths- collection of paths for SST files.- Returns:
- the reference of the current options.
-
cfPaths
public java.util.List<DbPath> cfPaths()
- Specified by:
cfPathsin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- collection of paths for SST files.
-
setInplaceUpdateSupport
public ColumnFamilyOptions setInplaceUpdateSupport(boolean inplaceUpdateSupport)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceAllows thread-safe inplace updates. If inplace_callback function is not set, Put(key, new_value) will update inplace the existing_value iff * key exists in current memtable * new sizeof(new_value) ≤ sizeof(existing_value) * existing_value for that key is a put i.e. kTypeValue If inplace_callback function is set, check doc for inplace_callback. Default: false.- Specified by:
setInplaceUpdateSupportin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
inplaceUpdateSupport- true if thread-safe inplace updates are allowed.- Returns:
- the reference to the current options.
-
inplaceUpdateSupport
public boolean inplaceUpdateSupport()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceAllows thread-safe inplace updates. If inplace_callback function is not set, Put(key, new_value) will update inplace the existing_value iff * key exists in current memtable * new sizeof(new_value) ≤ sizeof(existing_value) * existing_value for that key is a put i.e. kTypeValue If inplace_callback function is set, check doc for inplace_callback. Default: false.- Specified by:
inplaceUpdateSupportin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- true if thread-safe inplace updates are allowed.
-
setInplaceUpdateNumLocks
public ColumnFamilyOptions setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceNumber of locks used for inplace update Default: 10000, if inplace_update_support = true, else 0.- Specified by:
setInplaceUpdateNumLocksin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
inplaceUpdateNumLocks- the number of locks used for inplace updates.- Returns:
- the reference to the current options.
-
inplaceUpdateNumLocks
public long inplaceUpdateNumLocks()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceNumber of locks used for inplace update Default: 10000, if inplace_update_support = true, else 0.- Specified by:
inplaceUpdateNumLocksin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the number of locks used for inplace update.
-
setMemtablePrefixBloomSizeRatio
public ColumnFamilyOptions setMemtablePrefixBloomSizeRatio(double memtablePrefixBloomSizeRatio)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceif prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0, create prefix bloom for memtable with the size of write_buffer_size * memtable_prefix_bloom_size_ratio. If it is larger than 0.25, it is santinized to 0.25. Default: 0 (disable)- Specified by:
setMemtablePrefixBloomSizeRatioin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
memtablePrefixBloomSizeRatio- The ratio- Returns:
- the reference to the current options.
-
memtablePrefixBloomSizeRatio
public double memtablePrefixBloomSizeRatio()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceif prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0, create prefix bloom for memtable with the size of write_buffer_size * memtable_prefix_bloom_size_ratio. If it is larger than 0.25, it is santinized to 0.25. Default: 0 (disable)- Specified by:
memtablePrefixBloomSizeRatioin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the ratio
-
setBloomLocality
public ColumnFamilyOptions setBloomLocality(int bloomLocality)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceControl locality of bloom filter probes to improve cache miss rate. This option only applies to memtable prefix bloom and plaintable prefix bloom. It essentially limits the max number of cache lines each bloom filter check can touch. This optimization is turned off when set to 0. The number should never be greater than number of probes. This option can boost performance for in-memory workload but should use with care since it can cause higher false positive rate. Default: 0- Specified by:
setBloomLocalityin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
bloomLocality- the level of locality of bloom-filter probes.- Returns:
- the reference to the current options.
-
bloomLocality
public int bloomLocality()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceControl locality of bloom filter probes to improve cache miss rate. This option only applies to memtable prefix bloom and plaintable prefix bloom. It essentially limits the max number of cache lines each bloom filter check can touch. This optimization is turned off when set to 0. The number should never be greater than number of probes. This option can boost performance for in-memory workload but should use with care since it can cause higher false positive rate. Default: 0- Specified by:
bloomLocalityin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the level of locality of bloom-filter probes.
- See Also:
AdvancedColumnFamilyOptionsInterface.setBloomLocality(int)
-
setMaxSuccessiveMerges
public ColumnFamilyOptions setMaxSuccessiveMerges(long maxSuccessiveMerges)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceMaximum number of successive merge operations on a key in the memtable. When a merge operation is added to the memtable and the maximum number of successive merges is reached, the value of the key will be calculated and inserted into the memtable instead of the merge operation. This will ensure that there are never more than max_successive_merges merge operations in the memtable. Default: 0 (disabled)- Specified by:
setMaxSuccessiveMergesin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxSuccessiveMerges- the maximum number of successive merges.- Returns:
- the reference to the current options.
-
maxSuccessiveMerges
public long maxSuccessiveMerges()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceMaximum number of successive merge operations on a key in the memtable. When a merge operation is added to the memtable and the maximum number of successive merges is reached, the value of the key will be calculated and inserted into the memtable instead of the merge operation. This will ensure that there are never more than max_successive_merges merge operations in the memtable. Default: 0 (disabled)- Specified by:
maxSuccessiveMergesin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the maximum number of successive merges.
-
setOptimizeFiltersForHits
public ColumnFamilyOptions setOptimizeFiltersForHits(boolean optimizeFiltersForHits)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThis flag specifies that the implementation should optimize the filters mainly for cases where keys are found rather than also optimize for keys missed. This would be used in cases where the application knows that there are very few misses or the performance in the case of misses is not important.
For now, this flag allows us to not store filters for the last level i.e the largest level which contains data of the LSM store. For keys which are hits, the filters in this level are not useful because we will search for the data anyway.
NOTE: the filters in other levels are still useful even for key hit because they tell us whether to look in that level or go to the higher level.
Default: false
- Specified by:
setOptimizeFiltersForHitsin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
optimizeFiltersForHits- boolean value indicating if this flag is set.- Returns:
- the reference to the current options.
-
optimizeFiltersForHits
public boolean optimizeFiltersForHits()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceReturns the current state of the
optimize_filters_for_hitssetting.- Specified by:
optimizeFiltersForHitsin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- boolean value indicating if the flag
optimize_filters_for_hitswas set.
-
setMemtableHugePageSize
public ColumnFamilyOptions setMemtableHugePageSize(long memtableHugePageSize)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfacePage size for huge page TLB for bloom in memtable. If ≤ 0, not allocate from huge page TLB but from malloc. Need to reserve huge pages for it to be allocated. For example: sysctl -w vm.nr_hugepages=20 See linux doc Documentation/vm/hugetlbpage.txt- Specified by:
setMemtableHugePageSizein interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
memtableHugePageSize- The page size of the huge page tlb- Returns:
- the reference to the current options.
-
memtableHugePageSize
public long memtableHugePageSize()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfacePage size for huge page TLB for bloom in memtable. If ≤ 0, not allocate from huge page TLB but from malloc. Need to reserve huge pages for it to be allocated. For example: sysctl -w vm.nr_hugepages=20 See linux doc Documentation/vm/hugetlbpage.txt- Specified by:
memtableHugePageSizein interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The page size of the huge page tlb
-
setSoftPendingCompactionBytesLimit
public ColumnFamilyOptions setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAll writes will be slowed down to at least delayed_write_rate if estimated bytes needed to be compaction exceed this threshold. Default: 64GB- Specified by:
setSoftPendingCompactionBytesLimitin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
softPendingCompactionBytesLimit- The soft limit to impose on compaction- Returns:
- the reference to the current options.
-
softPendingCompactionBytesLimit
public long softPendingCompactionBytesLimit()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAll writes will be slowed down to at least delayed_write_rate if estimated bytes needed to be compaction exceed this threshold. Default: 64GB- Specified by:
softPendingCompactionBytesLimitin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The soft limit to impose on compaction
-
setHardPendingCompactionBytesLimit
public ColumnFamilyOptions setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAll writes are stopped if estimated bytes needed to be compaction exceed this threshold. Default: 256GB- Specified by:
setHardPendingCompactionBytesLimitin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
hardPendingCompactionBytesLimit- The hard limit to impose on compaction- Returns:
- the reference to the current options.
-
hardPendingCompactionBytesLimit
public long hardPendingCompactionBytesLimit()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAll writes are stopped if estimated bytes needed to be compaction exceed this threshold. Default: 256GB- Specified by:
hardPendingCompactionBytesLimitin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The hard limit to impose on compaction
-
setLevel0FileNumCompactionTrigger
public ColumnFamilyOptions setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger)
Description copied from interface:MutableColumnFamilyOptionsInterfaceNumber of files to trigger level-0 compaction. A value < 0 means that level-0 compaction will not be triggered by number of files at all. Default: 4- Specified by:
setLevel0FileNumCompactionTriggerin interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
level0FileNumCompactionTrigger- The number of files to trigger level-0 compaction- Returns:
- the reference to the current option.
-
level0FileNumCompactionTrigger
public int level0FileNumCompactionTrigger()
Description copied from interface:MutableColumnFamilyOptionsInterfaceNumber of files to trigger level-0 compaction. A value < 0 means that level-0 compaction will not be triggered by number of files at all. Default: 4- Specified by:
level0FileNumCompactionTriggerin interfaceMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The number of files to trigger
-
setLevel0SlowdownWritesTrigger
public ColumnFamilyOptions setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceSoft limit on number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.- Specified by:
setLevel0SlowdownWritesTriggerin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
level0SlowdownWritesTrigger- The soft limit on the number of level-0 files- Returns:
- the reference to the current options.
-
level0SlowdownWritesTrigger
public int level0SlowdownWritesTrigger()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceSoft limit on number of level-0 files. We start slowing down writes at this point. A value < 0 means that no writing slow down will be triggered by number of files in level-0.- Specified by:
level0SlowdownWritesTriggerin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The soft limit on the number of level-0 files
-
setLevel0StopWritesTrigger
public ColumnFamilyOptions setLevel0StopWritesTrigger(int level0StopWritesTrigger)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceMaximum number of level-0 files. We stop writes at this point.- Specified by:
setLevel0StopWritesTriggerin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
level0StopWritesTrigger- The maximum number of level-0 files- Returns:
- the reference to the current options.
-
level0StopWritesTrigger
public int level0StopWritesTrigger()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceMaximum number of level-0 files. We stop writes at this point.- Specified by:
level0StopWritesTriggerin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The maximum number of level-0 files
-
setMaxBytesForLevelMultiplierAdditional
public ColumnFamilyOptions setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceDifferent max-size multipliers for different levels. These are multiplied by max_bytes_for_level_multiplier to arrive at the max-size of each level. Default: 1- Specified by:
setMaxBytesForLevelMultiplierAdditionalin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxBytesForLevelMultiplierAdditional- The max-size multipliers for each level- Returns:
- the reference to the current options.
-
maxBytesForLevelMultiplierAdditional
public int[] maxBytesForLevelMultiplierAdditional()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceDifferent max-size multipliers for different levels. These are multiplied by max_bytes_for_level_multiplier to arrive at the max-size of each level. Default: 1- Specified by:
maxBytesForLevelMultiplierAdditionalin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The max-size multipliers for each level
-
setParanoidFileChecks
public ColumnFamilyOptions setParanoidFileChecks(boolean paranoidFileChecks)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAfter writing every SST file, reopen it and read all the keys. Default: false- Specified by:
setParanoidFileChecksin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
paranoidFileChecks- true to enable paranoid file checks- Returns:
- the reference to the current options.
-
paranoidFileChecks
public boolean paranoidFileChecks()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceAfter writing every SST file, reopen it and read all the keys. Default: false- Specified by:
paranoidFileChecksin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- true if paranoid file checks are enabled
-
setMaxWriteBufferNumberToMaintain
public ColumnFamilyOptions setMaxWriteBufferNumberToMaintain(int maxWriteBufferNumberToMaintain)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe total maximum number of write buffers to maintain in memory including copies of buffers that have already been flushed. UnlikeAdvancedMutableColumnFamilyOptionsInterface.maxWriteBufferNumber(), this parameter does not affect flushing. This controls the minimum amount of write history that will be available in memory for conflict checking when Transactions are used. When using an OptimisticTransactionDB: If this value is too low, some transactions may fail at commit time due to not being able to determine whether there were any write conflicts. When using a TransactionDB: If Transaction::SetSnapshot is used, TransactionDB will read either in-memory write buffers or SST files to do write-conflict checking. Increasing this value can reduce the number of reads to SST files done for conflict detection. Setting this value to 0 will cause write buffers to be freed immediately after they are flushed. If this value is set to -1,AdvancedMutableColumnFamilyOptionsInterface.maxWriteBufferNumber()will be used. Default: If using a TransactionDB/OptimisticTransactionDB, the default value will be set to the value ofAdvancedMutableColumnFamilyOptionsInterface.maxWriteBufferNumber()if it is not explicitly set by the user. Otherwise, the default is 0.- Specified by:
setMaxWriteBufferNumberToMaintainin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
maxWriteBufferNumberToMaintain- The maximum number of write buffers to maintain- Returns:
- the reference to the current options.
-
maxWriteBufferNumberToMaintain
public int maxWriteBufferNumberToMaintain()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe total maximum number of write buffers to maintain in memory including copies of buffers that have already been flushed.- Specified by:
maxWriteBufferNumberToMaintainin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- maxWriteBufferNumberToMaintain The maximum number of write buffers to maintain
-
setCompactionPriority
public ColumnFamilyOptions setCompactionPriority(CompactionPriority compactionPriority)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceIf levelAdvancedColumnFamilyOptionsInterface.compactionStyle()==CompactionStyle.LEVEL, for each level, which files are prioritized to be picked to compact. Default:CompactionPriority.ByCompensatedSize- Specified by:
setCompactionPriorityin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionPriority- The compaction priority- Returns:
- the reference to the current options.
-
compactionPriority
public CompactionPriority compactionPriority()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceGet the Compaction priority if level compaction is used for all levels- Specified by:
compactionPriorityin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The compaction priority
-
setReportBgIoStats
public ColumnFamilyOptions setReportBgIoStats(boolean reportBgIoStats)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceMeasure IO stats in compactions and flushes, if true. Default: false- Specified by:
setReportBgIoStatsin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
reportBgIoStats- true to enable reporting- Returns:
- the reference to the current options.
-
reportBgIoStats
public boolean reportBgIoStats()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceDetermine whether IO stats in compactions and flushes are being measured- Specified by:
reportBgIoStatsin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- true if reporting is enabled
-
setTtl
public ColumnFamilyOptions setTtl(long ttl)
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceNon-bottom-level files older than TTL will go through the compaction process. This needsMutableDBOptionsInterface.maxOpenFiles()to be set to -1. Enabled only for level compaction for now. Default: 0 (disabled) Dynamically changeable throughRocksDB.setOptions(ColumnFamilyHandle, MutableColumnFamilyOptions).- Specified by:
setTtlin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
ttl- the time-to-live.- Returns:
- the reference to the current options.
-
ttl
public long ttl()
Description copied from interface:AdvancedMutableColumnFamilyOptionsInterfaceGet the TTL for Non-bottom-level files that will go through the compaction process. SeeAdvancedMutableColumnFamilyOptionsInterface.setTtl(long).- Specified by:
ttlin interfaceAdvancedMutableColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- the time-to-live.
-
setCompactionOptionsUniversal
public ColumnFamilyOptions setCompactionOptionsUniversal(CompactionOptionsUniversal compactionOptionsUniversal)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceSet the options needed to support Universal Style compactions- Specified by:
setCompactionOptionsUniversalin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionOptionsUniversal- The Universal Style compaction options- Returns:
- the reference to the current options.
-
compactionOptionsUniversal
public CompactionOptionsUniversal compactionOptionsUniversal()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe options needed to support Universal Style compactions- Specified by:
compactionOptionsUniversalin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The Universal Style compaction options
-
setCompactionOptionsFIFO
public ColumnFamilyOptions setCompactionOptionsFIFO(CompactionOptionsFIFO compactionOptionsFIFO)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe options for FIFO compaction style- Specified by:
setCompactionOptionsFIFOin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionOptionsFIFO- The FIFO compaction options- Returns:
- the reference to the current options.
-
compactionOptionsFIFO
public CompactionOptionsFIFO compactionOptionsFIFO()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceThe options for FIFO compaction style- Specified by:
compactionOptionsFIFOin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- The FIFO compaction options
-
setForceConsistencyChecks
public ColumnFamilyOptions setForceConsistencyChecks(boolean forceConsistencyChecks)
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceIn debug mode, RocksDB run consistency checks on the LSM every time the LSM change (Flush, Compaction, AddFile). These checks are disabled in release mode, use this option to enable them in release mode as well. Default: false- Specified by:
setForceConsistencyChecksin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
forceConsistencyChecks- true to force consistency checks- Returns:
- the reference to the current options.
-
forceConsistencyChecks
public boolean forceConsistencyChecks()
Description copied from interface:AdvancedColumnFamilyOptionsInterfaceIn debug mode, RocksDB run consistency checks on the LSM every time the LSM change (Flush, Compaction, AddFile). These checks are disabled in release mode.- Specified by:
forceConsistencyChecksin interfaceAdvancedColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- true if consistency checks are enforced
-
setSstPartitionerFactory
public ColumnFamilyOptions setSstPartitionerFactory(SstPartitionerFactory sstPartitionerFactory)
Description copied from interface:ColumnFamilyOptionsInterfaceIf non-nullptr, use the specified factory for a function to determine the partitioning of sst files. This helps compaction to split the files on interesting boundaries (key prefixes) to make propagation of sst files less write amplifying (covering the whole key space). Default: nullptr- Specified by:
setSstPartitionerFactoryin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
sstPartitionerFactory- The factory reference- Returns:
- the reference of the current options.
-
setCompactionThreadLimiter
public ColumnFamilyOptions setCompactionThreadLimiter(ConcurrentTaskLimiter compactionThreadLimiter)
Description copied from interface:ColumnFamilyOptionsInterfaceCompaction concurrent thread limiter for the column family. If non-nullptr, use given concurrent thread limiter to control the max outstanding compaction tasks. Limiter can be shared with multiple column families across db instances.- Specified by:
setCompactionThreadLimiterin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Parameters:
compactionThreadLimiter- The compaction thread limiter.- Returns:
- the reference of the current options.
-
compactionThreadLimiter
public ConcurrentTaskLimiter compactionThreadLimiter()
Description copied from interface:ColumnFamilyOptionsInterfaceGet compaction thread limiter- Specified by:
compactionThreadLimiterin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- Compaction thread limiter
-
sstPartitionerFactory
public SstPartitionerFactory sstPartitionerFactory()
Description copied from interface:ColumnFamilyOptionsInterfaceGet SST partitioner factory- Specified by:
sstPartitionerFactoryin interfaceColumnFamilyOptionsInterface<ColumnFamilyOptions>- Returns:
- SST partitioner factory
-
disposeInternal
protected final void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-