lmdb-reader-table · shipping · also LMDB reader lock table

LMDB reader table

The LMDB reader table records reader process, thread and transaction identities so page reclamation can respect active snapshots.

Related Observatory article: Read on hesela.com

In LMDB 0.9.33, mdb_find_oldest scans reader transaction IDs and allocation excludes free-list records that are too recent for that boundary. A live old snapshot can therefore delay reuse without holding the writer mutex. [3] A controlled experiment found that mdb_reader_check cleared zero slots and did not relieve the live-reader case; ending the reader allowed 64 more writes at the same map size. [4] A reset read-transaction handle is not an active snapshot; it must be renewed before reuse. [2]

Copy operations also hold read transactions. In a controlled pipe-stall test, reader checking did not release the live copying reader; write progress resumed after copy completion. Compact copying reduced destination size, not the source reader lifetime in that test. [6]

Process termination and reader-table cleanup are distinct. In the pinned POSIX implementation, stale-reader checking probes a process-associated byte-range lock, not kill(pid, 0). A controlled unreaped-child case cleared three entries belonging to one process; the reader list became empty while me_numreaders stayed at its high-water value of three. [3] [7]

The cleanup output counts cleared slots, not dead processes. A successful call can clear zero slots and leave a live snapshot blocking reuse; it is not a transaction-age timeout or a guarantee that the next write will succeed. [2] [7]

Relations

related
LMDB, Copy-on-write (storage), Checkpoint starvation

Limitations

  • Map capacity, reusable pages and live payload bytes are different quantities; these test counts are not universal thresholds. [4]

Citations

  1. LMDB 0.9.33 API: transaction lifetime, reset/renew, map capacity and reader checks (accessed 2026-10-16)
  2. LMDB 0.9.33 implementation: mdb_find_oldest, mdb_page_alloc and mdb_reader_check0 (accessed 2026-10-16)
  3. Hesela: controlled LMDB reader-lifetime experiment, complete results and limits (accessed 2026-10-16)
  4. Hesela: 24 controlled LMDB copy-backpressure observations, hashes and limits (accessed 2026-10-20)
  5. Hesela: 40 controlled LMDB reader-death and cleanup cases, method and limits (accessed 2026-10-22)

Further reading

  1. Howard Chu. MDB: A Memory-Mapped Database and Backend for OpenLDAP. LDAPCon 2011, sections 3.2 and 4.2. (accessed 2026-10-16)
  2. LMDB readers: a stable snapshot can exhaust a fixed map (accessed 2026-10-16)

JSON: /data/terms/lmdb-reader-table.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. LMDB reader table. Hesela. 2026-10-22. https://hesela.dev/terms/lmdb-reader-table/