Package org.rocksdb

Enum IndexShorteningMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<IndexShorteningMode>

    public enum IndexShorteningMode
    extends java.lang.Enum<IndexShorteningMode>
    This enum allows trading off increased index size for improved iterator seek performance in some situations, particularly when block cache is disabled (ReadOptions.fillCache() == false and direct IO is enabled (DBOptions.useDirectReads() == true). The default mode is the best tradeoff for most use cases. This option only affects newly written tables. The index contains a key separating each pair of consecutive blocks. Let A be the highest key in one block, B the lowest key in the next block, and I the index entry separating these two blocks: [ ... A] I [B ...] I is allowed to be anywhere in [A, B). If an iterator is seeked to a key in (A, I], we'll unnecessarily read the first block, then immediately fall through to the second block. However, if I=A, this can't happen, and we'll read only the second block. In kNoShortening mode, we use I=A. In other modes, we use the shortest key in [A, B), which usually significantly reduces index size. There's a similar story for the last index entry, which is an upper bound of the highest key in the file. If it's shortened and therefore overestimated, iterator is likely to unnecessarily read the last data block from each file on each seek.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      kNoShortening
      Use full keys.
      kShortenSeparators
      Shorten index keys between blocks, but use full key for the last index key, which is the upper bound of the whole file.
      kShortenSeparatorsAndSuccessor
      Shorten both keys between blocks and key after last block.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IndexShorteningMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static IndexShorteningMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • kShortenSeparators

        public static final IndexShorteningMode kShortenSeparators
        Shorten index keys between blocks, but use full key for the last index key, which is the upper bound of the whole file.
      • kShortenSeparatorsAndSuccessor

        public static final IndexShorteningMode kShortenSeparatorsAndSuccessor
        Shorten both keys between blocks and key after last block.
    • Method Detail

      • values

        public static IndexShorteningMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (IndexShorteningMode c : IndexShorteningMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static IndexShorteningMode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null