diff options
author | Hallvard Furuseth <hallvard@openldap.org> | 2016-07-14 05:53:21 +0200 |
---|---|---|
committer | Hallvard Furuseth <hallvard@openldap.org> | 2016-07-14 05:53:21 +0200 |
commit | 84610e65da85d483f9461b4bdc300a082f004de2 (patch) | |
tree | 34bf02d0d96f149d8a6226cd9912dd5ed70f53ee | |
parent | 291c69ddbd593ce86c888718745f6d78f6bd7222 (diff) | |
download | lmdb-84610e65da85d483f9461b4bdc300a082f004de2.tar.gz lmdb-84610e65da85d483f9461b4bdc300a082f004de2.tar.bz2 lmdb-84610e65da85d483f9461b4bdc300a082f004de2.zip |
Add error MDB_PROBLEM, replace some MDB_CORRUPTED
When problem is most likely in txn, not on disk.
-rw-r--r-- | libraries/liblmdb/lmdb.h | 4 | ||||
-rw-r--r-- | libraries/liblmdb/mdb.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index 85dc50d..d30ab64 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -456,8 +456,10 @@ typedef enum MDB_cursor_op { #define MDB_BAD_VALSIZE (-30781) /** The specified DBI was changed unexpectedly */ #define MDB_BAD_DBI (-30780) + /** Unexpected problem - txn should abort */ +#define MDB_PROBLEM (-30779) /** The last defined error code */ -#define MDB_LAST_ERRCODE MDB_BAD_DBI +#define MDB_LAST_ERRCODE MDB_PROBLEM /** @} */ /** @brief Statistics for a database in the environment */ diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 3777ab3..df31780 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1565,6 +1565,7 @@ static char *const mdb_errstr[] = { "MDB_BAD_TXN: Transaction must abort, has a child, or is invalid", "MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size", "MDB_BAD_DBI: The specified DBI handle was closed/changed unexpectedly", + "MDB_PROBLEM: Unexpected problem - txn should abort", }; char * @@ -2001,7 +2002,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) if (mp != dl[x].mptr) { /* bad cursor? */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); txn->mt_flags |= MDB_TXN_ERROR; - return MDB_CORRUPTED; + return MDB_PROBLEM; } /* ok, it's ours */ loose = 1; @@ -2611,7 +2612,7 @@ mdb_page_touch(MDB_cursor *mc) if (mp != dl[x].mptr) { /* bad cursor? */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); txn->mt_flags |= MDB_TXN_ERROR; - return MDB_CORRUPTED; + return MDB_PROBLEM; } return 0; } @@ -6263,7 +6264,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) j = ++(dl[0].mid); dl[j] = ix; /* Unsorted. OK when MDB_TXN_ERROR. */ txn->mt_flags |= MDB_TXN_ERROR; - return MDB_CORRUPTED; + return MDB_PROBLEM; } } txn->mt_dirty_room++; @@ -7656,7 +7657,7 @@ put_sub: return rc; bad_sub: if (rc == MDB_KEYEXIST) /* should not happen, we deleted that item */ - rc = MDB_CORRUPTED; + rc = MDB_PROBLEM; } mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; |