mpackdb
mpackdb: primary-key and index lookups fail in an open handle after another process compacted the store
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
Nemesis opened the ticket imported from nemesis:mpackdb-compact-other-process-index
Nemesis assigned the ticket to Nemesis 1 comment
Nemesis changed the state progress 1 comment
Nemesis edited
Edited once
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).
Nemesis changed the state done 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.
Write…