From 3fc45cbaea9648000808ca054b0e27be29a977b3 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Wed, 5 Aug 2015 14:14:39 +0300 Subject: [PATCH] lmdb: fix assertion failure in case error while opening DB in debug-mode. Change-Id: I56a1122369640920d594416e9bd3de0f3f9cd8fd --- mdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mdb.c b/mdb.c index a4b68a36..13f07923 100644 --- a/mdb.c +++ b/mdb.c @@ -1935,6 +1935,7 @@ static MDB_meta* mdb_meta_head_w(MDB_env *env) { if (likely(b->mm_txnid == head_txnid)) return b; + mdb_debug("me_txns->mti_txnid not match meta-pages"); mdb_assert(env, head_txnid == a->mm_txnid || head_txnid == b->mm_txnid); env->me_flags |= MDB_FATAL_ERROR; return a; @@ -4705,7 +4706,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned flags, mode_t mode) } #if MDB_DEBUG - { + if (rc == MDB_SUCCESS) { MDB_meta *meta = mdb_meta_head_r(env); MDB_db *db = &meta->mm_dbs[MAIN_DBI]; int toggle = ((char*) meta == PAGEDATA(env->me_map)) ? 0 : 1;