{"id":"wal-record-length-prefixed","text":"Every WAL record is prefixed with a 4-byte little-endian length covering all subsequent fields (CRC through value), enabling the reader to know exactly how many bytes to consume","truth_value":"IN","source":"entries/2026/05/28/topic-lsm-crash-recovery-wal-format.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{"example":"record_length = 4 + 8 + 1 + 4 + len(key) + 4 + len(value)\nheader = struct.pack(\"<IIQBi\", record_length, crc, seq_num, op_type_byte, len(key))\nreturn header + key + struct.pack(\"<i\", len(value)) + value"},"explanation":{"steps":[{"node":"wal-record-length-prefixed","truth_value":"IN","reason":"premise"}]}}