Summary
node-fs adapter reads via readFileSync(path) on every read() call — whole file into memory. At open(), recovery reads entire WAL → transient 2× memory. Uses path not fd — wrong inode if path swapped mid-session (edge case).
Audit ID: Section 4 Low — Wave 3
Related: #12 compaction (large files amplify cost)
Fix direction
- Read via
fd + readSync at offset/length.
- Optional: mmap-style single buffer cached on WalFile for session.
Acceptance criteria
Agent constraints
- Keep sync API; match kernel
WalFile contract.
Summary
node-fsadapter reads viareadFileSync(path)on everyread()call — whole file into memory. Atopen(), recovery reads entire WAL → transient 2× memory. Uses path not fd — wrong inode if path swapped mid-session (edge case).Audit ID: Section 4 Low — Wave 3
Related: #12 compaction (large files amplify cost)
Fix direction
fd+readSyncat offset/length.Acceptance criteria
read(offset, length)does not load entire file when length << size.Agent constraints
WalFilecontract.