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.| 枚举常量和说明 |
|---|
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static IndexShorteningMode |
valueOf(java.lang.String name)
返回带有指定名称的该类型的枚举常量。
|
static IndexShorteningMode[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
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 - 要返回的枚举常量的名称。java.lang.IllegalArgumentException - 如果该枚举类型没有带有指定名称的常量java.lang.NullPointerException - 如果参数为空值