Repository navigation
Description
Evidence
On current main, EventStore::open_with runs recover_device_ops inside a write transaction during every store open (pkgs/id/crates/id-events/src/event_store/mod.rs:449-455). The one-time recovery helper in event_store/ingest.rs:140-156 collects every EVENTS row into Vec<Event> and every waiting row into another Vec<Event> before scanning. It then accumulates all missing device-op rows in a third Vec (:156, :178-185) before writing any of them. EVENTS is persistent historical state; there is no global row-count cap, and pruning is explicit (EventStore::prune_behind_cut). Thus an upgrade of a large but valid store has temporary memory proportional to its entire history while holding the startup write transaction, and can stall or OOM before the store opens.
The recovery is being added by open PR #11283 as part of #8160. That PR provides the right recovery semantics but retains this whole-store materialization; this issue tracks the independent memory-bound requirement and should be cross-linked, not treated as a duplicate.
Why it matters
A large long-lived store, especially one that has not pruned old events, can require multiple copies of its history in memory during the one-time upgrade. The failure occurs on open, so affected users may be unable to start the store to recover or prune it.
Acceptance criteria
- Recovery scans stored and waiting rows without retaining all decoded events simultaneously; any staging is bounded by a documented fixed batch/size limit (or equivalent constant-space approach).
- Preserve the existing verified-body check, idempotence, recovered count, and incomplete-recovery warning/report.
- Add a test with a large synthetic legacy store that exercises recovery across multiple batches and proves every eligible operation is recovered, missing bodies are reported, and restart does not duplicate rows.
- Keep recovery transactional or document and test a safe resumable strategy if bounded batching requires multiple transactions.
Activity
developing-today commentedon Nov 17, 2026
CODE-4107
Merge pull request #11432 from developing-today/fix/11299-stream-devi…