CODE-052: the sweep keeps dog's ~<owner> crashed-writer memtables forever

Now
OPEN
Sev
MED
Rep
///bee
Ask
gritzko
Rev
///bee#8cb69a0
See
DOG-046
See
BEE-002

Input

Context

dog/DOG.h:775 (DOG-046) leaves a crashed writer's memtable as <dir>/~<10-RON64-owner><ext> and says its owner, bee's sweep, reaps it. index/index.js:387:Wt hasExt matches the suffix and therefore KEEPS it. Every killed or ^C'd bee index leaves one per open handle: five in /src/linux/.git/be (4 KB default-page ones), two in /src/git, and a tri handle opened at TRI_MEM_ROWS = 1<<20 leaves a 4 MB one. Readers ignore them (count 0), so this is a pure, unbounded leak. Found in the 2026-09-18 index review.

Goals

sweep unlinks any entry whose basename starts with ~. Unlinking a live one is harmless: the owner keeps its mapping and still seals a real run.

WIP

Design decisions

  1. The ~ test lives in sweep, not in hasExt: the suffix says "live format" for a sealed run and for a memtable alike, and only the sweep has to tell the two apart.
  2. ANY ~ entry goes, whatever its extension — the dir is bee's own derived state and dog names nothing else so.
  3. The repro PLANTS the three DOG-046 names rather than killing writers: a kill is timing-bound, the name is the contract, and the real orphans are in ~/src/linux/.git/be.

TODOs

Blockers and bummers

Outcome