[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#7672) LMDB: mdb_dbi_flags fails with newly created DataBase
- To: openldap-its@OpenLDAP.org
- Subject: (ITS#7672) LMDB: mdb_dbi_flags fails with newly created DataBase
- From: sog@msg.com.mx
- Date: Sat, 24 Aug 2013 04:15:03 GMT
- Auto-submitted: auto-generated (OpenLDAP-ITS)
Full_Name: Salvador Ortiz
Version: 24
OS: Linux
URL:
Submission from: (NULL) (187.162.45.111)
Using mdb_dbi_flags with newly created database fails or lies.
In the case of MAIN _DBI, if I set some flags in mdb_dbi_open, the flags isn't
propagated to the environment, I think the fix is simple:
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -7881,6 +7881,7 @@ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned
int flags, MDB_dbi *db
/* make sure flag changes get committed */
if ((txn->mt_dbs[MAIN_DBI].md_flags | f2) !=
txn->mt_dbs[MAIN_DBI].md_flags) {
txn->mt_dbs[MAIN_DBI].md_flags |= f2;
+ txn->mt_env->me_dbflags[MAIN_DBI] =
txn->mt_dbs[MAIN_DBI].md_flags;
txn->mt_flags |= MDB_TXN_DIRTY;
}
}
But in the case of a newly created named database, env->me_numdbs isn't adjusted
until the transaction is committed, so mdb_env_flags fails.
The more that I think about it, seems that the proper way to get the flags of an
opened db is with a new API, something like:
int mbd_get_flags(MDB_txn *, MDB_dbi dbi, unsigned int *flags)
{
if (txn == NULL || arg == NULL || dbi >= txn->mt_numdbs)
return EINVAL;
*flags = txn->mt_dbflags[dbi];
return MDB_SUCCESS;
}
Comments?