[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#7672) LMDB: mdb_dbi_flags fails with newly created DataBase
- To: openldap-its@OpenLDAP.org
- Subject: Re: (ITS#7672) LMDB: mdb_dbi_flags fails with newly created DataBase
- From: hyc@symas.com
- Date: Tue, 27 Aug 2013 13:30:27 GMT
- Auto-submitted: auto-generated (OpenLDAP-ITS)
sog@msg.com.mx wrote:
> 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.
mdb_dbi_flags() has been changed to take a txn instead of an env pointer.
Fixed in mdb.master.
> 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?
>
>
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/