Skip to content

Proposal: reduce unnecessary day-file locks for single-row mutations #215

Closed

Description

@WhollyMindless

Problem

Single-row store mutations lock and read every day file, so their cost grows linearly with store age. WM measured on a synthetic store (30 day files × 10 rows, medians of 5): loadAll 4.6 ms, but superseding ONE row 116 ms, of which ~113 ms is the lock sweep itself. Maintainer ruling 2026-11-04: accept now, do not wait for a bigger store.

Fix direction

markManySupersededReport (src/store/files/supersede.ts:56) and the sibling paths clearSuperseded, releaseQuarantine and prune resolve the target rows first — a row's ts carries its day file — then lock and rewrite only the files that actually contain a match. Files with no matching key are neither locked nor read. Locking semantics per touched file are unchanged: refuse-on-contention stays.

Acceptance

  • RED: scenario test on a synthetic 30-day-file store — instrument lock acquisitions (counter or spy) and supersede one row: every day file is locked. Fails on main for exactly that reason.
  • GREEN: exactly the one containing file is locked and rewritten; wall time for the single-row supersede drops to within 5× loadAll on the same fixture; contention refusal on the touched file still refuses (one existing or new test pins it).
  • No existing assertion weakened; bun run typecheck && bun run lint && bun run test green; bun run test:e2e since src/ changed.

Activity

  1. added
    enhancement
    bench
    severity:low
    agent:ready
    on Nov 1, 2026
  2. ocsi-triager commented on Nov 3, 2026

    @ocsi-triager

    osi-spec-hash: f7363bcd12362cae 2026-11-03T22:38:37Z - acceptance criteria frozen at this text. A later edit to the body changes this hash, and the reviewer will withhold approval until a maintainer replies spec ok.

  3. added
    agent:ready
    and removed
    agent:ready
    on Nov 4, 2026
  4. abogartz commented on Nov 5, 2026

    @abogartz
    Owner

    Spec moved after the ready-anchor: f7363bcd12362cae -> 336e229031c394f2. The reviewer will not approve on the old contract.

  5. abogartz-opencode-self-improvement commented on Nov 9, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.21.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  6. abogartz commented on Nov 9, 2026

    @abogartz
    Owner

    Landed on main in e10a550 (PR #373, approved at e67b12b). 365-day fixture: supersede one row median 1.4 ms vs 74.8 ms on d0929a6.

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

    agent:readybenchenhancementreleasedseverity:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions