mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 15:48:21 +08:00
mdbx: fix mdbx_find_oldest() for exclusive mode.
Change-Id: I41283bcf0bd22797530c74df125bf94cd3e73d00
This commit is contained in:
parent
e73df34619
commit
0b4c957bd5
@ -2136,13 +2136,13 @@ static const char *mdbx_durable_str(const MDBX_meta *const meta) {
|
|||||||
/* Find oldest txnid still referenced. */
|
/* Find oldest txnid still referenced. */
|
||||||
static txnid_t mdbx_find_oldest(MDBX_txn *txn) {
|
static txnid_t mdbx_find_oldest(MDBX_txn *txn) {
|
||||||
mdbx_tassert(txn, (txn->mt_flags & MDBX_RDONLY) == 0);
|
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);
|
const txnid_t edge = mdbx_reclaiming_detent(env);
|
||||||
mdbx_tassert(txn, edge <= txn->mt_txnid - 1);
|
mdbx_tassert(txn, edge <= txn->mt_txnid - 1);
|
||||||
|
|
||||||
MDBX_lockinfo *const lck = env->me_lck;
|
MDBX_lockinfo *const lck = env->me_lck;
|
||||||
if (unlikely(env->me_lck == NULL /* exclusive mode */))
|
if (unlikely(env->me_lck == NULL /* exclusive mode */))
|
||||||
return edge;
|
return env->me_oldest_stub = edge;
|
||||||
|
|
||||||
const txnid_t last_oldest = lck->mti_oldest;
|
const txnid_t last_oldest = lck->mti_oldest;
|
||||||
mdbx_tassert(txn, edge >= last_oldest);
|
mdbx_tassert(txn, edge >= last_oldest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user