tail_deletes and a delete rule for large snapshotsStatus: Accepted (2026-11-29). Extends the claim rules of 0703 and the thresholds of 0010. The new counter follows the exact, signed, quiet-reconciled scheme of 0705. Migration 0005_tail_deletes.sql.
On the prod-like stack a user generated a site (9 CREATE_BULK batches, 36 MB) and then deleted everything. Each reload of that page spent about a second in “Connecting…” and “Syncing…” even though the page was empty. The page row (page 6ca1ffb1):
snapshot_seq 101 with 659,941 nodes: 6.18 MB gzip, 37.2 MB raw. head_seq 107.A DELETE removes each listed node with its whole subtree, so a tail of a few kilobytes can remove almost the entire snapshot. The claim rules measure only the tail’s size: 20,000 ops, 4 MiB, or a first uncompacted row older than 10 minutes. So the page waited for the age rule. It was compacted at 20:50:40, 10 minutes and 2 seconds after its first delete. Until then every open:
Headless Chrome on the same stack, with a 618K-node snapshot and the same select-all delete in the tail: “Connecting…” until about 1.0 s, “Syncing…” until 1.5-1.6 s. After compaction the page was a 38-byte snapshot with no tail.
Other causes were measured and ruled out:
e4e7ca6b (783 KB, 310 live nodes).node_count counts live nodes only: it went from 659,941 to 1 after compaction.compactor-large (ADR 0311) claimed the page as soon as the age rule let it.pages.tail_deletes. It counts accepted DELETE ops since snapshot_seq (migration 0005, which adds the column and grants UPDATE to linora_realtime and linora_compactor).
ReplayStats.deletes) and subtracts exactly that, in the same compare-and-swap statement as tail_ops/tail_bytes. Quiet pages and clearTail set it to 0 (ADR 0705).OR in the same single statement). A page qualifies when all of these hold:
tail_deletes > 0;node_count >= LINORA_COMPACTOR_DELETE_MIN_NODES (default 20,000). This is the snapshot’s node count, which is what a loader pays for. 20,000 matches the tail_ops threshold: a stale snapshot that size costs a loader about what a 20,000-op tail would;last_op_at older than LINORA_COMPACTOR_DELETE_QUIET_S (default 2 s), so the job runs when the user stops, not in the middle of a burst;LINORA_COMPACTOR_DELETE_INTERVAL_S, node count x LINORA_COMPACTOR_DELETE_INTERVAL_US_PER_NODE µs). The defaults are 5 s and 15 µs/node, checked with a primary-key probe of page_snapshots. A job costs about 1.5 µs per node, so delete-driven jobs use at most about 10% of one compactor per page. The interval is 10 s at 660K nodes and 120 s at 8M nodes. A fixed 30 s was tried first: on the stack, a delete 8 s after generating a site (whose last compaction ran during generation) was still uncompacted 20 s later.apps/docworker/test/compaction.test.ts “delete rule”: a 1,241-node snapshot and one DELETE (under 1 KB) is not claimed while edits continue, while the snapshot is younger than the interval (also when the per-node term sets it), or below the node floor. It is claimed once quiet, while a control page with a SET tail is not. The compactor loop then leaves it at 1 node with every counter at 0. The test fails without the rule.test/tail-counters.test.ts: the property test for commuting counters now covers tail_deletes, including the quiet reconcile.test/roles.test.ts: the column grants.apps/realtime/test/durability.test.ts: only accepted DELETEs are counted.