From 8a562f560edcc6417672df453c4e626dfb4c4024 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Thu, 18 Apr 2013 04:15:45 +0200 Subject: [PATCH] Support mdb_txn_abort(a reset txn). --- libraries/liblmdb/mdb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index f1ed1f2..72ffa7e 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1980,6 +1980,7 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) } /** Common code for #mdb_txn_reset() and #mdb_txn_abort(). + * May be called twice for readonly txns: First reset it, then abort. * @param[in] txn the transaction handle to reset */ static void @@ -2001,7 +2002,9 @@ mdb_txn_reset0(MDB_txn *txn) if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) { if (txn->mt_u.reader) { txn->mt_u.reader->mr_txnid = (txnid_t)-1; + txn->mt_u.reader = NULL; /* do not touch mr_txnid again */ } + txn->mt_numdbs = 0; /* mark txn as reset, do not close DBs again */ } else { MDB_page *dp;