Linora

0312. Compact soon after deletes: tail_deletes and a delete rule for large snapshots

Status: 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.

Context

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):

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:

Decision

Alternatives

Consequences