Wietse Venema writes:
Why do you talk about map size changes when I delete a database entry??
That's how Postfix uses lmdb. It calls mdb_env_set_mapsize(). Looking closer though, this is in src/util/slmdb.c which is by Howard and you. Sounds like we should wait for whatever Howard has to say.
I need a software abstraction layer between Postfix and LMDB that provides the following generic interface that is independent of LMDB internals: (...snip...)
It does, normally. NOLOCK and map resizing interfere, and impose notable limitations.
Sofar the abstraction layer already hides the LMDB-specific MAP_FULL and MAP_RESIZED error conditions. If this abstraction layer needs additional code in order to maintain MDB cursor sanity, then please educate me.
ldmb.h says --
mdb_env_set_mapsize(): "It may be called at later times if no transactions are active in this process. Note that the library does not check for this condition, the caller must ensure it explicitly." MDB_NOLOCK: "[caller] must ensure that no readers are using old transactions while a writer is active. The simplest approach is to use an exclusive lock so that no readers may be active at all when a writer begins."
That's why I talked about saving the cursor position and restoring it - cursors are per-transaction and you need a new transaction.
Maybe you should have a single write-transaction with several cursors, instead of several transactions. That also cures the "long-lived reader" problem.
Howard, maybe NOLOCK should keep the reader table and just drop the locks? More work though.