Package org.rocksdb
Enum Class IndexShorteningMode
- All Implemented Interfaces:
Serializable,Comparable<IndexShorteningMode>,Constable
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.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUse full keys.Shorten index keys between blocks, but use full key for the last index key, which is the upper bound of the whole file.Shorten both keys between blocks and key after last block. -
Method Summary
Modifier and TypeMethodDescriptionstatic IndexShorteningModeReturns the enum constant of this class with the specified name.static IndexShorteningMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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 Details
-
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
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 nameNullPointerException- if the argument is null
-