[Date Prev][Date Next]
writing about lmdb semantics, need some help
First, thank you for developing openldap & lmdb, both are appreciated. I ran
openldap 'way back in the day' to power one of the first cable internet
providers in The Netherlands, and once we shook out the bugs, it was great!
Within PowerDNS, we have an LMDB backend for the highest performance, and we
also want to use it for Metronome (https://github.com/ahupowerdns/metronome
, a sort of mini-graphite).
In order to do so, I'm documenting LMDB semantics. The LMDB documentation
has most of this, but I'd like to get the semantics in one place.
( https://github.com/ahupowerdns/ahutils/blob/master/lmdb-semantics.md - with
some great help from Howard already)
A few questions:
* - Do not have open an MDB database twice in the same process at
* the same time. Not even from a plain open() call - close()ing it
* breaks flock() advisory locking.
I see this note, but I also see a lot about TLS locking. Is this remark
still true? It is quite difficult for many applications to effectively
serialize LMDB access this way, which would be required because:
* - A thread can only use one transaction at a time, plus any child
* transactions. Each transaction belongs to one thread. See below.
* The #MDB_NOTLS flag changes this for read-only transactions.
I note that the source does not actually use flock() but fcntl()-based
locking, which does have the problem described above.
So my question, if there is one process with many threads that need to read
and update an lmdb, what is the recommended way to do that, short of
single threading the access to lmdb?