strawberry/src/store
trvon 1c9b005645
store: incremental read-only refresh (fixes the tray spinning a core)
Root cause, from the Tracy capture the CPU watcher took when the tray spun
(2026-11-15 08:15, 67% for 15 s): database.reload_read_only rebuilt the whole
evidence view from every segment — mean 1.4 s, max 1.7 s, 4x in 20 s — because
every 3 s poll that saw the daemon append evidence triggered a full reload.

- store::scan_store_read_only_from + ReadCursor (per segment: id, sealed,
  bytes, records delivered). When the previously seen segments are an
  unchanged prefix (same ids, sealed ones byte-identical), only records
  appended since are delivered: the rest of the previously last segment
  (skipping what was applied) and new segments. Any other change —
  compaction, retention, reduction, a rewritten or shrunk segment — delivers
  everything and the caller rebuilds.
- Database read-only refresh uses it; records apply in the same order a full
  rebuild uses, so the view is identical. read_only_reload_counts() reports
  full vs incremental refreshes.

Live, on the real evidence store: the change-driven reload went from ~1.4 s
to 2.8 ms; the tray did ~97 ms of work in a 60 s window.

Test (test_incremental_view, seeded property): a long-lived reader
refreshing across random appends, upserts, seals and a compaction always
equals a freshly opened reader; appends refresh incrementally (42-49 per run),
the compaction forces a rebuild, and no change reports no change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:46:00 -07:00
..
codec.cpp Build on macOS: portable syscalls, sockets and tray 2026-10-27 09:54:54 -06:00
evidence_records.cpp Add doctor checks and maintenance actions to the daemon 2026-10-27 09:27:23 -06:00
evidence_records.hpp Add doctor checks and maintenance actions to the daemon 2026-10-27 09:27:23 -06:00
evidence_view.cpp Add doctor checks and maintenance actions to the daemon 2026-10-27 09:27:23 -06:00
evidence_view.hpp Add doctor checks and maintenance actions to the daemon 2026-10-27 09:27:23 -06:00
legacy_import.cpp Forbid empty catch blocks 2026-10-25 18:52:45 -06:00
legacy_import.hpp Drop unqlite-cpp and import legacy databases 2026-10-25 18:46:21 -06:00
legacy_kv.cpp Forbid empty catch blocks 2026-10-25 18:52:45 -06:00
legacy_kv.hpp Drop unqlite-cpp and import legacy databases 2026-10-25 18:46:21 -06:00
legacy_unqlite.cpp Drop unqlite-cpp and import legacy databases 2026-10-25 18:46:21 -06:00
legacy_unqlite.hpp Drop unqlite-cpp and import legacy databases 2026-10-25 18:46:21 -06:00
log_store.cpp store: incremental read-only refresh (fixes the tray spinning a core) 2026-11-15 08:46:00 -07:00
manifest.cpp Add the store's disk floor, retention, verify and compact 2026-10-26 06:19:29 -06:00
segment.cpp Forbid empty catch blocks 2026-10-25 18:52:45 -06:00