From ed917c6c02468b7a1462049eecb709b9770dd3bb Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 26 Apr 2026 15:07:40 +0100 Subject: [PATCH] Revert "ITS#8250 LMDB: add option MDB_ROTXN_RESET flag for txn_begin" This reverts commit 4cd8e451679511c8fbeff68f8a97cbe7b1268b48. Cost/benefit makes no sense. --- libraries/liblmdb/lmdb.h | 9 --------- libraries/liblmdb/mdb.c | 12 ++---------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index 3969ee81f7..da7b3c94a6 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -372,13 +372,6 @@ typedef void (MDB_sum_func)(const MDB_val *src, MDB_val *dst, const MDB_val *key #define MDB_REMAP_CHUNKS 0x4000000 /** @} */ -/** @defgroup mdb_txn_begin Transaction Flags - * @{ - */ - /** don't initialize read-only txn; #mdb_txn_renew() must be called before first use */ -#define MDB_ROTXN_RESET 0x8000000 -/** @} */ - /** @defgroup mdb_dbi_open Database Flags * @{ */ @@ -1150,8 +1143,6 @@ int mdb_env_set_checksum(MDB_env *env, MDB_sum_func *func, unsigned int size); * Don't flush system buffers to disk when committing this transaction. *
  • #MDB_NOMETASYNC * Flush system buffers but omit metadata flush when committing this transaction. - *
  • #MDB_ROTXN_RESET - * Must call #mdb_txn_renew() before using this readonly transaction. * * @param[out] txn Address where the new #MDB_txn handle will be stored * @return A non-zero error value on failure and 0 on success. Some possible diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 45d29f1f14..03f0a19ea1 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1512,7 +1512,7 @@ struct MDB_txn { * @{ */ /** #mdb_txn_begin() flags */ -#define MDB_TXN_BEGIN_FLAGS (MDB_NOMETASYNC|MDB_NOSYNC|MDB_RDONLY|MDB_ROTXN_RESET) +#define MDB_TXN_BEGIN_FLAGS (MDB_NOMETASYNC|MDB_NOSYNC|MDB_RDONLY) #define MDB_TXN_NOMETASYNC MDB_NOMETASYNC /**< don't sync meta for this txn on commit */ #define MDB_TXN_NOSYNC MDB_NOSYNC /**< don't sync this txn on commit */ #define MDB_TXN_RDONLY MDB_RDONLY /**< read-only transaction */ @@ -3487,9 +3487,6 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) if (env->me_flags & MDB_RDONLY & ~flags) /* write txn in RDONLY env */ return MDB_IS_READONLY; - if ((flags & MDB_ROTXN_RESET) && !(flags & MDB_RDONLY)) /* MDB_ROTXN_RESET requires MDB_RDONLY */ - return EINVAL; - if (parent) { /* Nested transactions: * Only write txns may have nested txns; @@ -3609,12 +3606,7 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) } else { /* MDB_RDONLY */ txn->mt_dbiseqs = env->me_dbiseqs; renew: - if (F_ISSET(flags, MDB_ROTXN_RESET)) { - rc = MDB_SUCCESS; - flags ^= (MDB_ROTXN_RESET|MDB_TXN_FINISHED); - } else { - rc = mdb_txn_renew0(txn); - } + rc = mdb_txn_renew0(txn); } if (rc) { if (txn != env->me_txn0) {