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.
vmware
Hallvard Furuseth 12 years ago
parent 6b56e0fab1
commit d903bed218
  1. 2
      libraries/libmdb/mdb.c
  2. 8
      libraries/libmdb/mdb.h

@ -2579,7 +2579,7 @@ mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs)
{ {
if (env->me_map) if (env->me_map)
return EINVAL; return EINVAL;
env->me_maxdbs = dbs; env->me_maxdbs = dbs + 2; /* Named databases + main and free DB */
return MDB_SUCCESS; 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); 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 * This function is only needed if multiple databases will be used in the
* environment. Simpler applications that only use a single database can ignore * environment. Simpler applications that use the environment as a single
* this option. * unnamed database can ignore this option.
* This function may only be called after #mdb_env_create() and before #mdb_env_open(). * 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] env An environment handle returned by #mdb_env_create()
* @param[in] dbs The maximum number of databases * @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 * database handle resides in the shared environment, it is not owned
* by the given transaction. Only one thread should call this function; * by the given transaction. Only one thread should call this function;
* it is not mutex-protected in a read-only transaction. * 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] txn A transaction handle returned by #mdb_txn_begin()
* @param[in] name The name of the database to open. If only a single * @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. * database is needed in the environment, this value may be NULL.

Loading…
Cancel
Save