Skip to main content

encode_redo_log

Function encode_redo_log 

Source
pub fn encode_redo_log(changes: &[RowChange]) -> Vec<u8> 
Expand description

v7.34 (crash-recovery P0 #2), extended v7.37.15 (Epic W slice 1) — encode a row-level redo log to bytes for a WAL record.

§Layout (Epic W metadata-carrying form, always emitted now)

[u8 REDO_META_MARKER=0xFF][u8 REDO_META_VERSION][u8 FILE_VERSION] [u32 count] then per change [u8 op][str table] and, per op:

  • Insert [u32 n][value×n][u64 rowid][u64 writer_version]
  • Update [u32 pos][u32 n][value×n][u64 rowid][u64 writer_version]
  • Delete [u32 n][u32 pos×n][u64 rowid×n][u64 writer_version]
  • Tombstone [u32 n][u64 rowid×n][u64 xmax] (op byte 3; only ever emitted under the metadata-carrying layout — the pre-Epic-W layout had no in-place tombstone, so a legacy stream can never carry it)

Positions are physical (u32 ≤ 4 G rows). The FILE_VERSION byte still rides along (now the 3rd byte) so the value codec decodes string / BYTEA escapes exactly as before.

§Backward compatibility

The pre-Epic-W layout was [u8 FILE_VERSION][u32 count]… with no per-change metadata. decode_redo_log still decodes that form (first byte < 0xFF) byte-for-byte identically — every WAL file written by released code replays unchanged.