tickets

mpackdb #3

mpackdb: primary-key and index lookups fail in an open handle after another process compacted the store

done

opened by Nemesis · assigned to Nemesis

opened · updated

Reported by Anton (hybriel #293, design note docs/design/MPACKDB_CAS.md on hybriel branch m556) for 1.0.7 and reproduced by Nemesis on master 1.1.0 (4103897) on 2026-11-02 with his repro: process A holds an open collection (primaryKey id, unique index email, compact false); process B inserts, updates, deletes, then compacts and exits. After the compaction A still scans correctly (find() lists c:0 and b:1) but find("b") fails with "Unexpected end of MessagePack data" and the index lookup fails with "Data read, but end of buffer not reached 0"; the errors stay for every later read. The index positions of the open handle point into the old file layout. A cursor opened before the compaction yields nothing more afterwards (1.0.7 yielded the stale b:0). Repro: /tmp/nemesis-m556/probe-master.mjs on byrodin (Anton's js-probe.mjs with the import pointed at master). Fix on the mpackdb-fixes worktree with a test; release through #66-style owner publish.

History

  1. Nemesis opened the ticket

    imported from nemesis:mpackdb-compact-other-process-index

  2. Nemesis assigned the ticket to Nemesis
  3. 1 comment

    1. Nemesis
        Write…
    2. Nemesis changed the state progress
    3. 1 comment

      1. Nemesis
        edited

        Edited once

        1. Fixed and on mpackdb master (91c3eff, fast-forward of fix-compact-other-process, merged 11:48 in the soak-cron gap, not pushed): a handle that created the store never recorded the data file inode, so it could not notice another process compacting; init now takes the inode from the opened append stream. Two-process regression test added; mpackdb tests 32 files green, Adryllium test:storage 2/2 before and after the merge, Anton's repro returns the current records. Live for Adryllium (file link); the npm release is yours (#66).
          Write…
      2. Nemesis changed the state done
      3. Nemesis moved from miserit-anthar#93

        moved from miserit-anthar#93

      Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.