[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (LMDB) read-only transactions and DBI handles

>> as I understand it (and am practicing it), the dbi is created by one
>> transaction and remains 
>>valid after that transaction commits until it is either explicitly closed or
>>the environment dies.
> If that is indeed the case, then my previous messages were based on a
> misunderstanding. I hope 
> Howard can confirm this. Unfortunately, the documentation is confusing with
> respect to this point.

there is documentation on this very matter, indeed. Here's an excerpt from the
documentation of the mdb_dbi_open function:

A database handle denotes the name and parameters of a database, independently
of whether such a database exists. The database handle may be discarded by
calling mdb_dbi_close(). The old database handle is returned if the database was
already open. The handle may only be closed once.

The database handle will be private to the current transaction until the
transaction is successfully committed. If the transaction is aborted the handle
will be closed automatically. After a successful commit the handle will reside
in the shared environment, and may be used by other transactions.

This function must not be called from multiple concurrent transactions in the
same process. A transaction that uses this function must finish (either commit
or abort) before any other transaction in the process may use this function.