Binary format of
RowIndexEntry is defined as follows:
(long) position (64 bit long, vint encoded)
IndexInfo for a description of the serialized format.
For each partition, the layout of the index file looks like this:
- partition key - prefixed with
Generally, we distinguish between index entries that have index
samples (list of
IndexInfo objects) and those who don't.
For each portion of data for a single partition in the data file,
an index sample is created. The size of that portion is defined
Index entries with less than 2 index samples, will just store the
position in the data file.
Note: legacy sstables for index entries are those sstable formats that
do not have an offsets table to index samples (
IndexInfoobjects). These are those sstables created on Cassandra versions
earlier than 3.0.
For index entries with index samples we store the index samples
IndexInfo objects). The bigger the partition, the more
index samples are created. Since a huge amount of index samples
will "pollute" the heap and cause huge GC pressure, Cassandra 3.6
(CASSANDRA-11206) distinguishes between index entries with an
"acceptable" amount of index samples per partition and those
with an "enormous" amount of index samples. The barrier
is controlled by the configuration parameter
Index entries with a total serialized size of index samples up to
column_index_cache_size_in_kb will be held in an array.
Index entries exceeding that value will always be accessed from
This results in these classes:
RowIndexEntry just stores the offset in the data file.
IndexedEntry is for index entries with index samples
and used for both current and legacy sstables, which do not exceed
ShallowIndexedEntry is for index entries with index samples
org.apache.cassandra.config.Config#column_index_cache_size_in_kbfor sstables with an offset table to the index samples.
LegacyShallowIndexedEntry is for index entries with index samples
org.apache.cassandra.config.Config#column_index_cache_size_in_kbbut for legacy sstables.
Since access to index samples on disk (obviously) requires some file
reader, that functionality is encapsulated in implementations of
IndexInfoRetriever. There is an implementation to access
index samples of legacy sstables (without the offsets table),
an implementation of access sstables with an offsets table.
Until now (Cassandra 3.x), we still support reading from legacy sstables -
i.e. sstables created by Cassandra < 3.0 (see