mdbx: fix mdbx_find_oldest() for exclusive mode.

Change-Id: I41283bcf0bd22797530c74df125bf94cd3e73d00
This commit is contained in:
Leonid Yuriev 2018-09-20 00:04:09 +03:00
parent e73df34619
commit 0b4c957bd5

View File

@ -2136,13 +2136,13 @@ static const char *mdbx_durable_str(const MDBX_meta *const meta) {
/* Find oldest txnid still referenced. */
static txnid_t mdbx_find_oldest(MDBX_txn *txn) {
mdbx_tassert(txn, (txn->mt_flags & MDBX_RDONLY) == 0);
const MDBX_env *env = txn->mt_env;
MDBX_env *env = txn->mt_env;
const txnid_t edge = mdbx_reclaiming_detent(env);
mdbx_tassert(txn, edge <= txn->mt_txnid - 1);
MDBX_lockinfo *const lck = env->me_lck;
if (unlikely(env->me_lck == NULL /* exclusive mode */))
return edge;
return env->me_oldest_stub = edge;
const txnid_t last_oldest = lck->mti_oldest;
mdbx_tassert(txn, edge >= last_oldest);