Opt-in non-retaining streaming read path (single-pass residency, no FileCache retention) #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Surfaced by aura issue Brummel/Aura#95 (process-residency deep-dive).
Finding
FileCache(src/cache.rs) retains every touched file's parsed chunks(
HashMap<FileKey, Arc<Vec<Arc<[M1Parsed]>>>>, keyedsymbol/year/month/format)for the whole streaming pass — the only eviction is
release_symbolwhen asymbol's refcount hits 0 (run end). A
SymbolChunkIterholds aSymbolGuardfor its lifetime, so a single long forward pass keeps refcount ≥ 1 throughout and
nothing is evicted behind the cursor.
Consequence: a single sequential pass over a multi-year window resides
O(records-touched) ≈
records × sizeof(M1Parsed)=56 B. Measured (GER40 M1, onesymbol): VmHWM 6 MiB (1 month) → 173 MiB (~10 years), linear. This is correct
and desirable for the replay-many access pattern (many sims sharing one fixed
window: load-each-file-once,
close+volumesharing one parse via thefield-agnostic
FileKey). It is only wasteful for a lone forward pass that neverrevisits a file.
Why no always-on fix
The retention is the replay-many optimization. Any unconditional evictor that
bounds a single pass to O(one file) must drop files while a reference is still
live — exactly what cross-sim sharing depends on. Cursor-aware per-file eviction
and a bounded LRU both re-load a file a lagging sim still needs, breaking the
load-once (
loads) invariant. So single-pass and replay-many residency policiesmust be distinguished by intent, never unified under one always-on policy.
Proposed (only if a genuine single-pass-over-decades consumer appears)
An opt-in non-retaining streaming read path: a second iterator/entrypoint
that does NOT insert into the shared
FileCache— load file N, hand out itschunks, drop them on advance to N+1 (the consumer's held chunk
Arcs boundresidency to one file). The existing caching
stream_m1_windowedpath(load-once, cross-field
FileKeysharing,SymbolGuardrefcount eviction) staysbit-for-bit unchanged; the single-pass caller (aura's
M1FieldSource) opts in,replay-many keeps the retaining path.
Parked as
idea(no commitment): aura's World is replay-many, which wants theretention; the leak only bites the currently-unused single-pass pattern. Promote
to
featureif a single-pass-over-decades consumer lands on the roadmap.On the aura side, #95 is resolved by narrowing the docs from a (false)
whole-process O(one-chunk) claim to the true per-source-ring property.