Class PartitionIndex
java.lang.Object
org.apache.cassandra.io.sstable.format.bti.PartitionIndex
- All Implemented Interfaces:
AutoCloseable,SharedCloseable
This class holds the partition index as an on-disk trie mapping unique prefixes of decorated keys to:
- data file position if the partition is small enough to not need an index
- row index file position if the partition has a row index
- the last 8 bits of the key's filter hash which is used to filter out mismatched keys without reading the key
In either case the contents of the file at this position start with a serialization of the key which can be used to verify the correct key is found.
The indexes are created by PartitionIndexBuilder. To read the index one must obtain a thread-unsafe
PartitionIndex.Reader or PartitionIndex.IndexPosIterator.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classIterator of index positions covered between two keys.static classProvides methods to read the partition index trie. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPartitionIndex(FileHandle fh, long trieRoot, long keyCount, DecoratedKey first, DecoratedKey last) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTo(Ref.IdentityCollection identities) protected PartitionIndex.IndexPosIteratorvoidclose()voiddebug/test codefirstKey()protected RebuffererlastKey()static PartitionIndexload(FileHandle.Builder fhBuilder, IPartitioner partitioner, boolean preload) static PartitionIndexload(FileHandle fh, IPartitioner partitioner, boolean preload) static Pair<DecoratedKey,DecoratedKey> readFirstAndLastKey(File file, IPartitioner partitioner) longsize()
-
Field Details
-
NOT_FOUND
public static final long NOT_FOUND- See Also:
-
FOOTER_LENGTH
public static final int FOOTER_LENGTH- See Also:
-
-
Constructor Details
-
PartitionIndex
public PartitionIndex(FileHandle fh, long trieRoot, long keyCount, DecoratedKey first, DecoratedKey last) -
PartitionIndex
-
-
Method Details
-
size
public long size() -
firstKey
-
lastKey
-
addTo
- Specified by:
addToin interfaceSharedCloseable
-
load
public static PartitionIndex load(FileHandle.Builder fhBuilder, IPartitioner partitioner, boolean preload) throws IOException - Throws:
IOException
-
readFirstAndLastKey
public static Pair<DecoratedKey,DecoratedKey> readFirstAndLastKey(File file, IPartitioner partitioner) throws IOException - Throws:
IOException
-
load
public static PartitionIndex load(FileHandle fh, IPartitioner partitioner, boolean preload) throws IOException - Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
close
- Specified by:
closein interfaceSharedCloseable
-
openReader
-
allKeysIterator
-
instantiateRebufferer
-
dumpTrie
debug/test code
-