public enum IndexShorteningMode extends java.lang.Enum<IndexShorteningMode>
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 and 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.
|
Modifier and Type | Method and 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.
|
public static final IndexShorteningMode kNoShortening
public static final IndexShorteningMode kShortenSeparators
public static final IndexShorteningMode kShortenSeparatorsAndSuccessor
public static IndexShorteningMode[] values()
for (IndexShorteningMode c : IndexShorteningMode.values()) System.out.println(c);
public static IndexShorteningMode valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null