From: Hallvard Furuseth Date: Tue, 27 Nov 2012 22:56:47 +0000 (+0100) Subject: API change: mdb_env_set_maxdbs(, *named* DBs). X-Git-Tag: OPENLDAP_REL_ENG_2_4_34~103^2~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d903bed218ce19c4ef2e95ec9560169512212747;p=openldap API change: mdb_env_set_maxdbs(, *named* DBs). Let the user specify the number of databases he will actually use. Adding 2 for FREE_DBI and MAIN_DBI is an internal matter. --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index d760387ff4..4af54aa688 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -2579,7 +2579,7 @@ mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs) { if (env->me_map) return EINVAL; - env->me_maxdbs = dbs; + env->me_maxdbs = dbs + 2; /* Named databases + main and free DB */ return MDB_SUCCESS; } diff --git a/libraries/libmdb/mdb.h b/libraries/libmdb/mdb.h index e314595633..bb0ca307bb 100644 --- a/libraries/libmdb/mdb.h +++ b/libraries/libmdb/mdb.h @@ -607,11 +607,11 @@ int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers); */ int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers); - /** @brief Set the maximum number of databases for the environment. + /** @brief Set the maximum number of named databases for the environment. * * This function is only needed if multiple databases will be used in the - * environment. Simpler applications that only use a single database can ignore - * this option. + * environment. Simpler applications that use the environment as a single + * unnamed database can ignore this option. * This function may only be called after #mdb_env_create() and before #mdb_env_open(). * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] dbs The maximum number of databases @@ -718,6 +718,8 @@ int mdb_txn_renew(MDB_txn *txn); * database handle resides in the shared environment, it is not owned * by the given transaction. Only one thread should call this function; * it is not mutex-protected in a read-only transaction. + * To use named databases (with name != NULL), #mdb_env_set_maxdbs() + * must be called before opening the enviorment. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] name The name of the database to open. If only a single * database is needed in the environment, this value may be NULL.