From 4a25e0699bb2a58eaf390682ba72f745a19d86ae Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 2 May 2024 16:29:03 +0100 Subject: [PATCH] ITS#10212 LMDB: init txnid for read-only DBs --- libraries/liblmdb/mdb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 2cc7d269e6..7dbfa59c18 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -3278,6 +3278,10 @@ mdb_txn_renew0(MDB_txn *txn) UNLOCK_MUTEX(rmutex); return MDB_READERS_FULL; } + if ((env->me_flags & MDB_RDONLY) && !ti->mti_txnid) { + meta = mdb_env_pick_meta(env); + ti->mti_txnid = meta->mm_txnid; + } r = &ti->mti_readers[i]; /* Claim the reader slot, carefully since other code * uses the reader table un-mutexed: First reset the -- 2.47.2