From: Hallvard Furuseth Date: Sat, 16 Feb 2013 18:06:28 +0000 (+0100) Subject: Add error code MDB_MAP_RESIZED. X-Git-Tag: OPENLDAP_REL_ENG_2_4_34~3^2~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7aba5f5ab92a3fa92de001edb2c5ff4b04fd7d0d;p=openldap Add error code MDB_MAP_RESIZED. --- diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index 7719e3294a..aaaa2922f1 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -353,7 +353,9 @@ typedef enum MDB_cursor_op { #define MDB_CURSOR_FULL (-30787) /** Page has not enough space - internal error */ #define MDB_PAGE_FULL (-30786) -#define MDB_LAST_ERRCODE MDB_PAGE_FULL + /** Database contents grew beyond environment mapsize */ +#define MDB_MAP_RESIZED (-30785) +#define MDB_LAST_ERRCODE MDB_MAP_RESIZED /** @} */ /** @brief Statistics for a database in the environment */ @@ -675,7 +677,9 @@ int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs); * errors are: * diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 7bfdfc27bc..40b9bda484 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1054,7 +1054,8 @@ static char *const mdb_errstr[] = { "MDB_TLS_FULL: Thread-local storage keys full - too many environments open", "MDB_TXN_FULL: Transaction has too many dirty pages - transaction too big", "MDB_CURSOR_FULL: Internal error - cursor stack limit reached", - "MDB_PAGE_FULL: Internal error - page has no more space" + "MDB_PAGE_FULL: Internal error - page has no more space", + "MDB_MAP_RESIZED: Database contents grew beyond environment mapsize", }; char * @@ -1818,6 +1819,11 @@ mdb_txn_renew0(MDB_txn *txn) if (txn->mt_numdbs > 2) memset(txn->mt_dbflags+2, DB_STALE, txn->mt_numdbs-2); + if (env->me_maxpg < txn->mt_next_pgno) { + mdb_txn_reset0(txn); + return MDB_MAP_RESIZED; + } + return MDB_SUCCESS; }