Skip to main content

sector_holds_record

Function sector_holds_record 

Source
pub fn sector_holds_record(data: &[u8], record: &Record) -> bool
Expand description

Check that a head sector still stores the record it was read for.

A retired extent can be released and handed to another record while a reader still holds the old Record and its stale sector number, so the bytes coming back from disk must be proven to belong to this record before they are used. Everything needed is already in the buffer the reader just filled, so this costs no extra I/O. The layout prefix is identical in every format version: marker(2) seq(2) key_len(2) key value_len(8) timestamp(8).