ADR-0020 — Head rows for threads only upstream wrote
- Status: Accepted
- Date: 2026-11-13
- Supersedes: none
- Authors: project maintainers
Context
The fence and expiry live in a head row per thread (opc_thread_head). A database adopted in place
already holds threads upstream's saver wrote, and during a rolling deploy upstream's replicas keep
creating threads that have no head row.
Decision
setup() will backfill a head row for each existing thread. A thread upstream creates later gets
one on our first put or put_writes to it.
Alternatives considered
- Each sweep also finds threads with no head row — rejected: a scan of
checkpointson every sweep. - Never expire threads with no head row — rejected: an adopted database would keep its old threads forever.
Consequences
setup()on a large database runs a one-offINSERT … SELECT DISTINCT thread_id.- Adopted threads expire
idle_forafter adoption unless written. - A thread upstream created that nothing of ours ever touches does not expire.
References
- fence-and-expiry.md §3.1,
tests/integration/test_fence_expiry.py