From b35789774575cc0f5dfef29f5a457ee51ce15f39 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 23 Aug 2019 17:47:38 +0300 Subject: [PATCH] mdbx: backport - fix reclaiming_detent() for out-of-txn case. Change-Id: I5275f4f3676b125e860f6a7c204a5f9cdc65dd5f --- src/mdbx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mdbx.c b/src/mdbx.c index 405a80f6..6b9601f2 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -1875,7 +1875,9 @@ static __hot MDBX_meta *mdbx_meta_head(const MDBX_env *env) { static __hot txnid_t mdbx_reclaiming_detent(const MDBX_env *env) { if (F_ISSET(env->me_flags, MDBX_UTTERLY_NOSYNC)) - return env->me_txn->mt_txnid - 1; + return likely(env->me_txn0->mt_owner == mdbx_thread_self()) + ? env->me_txn0->mt_txnid - 1 + : mdbx_meta_txnid_fluid(env, mdbx_meta_head(env)); return mdbx_meta_txnid_stable(env, mdbx_meta_steady(env)); }