Package org.rocksdb

Class HashLinkedListMemTableConfig


  • public class HashLinkedListMemTableConfig
    extends MemTableConfig
    The config for hash linked list memtable representation Such memtable contains a fix-sized array of buckets, where each bucket points to a sorted singly-linked list (or null if the bucket is empty). Note that since this mem-table representation relies on the key prefix, it is required to invoke one of the usePrefixExtractor functions to specify how to extract key prefix given a key. If proper prefix-extractor is not set, then RocksDB will use the default memtable representation (SkipList) instead and post a warning in the LOG.
    • Field Detail

      • DEFAULT_HUGE_PAGE_TLB_SIZE

        public static final long DEFAULT_HUGE_PAGE_TLB_SIZE
        See Also:
        Constant Field Values
      • DEFAULT_BUCKET_ENTRIES_LOG_THRES

        public static final int DEFAULT_BUCKET_ENTRIES_LOG_THRES
        See Also:
        Constant Field Values
      • DEFAULT_IF_LOG_BUCKET_DIST_WHEN_FLUSH

        public static final boolean DEFAULT_IF_LOG_BUCKET_DIST_WHEN_FLUSH
        See Also:
        Constant Field Values
      • DEFAUL_THRESHOLD_USE_SKIPLIST

        public static final int DEFAUL_THRESHOLD_USE_SKIPLIST
        See Also:
        Constant Field Values
    • Constructor Detail

      • HashLinkedListMemTableConfig

        public HashLinkedListMemTableConfig()
        HashLinkedListMemTableConfig constructor
    • Method Detail

      • setBucketCount

        public HashLinkedListMemTableConfig setBucketCount​(long count)
        Set the number of buckets in the fixed-size array used in the hash linked-list mem-table.
        Parameters:
        count - the number of hash buckets.
        Returns:
        the reference to the current HashLinkedListMemTableConfig.
      • bucketCount

        public long bucketCount()
        Returns the number of buckets that will be used in the memtable created based on this config.
        Returns:
        the number of buckets
      • setHugePageTlbSize

        public HashLinkedListMemTableConfig setHugePageTlbSize​(long size)

        Set the size of huge tlb or allocate the hashtable bytes from malloc if size <= 0.

        The user needs to reserve huge pages for it to be allocated, like: sysctl -w vm.nr_hugepages=20

        See linux documentation/vm/hugetlbpage.txt

        Parameters:
        size - if set to <= 0 hashtable bytes from malloc
        Returns:
        the reference to the current HashLinkedListMemTableConfig.
      • hugePageTlbSize

        public long hugePageTlbSize()
        Returns the size value of hugePageTlbSize.
        Returns:
        the hugePageTlbSize.
      • setBucketEntriesLoggingThreshold

        public HashLinkedListMemTableConfig setBucketEntriesLoggingThreshold​(int threshold)
        If number of entries in one bucket exceeds that setting, log about it.
        Parameters:
        threshold - - number of entries in a single bucket before logging starts.
        Returns:
        the reference to the current HashLinkedListMemTableConfig.
      • bucketEntriesLoggingThreshold

        public int bucketEntriesLoggingThreshold()
        Returns the maximum number of entries in one bucket before logging starts.
        Returns:
        maximum number of entries in one bucket before logging starts.
      • setIfLogBucketDistWhenFlush

        public HashLinkedListMemTableConfig setIfLogBucketDistWhenFlush​(boolean logDistribution)
        If true the distrubition of number of entries will be logged.
        Parameters:
        logDistribution - - boolean parameter indicating if number of entry distribution shall be logged.
        Returns:
        the reference to the current HashLinkedListMemTableConfig.
      • ifLogBucketDistWhenFlush

        public boolean ifLogBucketDistWhenFlush()
        Returns information about logging the distribution of number of entries on flush.
        Returns:
        if distrubtion of number of entries shall be logged.
      • setThresholdUseSkiplist

        public HashLinkedListMemTableConfig setThresholdUseSkiplist​(int threshold)
        Set maximum number of entries in one bucket. Exceeding this val leads to a switch from LinkedList to SkipList.
        Parameters:
        threshold - maximum number of entries before SkipList is used.
        Returns:
        the reference to the current HashLinkedListMemTableConfig.
      • thresholdUseSkiplist

        public int thresholdUseSkiplist()
        Returns entries per bucket threshold before LinkedList is replaced by SkipList usage for that bucket.
        Returns:
        entries per bucket threshold before SkipList is used.
      • newMemTableFactoryHandle

        protected long newMemTableFactoryHandle()
        Description copied from class: MemTableConfig
        This function should only be called by Options.setMemTableConfig(), which will create a c++ shared-pointer to the c++ MemTableRepFactory that associated with the Java MemTableConfig.
        Specified by:
        newMemTableFactoryHandle in class MemTableConfig
        Returns:
        native handle address to native memory table instance.
        See Also:
        Options.setMemTableConfig(MemTableConfig)