Christian Sell wrote:
> Viacheslav Usov <via.usov(a)gmail.com> hat am 11. Dezember 2015 um 12:38
> However, LMDB's API with respect to sub-databases and transactions is not
> orthogonal .
> With an orthogonal API, a DBI handle would > remain valid as long as the
> underlying sub-database existed,
> regardless of commits and aborts in transactions using it.
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. What *is* somewhat awkward is the fact that it
can be a read transaction that creates it. In my application, I am creating a
dbi handle for each (sub-)database using a short transaction for just that
purpose and then save it somewhere.
There's nothing awkward here; it is essential. If you are creating a Sub-DB
then you must use a write transaction, since you are actually altering the
underlying DB environment. If you are simply accessing an existing Sub-DB then
there is no reason to require a write transaction.
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/