]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix "Duplicate RW transaction" LMDB exception. 15090/head
authorMiod Vallat <miod.vallat@open-xchange.com>
Mon, 27 Jan 2025 15:10:37 +0000 (16:10 +0100)
committerMiod Vallat <miod.vallat@open-xchange.com>
Mon, 27 Jan 2025 15:10:37 +0000 (16:10 +0100)
The check was too strict and would prevent any RO transaction to coexist
with RW transactions. But LMDB is designed to allow this - on the other
hand there can be only one active RW transaction at a time.

ext/lmdb-safe/lmdb-safe.cc

index f0db35fd811e14cba126887ccf20819620c364d0..7c4f2d300a8afec90784c8338cc1fc3f1214b9a9 100644 (file)
@@ -235,8 +235,9 @@ MDBRWTransactionImpl::MDBRWTransactionImpl(MDBEnv *parent, MDB_txn *txn):
 MDB_txn *MDBRWTransactionImpl::openRWTransaction(MDBEnv *env, MDB_txn *parent, int flags)
 {
   MDB_txn *result;
-  if(env->getROTX() || env->getRWTX())
+  if(env->getRWTX() != 0) {
     throw std::runtime_error("Duplicate RW transaction");
+  }
 
   if(int rc=mdb_txn_begin(env->d_env, parent, flags, &result))
     throw std::runtime_error("Unable to start RW transaction: "+std::string(mdb_strerror(rc)));