Commit d903bed2 authored by Hallvard Furuseth's avatar Hallvard Furuseth
Browse files

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.
parent 6b56e0fa
......@@ -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;
}
......
......@@ -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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment