mdbx: fix without-LCK (exclusive + readonly) mode.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-06-03 22:39:11 +03:00
parent f6db64bea1
commit e795fe7c3e

View File

@ -20144,15 +20144,17 @@ __cold static int fetch_envinfo_ex(const MDBX_env *env, const MDBX_txn *txn,
arg->mi_self_latter_reader_txnid = arg->mi_latter_reader_txnid = arg->mi_self_latter_reader_txnid = arg->mi_latter_reader_txnid =
arg->mi_recent_txnid; arg->mi_recent_txnid;
for (unsigned i = 0; i < arg->mi_numreaders; ++i) { if (env->me_lck_mmap.lck) {
const uint32_t pid = for (unsigned i = 0; i < arg->mi_numreaders; ++i) {
atomic_load32(&lck->mti_readers[i].mr_pid, mo_AcquireRelease); const uint32_t pid =
if (pid) { atomic_load32(&lck->mti_readers[i].mr_pid, mo_AcquireRelease);
const txnid_t txnid = safe64_read(&lck->mti_readers[i].mr_txnid); if (pid) {
if (arg->mi_latter_reader_txnid > txnid) const txnid_t txnid = safe64_read(&lck->mti_readers[i].mr_txnid);
arg->mi_latter_reader_txnid = txnid; if (arg->mi_latter_reader_txnid > txnid)
if (pid == env->me_pid && arg->mi_self_latter_reader_txnid > txnid) arg->mi_latter_reader_txnid = txnid;
arg->mi_self_latter_reader_txnid = txnid; if (pid == env->me_pid && arg->mi_self_latter_reader_txnid > txnid)
arg->mi_self_latter_reader_txnid = txnid;
}
} }
} }