LMDB reader table
The LMDB reader table records reader process, thread and transaction identities so page reclamation can respect active snapshots.
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] Our 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]
Relations
- related
- lmdb, copy-on-write, checkpoint-starvation
Limitations
- Map capacity, reusable pages and live payload bytes are different quantities; these test counts are not universal thresholds. [4]
Citations
- Howard Chu. MDB: A Memory-Mapped Database and Backend for OpenLDAP. LDAPCon 2011, sections 3.2 and 4.2.
- LMDB 0.9.33 API: transaction lifetime, reset/renew, map capacity and reader checks
- LMDB 0.9.33 implementation: mdb_find_oldest, mdb_page_alloc and mdb_reader_check0
- Hesela: controlled LMDB reader-lifetime experiment, complete results and limits
- LMDB readers: a stable snapshot can exhaust a fixed map