Status: Accepted (2026-11-27). Implements the compactor part of 0010; narrow write to pages.tail_* (otherwise realtime-owned, 0021). Tail counters amended by 0705: the clamp did not commute with late realtime flushes, and overlapping jobs could double-subtract. Decrements are now exact and signed, saves compare-and-swap on snapshot_seq, and quiet pages reconcile to 0. Qualifying rules extended by 0312: a third counter, tail_deletes, and a delete rule for large snapshots.
ADR 0010 sets the thresholds and retention, but not how a job is claimed without blocking realtime, how the realtime-maintained tail_ops/tail_bytes counters are reset, or how readers stay safe while files and rows are written.
tail_bytes.
tail_ops > 0, and one of: tail_ops >= 20,000; tail_bytes >= 4 MiB; the first journal row after snapshot_seq is older than 10 minutes (a PK lookup; covers idle and closed rooms).FOR UPDATE SKIP LOCKED), so realtime’s batched counter updates never wait on a job.tail_ops += n). The compactor subtracts exactly what it folded (greatest(0, tail - compacted)), so the two writers commute.snapshot_seq >= max(page_ops.seq) in the same statement.page_snapshots row (or 1 MiB PG chunks when LINORA_SNAPSHOT_STORE=pg) + pages.snapshot_seq/node_count + counter decrement. node_count follows only a newer snapshot.Readers pick the newest row, so they never see unfinished bytes.
loadTombstones, ADR 0101), so restorable ids survive any number of compactions.(cap - 128 MiB) / 400 B nodes are not claimed (large pool). A snapshot whose raw size x4 exceeds the cap is abandoned at admission.LINORA_COMPACTOR_MAX_JOBS jobs or when RSS passes the cap.DOC_RULES_VERSION are applied and counted (linora_compactor_rules_mismatch_total), not refused. ADR 0019’s deploy rule compacts before a bump, and refusing would block compaction forever.snapshot_seq-based counters computed by realtime: needs a realtime read of compactor state.