Skip to main content

parse_statistics_header

Function parse_statistics_header 

Source
pub fn parse_statistics_header(input: &[u8]) -> IResult<&[u8], StatisticsHeader>
Expand description

Parse the Statistics.db file header with authoritative format detection

Statistics.db format is definitively identified by the version field:

  • Version 4: ‘nb’ (new big) format - Cassandra 5.0+ enhanced statistics

    • Structure: version(4) + statistics_kind(4) + reserved(4) + data_length(4) + metadata1(4) + metadata2(4) + metadata3(4) + checksum(4) = 32 bytes
    • Authoritative marker: version == 4
    • Used by: Cassandra 5.0+ with ‘nb’ SSTable format
  • Versions 1-3: Legacy format - pre-Cassandra 5.0 statistics

    • Structure: version(4) + table_id(16) + section_count(4) + file_size(8) + checksum(4) = 36 bytes
    • Authoritative marker: version in range 1..=3
    • Used by: Cassandra 3.x and 4.x

Any other version number is unsupported and results in a parse error.