On 27. mai 2016 12:57, juerg.bircher@helmedica.com wrote:
mdb_dbi_open() is however not improved with the assumption that the database handle (dbi) is cached in the application. So mdb_dbi_open() should happen only once for each database during the life time of an application.
It must check if the DB is open anyway, since LDMB breaks if the user has two DBIs to the same DB. Though maybe we could add an optimization flag to skip the search, for users who know they don't reopen open DBs.
Other notes:
LMDB and OpenLDAP mostly use tab-width = indentation = 4. (We should comment that somewhere.) You seem to use tab-width = 8.
I think MDB_WORD intends to be mdb_size_t, but should be 'unsigned long': It's probably no optimization to use 'long long' when that is not a native integer type. But I haven't profiled that.
The delay in picking up env->me_dbflags is a bit troubling, since it means creating a new txn is no longer quite atomic. I can't think of how it'll make a difference when DBIs are used correctly, but that's one thing people screw up. Maybe it'd be OK if renew0() just copies it into mt_dbs[].md_flags without the '&', and mdb_setup_db_info() fixes it up.