|Subject:||Database/Transaction dependency is unclear|
It looks to me like the lifetime of a DB handle is bounded by the lifetime of a transaction. Which means a typical app that just grabs a DB handle once is performing all of its operations inside a single transaction. Or alternatively, if an app explicitly commits a txn, it must obtain a new DB handle when it obtains a new txn. I may have misunderstood the code, but that is definitely not how it should work. DB handles are meant to be long-lived - once the txn in which a DB handle is created has committed, the DB handle is valid for the lifetime of that environment. (It may be explicitly closed sooner, using mdb_dbi_close, but generally there is no good reason to do so.) Currently as I read it, you return [db,txn] pairs and the put/get ops will fail in _chkalive if the txn isn't currently valid. I see no way to associate a new txn to an existing DBI. Also, it appears that you support only a single txn at a time, while LMDB itself supports 1 write txn and arbtirarily many read txns concurrently. Is that right?