Package org.rocksdb

Enum Class IndexShorteningMode

java.lang.Object
java.lang.Enum<IndexShorteningMode>
org.rocksdb.IndexShorteningMode
All Implemented Interfaces:
Serializable, Comparable<IndexShorteningMode>, Constable

public enum IndexShorteningMode extends 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 Details

    • kNoShortening

      public static final IndexShorteningMode kNoShortening
      Use full keys.
    • 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 Details

    • values

      public static IndexShorteningMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static IndexShorteningMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null