Sorry for the late reply, I was on vacation.
"I am still unsure what you are trying to achieve. If you are in a read transaction and discover that your database does not exist, what can you do anyway? You cannot create the database at this point, since it is a write operation."
When I discover a dbi does not exist in a read transaction, I can assume it to be the same as a dbi which is empty and create it when and only when there is a write-request into that dbi later.
"If you want to use dbi_open in multiple threads then put it in your own wrapper function, protected by a mutex."
This defeats the whole purpose of parallel reads.
"Anyway, just forget about being clever with DBIs. LMDB does not support DBI cleverness"
There is nothing clever about opening a dbi on the fly. Its a normal requirement especially when the database handles multiple clients.
Imagine a server database listening in on clients.
The server issues a write request from Client A and dbi_open ABC and is about to write data.
At the same time in another thread, it issues a read request from Client B to the same dbi ABC but is
unable to dbi_open ABC.
Isn't this scenario one of the basic requirements of a database listening in on clients.