Add opt-in LMDB map auto-growth with safe reopen/replay #10
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/tek9#10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add an explicit Tek9 setting that lets an LMDB environment grow its map capacity automatically instead of permanently failing when the configured map is exhausted.
Current
masterinspected:a9f5b595f5d965163d2b7c518c72a2efd9be13fe.Current behavior:
+default-map-size+is 16 GiB of virtual address space;new-databaseaccepts:max-size;open-databasepasses that value tolmdb:open-env :map-size;Proposed public configuration
Minimum API:
The implementation may expose additional bounded tuning only if needed, e.g. a growth factor and optional hard ceiling.
:auto-grow nilshould preserve the current fail-closed behavior.LMDB constraint
Do not attempt to resize an active LMDB transaction. The Common Lisp LMDB boundary changes map capacity when the environment is opened/reopened. A map-full write must unwind/abort first, then Tek9 may grow/reopen and retry the complete logical top-level write.
The retry boundary must reacquire LMDB DBI handles after reopen. Current write paths often cache a DBI before entering
with-database, so simply catchingLMDB-MAP-FULL-ERRORinsidecall-with-database-transactionand rerunning the same closure is not sufficient if that closure captured a now-stale handle.Required invariants
MDB_MAP_RESIZED/externally grown-map behavior is handled explicitly rather than interpreted as corruption;RED-first proof
Start with a deliberately small LMDB map and a write larger than the remaining capacity.
:auto-grow nil-> deterministic map-full failure and no committed partial mutation.:auto-grow t-> first attempt reaches map-full, Tek9 aborts it, grows/reopens the environment, reacquires DBIs, retries, and commits exactly once.Also cover an externally enlarged environment/reopen case so a second process does not remain stuck on stale map metadata.
Non-goals