mdbx: don't check owner for finished transactions.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-08-06 13:19:49 +03:00
parent e444c70cb7
commit 06734bf8ff

View File

@ -8152,13 +8152,17 @@ static __always_inline int check_txn(const MDBX_txn *txn, int bad_bits) {
if (unlikely(txn->mt_flags & bad_bits)) if (unlikely(txn->mt_flags & bad_bits))
return MDBX_BAD_TXN; return MDBX_BAD_TXN;
mdbx_tassert(txn, (txn->mt_flags & MDBX_NOTLS) ==
((txn->mt_flags & MDBX_TXN_RDONLY)
? txn->mt_env->me_flags & MDBX_NOTLS
: 0));
#if MDBX_TXN_CHECKOWNER #if MDBX_TXN_CHECKOWNER
if ((txn->mt_flags & MDBX_NOTLS) == 0 && if (unlikely(txn->mt_owner != mdbx_thread_self()) &&
unlikely(txn->mt_owner != mdbx_thread_self())) (txn->mt_flags & (MDBX_NOTLS | MDBX_TXN_FINISHED)) == 0)
return txn->mt_owner ? MDBX_THREAD_MISMATCH : MDBX_BAD_TXN; return txn->mt_owner ? MDBX_THREAD_MISMATCH : MDBX_BAD_TXN;
#endif /* MDBX_TXN_CHECKOWNER */ #endif /* MDBX_TXN_CHECKOWNER */
if (unlikely(!txn->mt_env->me_map)) if (bad_bits && unlikely(!txn->mt_env->me_map))
return MDBX_EPERM; return MDBX_EPERM;
return MDBX_SUCCESS; return MDBX_SUCCESS;