Class PartitionIndex

java.lang.Object
org.apache.cassandra.io.sstable.format.bti.PartitionIndex
All Implemented Interfaces:
AutoCloseable, SharedCloseable

public class PartitionIndex extends Object implements 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
plus
  • the last 8 bits of the key's filter hash which is used to filter out mismatched keys without reading the key
To avoid having to create an object to carry the result, the two are distinguished by sign. Direct-to-dfile entries are recorded as ~position (~ instead of - to differentiate 0 in ifile from 0 in dfile).

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.