perf(core): read small store files into owned memory at open #7373
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #7373"
general
weight: 0.35
jeswr
<!-- claude-projects-attribution: {"github_login":"jeswr"} -->
_Requested by Jesse · project thread_
Addresses #7188.
Addresses #7370.
Summary
Small persisted dictionary sections, caches and permutations are now read into owned memory through a shared internal opener; larger files stay mapped. Owned data is decoded as typed little-endian values, so alignment is never an issue. Dictionary and compressed-index validation is shared by both backings, and a fully mapped dictionary still passes direct byte views to that shared validator.
The size cutoff is internal and is set from the native resource-slot file size distribution. Owned memory counts toward heap accounting. Ownership pins, fork sharing, persisted bytes and persistence ordering are unchanged. The data-formats skill is updated, and the Miri lane now covers the owned path. Test scratch directories skip existing paths and leave their contents alone.
An internal compiler cfg selects mapped or owned backing for the whole test suite, including integration tests that link the library outside its unit-test build. Only the threshold helper reads it, and the thread-local test override takes precedence. Owned mode uses the largest addressable size with a saturating read limit. The numeric and temporal caches no longer repeat a length check, because the shared opener already enforces it.
A new matrix job in
ci-fastruns the complete core storage suite once per backing mode on every workflow trigger. It has no path filter or conditional skip, and it is not a dependency of the required aggregator. Existing jobs, triggers and the required verdict are unchanged.Base gate (always required)
cargo clippy --workspace --exclude sparq-py --all-targets -- -D warnings: passed.cargo test -p sparq-core: passed.cargo test -p sparq-core --features mmap,dict-spill, once withRUSTFLAGS='--cfg sparq_backing="mapped"'and once withRUSTFLAGS='--cfg sparq_backing="owned"': passed, including unit tests, integration tests and doctests. Each mode used its own temporary target directory, removed afterwards.cargo test -p sparq-core --no-default-features --features mmap: passed on the initial implementation.cargo test -p sparq-lws-coreand its--no-default-featuresvariant: passed. The remote HTTP adapter is unchanged.RUSTDOCFLAGS="-D warnings" cargo doc -p sparq-core --no-deps --all-features: passed.Targeted re-evaluation (check the rows that apply to your change)
git diff --check.Existing mapped-path guards are kept, with the mapped path now selected explicitly:
open_recomputes_an_unversioned_numerics_cache: stale-cache recomputation, and that a current cache is mapped when the mapped path is forced.save_open_mmap_roundtrip: term, numeric and temporal values through the mapped path.has_high_precision_decimal_memo_mapped_wal_precision: precision classification across mapped reads, logged updates and compaction.compressed_save_open_roundtrip: raw mapped references against lazy and eager compressed scans and estimates.Tests and executed mutation checks are listed below. Each mutation is a token change at the named source location, and each was restored. The decoder and replay mutations are caught by test assertions, which replaces earlier evidence that relied on a decoder panic. Mutant tests ran normally, and the restored owned-open test also ran under Miri.
| Test | Contract checked | Minimal source mutation | Observed failing assertion |
|---|---|---|---|
|
scratch_paths_do_not_reuse_existing_directories| A stale scratch directory is left alone and a fresh path is chosen. | Replace the existing-pathcontinuebranch withreturn Self(path). | The selected-path equality assertion fails. ||
build_selection_and_override| The compiled selection decides the actual backing for empty, small and above-cutoff files; bytes agree; the maximum and nested mapped overrides work and restore correctly. | At theopen_filecall site, replace thethreshold()argument withSMALL_FILE_BYTES; separately, make that replacement apply only to small files. | In the mapped-mode run, the backing-kind equality fails withbuild selection ignored for file length. Both mutations were restored and the test passed again. ||
threshold_boundaries_and_empty| Empty files and files exactly at the cutoff get the correct backing, with bytes preserved. | Change<=to<in the size-selection predicate. |wrong backing at boundary||
changed_size_is_bounded_and_refused| A file that grows (within or beyond the cutoff) or shrinks to empty between stat and read is refused; reads stop at the bounded sentinel. | Replace the size-change predicate with a beyond-cutoff-only predicate; separately, replaceread_limitattakewith the integer type'sMAX. |changed-size file was accepted; the read mutation failsread exceeded its bound. ||
mapping_failure_names_limit| A mapping error carries its typed diagnostic; other errors keep their kind. | Replace the mapping-error classification predicate withfalse. | The error-kind equality assertion fails. ||
owned_and_mapped_graphs_match| Expected source and replayed rows, dictionary lookup, caches, every binding pattern, forks, saved bytes and heap accounting agree across backings. | In the dictionary hash decoder, replacefrom_le_byteswithfrom_be_bytes. | Dictionary lookup equality fails: an absent ID where the expected ID should be. ||
owned_open_miri| Owned dictionary, raw and compressed permutations, numeric and temporal caches, and forks round-trip under Miri. | The same hash-decoder replacement. | Dictionary lookup equality fails. The restored test passed under Miri. || Both owned differential tests | Numeric decoding preserves values and missing cache entries. | In the numeric cache decoder, replace
from_le_byteswithfrom_be_bytes. |numeric cache changed||
owned_and_mapped_graphs_match| Recovery applies the expected insertions and deletions. | Replace WAL replay iteration with an empty iterator. |replay changed rows||
small_corruption_matches_mapped_errors| Both backings return the same errors for malformed dictionary and compressed files. | Remove theMappedDict::validatecall. |corruption was accepted||
tiny_slots_hold_no_file_mappings| Reopened tiny slots hold no file mappings, before or after durable compaction. | Replace the size-selection predicate with an empty-file-only predicate. |small slots retained file mappings|Ratchets and conventions
🤖 Generated with Claude Code
https://claude.ai/code/session_01JLKBH5gHei9rJAmvhNgZyi