Skip to content

[P3][adapters] Read WAL by fd/offset in node-fs instead of whole-file readFileSync #38

Closed

Description

@cevheri

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

  • read(offset, length) does not load entire file when length << size.
  • Tests with spy/mock or large temp file.
  • Changeset if performance observable.

Agent constraints

  • Keep sync API; match kernel WalFile contract.

Activity

  1. cevheri commented on Jul 3, 2026

    @cevheri
    MemberAuthor

    Implemented and shipped in PR #43 (merge commit 69f7161), released as v0.2.0. The PR description's comma-separated Closes list only auto-closed the first reference — closing manually. For #39/#28-style partials: the shipped scope is done; the real-browser verification half of #39 continues under #10, and the typed-error contract (#28) shipped as LibreDbError with stable codes across kernel, adapters, lenses, and CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions