mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 05:18:21 +08:00
mdbx: fix snap-state bug (backport).
Change-Id: Ia0f2e028193d223b3a25e76d83cb22b9bc9546e6
This commit is contained in:
parent
bb205df001
commit
baf0fad11d
11
mdb.c
11
mdb.c
@ -2898,14 +2898,11 @@ mdb_txn_renew0(MDB_txn *txn, unsigned flags)
|
||||
}
|
||||
|
||||
while((env->me_flags & MDB_FATAL_ERROR) == 0) {
|
||||
MDB_meta *meta = mdb_meta_head_r(txn->mt_env);
|
||||
txnid_t lead = meta->mm_txnid;
|
||||
MDB_meta * const meta = mdb_meta_head_r(txn->mt_env);
|
||||
const txnid_t lead = meta->mm_txnid;
|
||||
r->mr_txnid = lead;
|
||||
mdbx_coherent_barrier();
|
||||
|
||||
txnid_t snap = txn->mt_env->me_txns->mti_txnid;
|
||||
/* LY: Retry on a race, ITS#7970. */
|
||||
if (likely(lead == snap)) {
|
||||
txn->mt_txnid = lead;
|
||||
txn->mt_next_pgno = meta->mm_last_pg+1;
|
||||
/* Copy the DB info and flags */
|
||||
@ -2913,9 +2910,11 @@ mdb_txn_renew0(MDB_txn *txn, unsigned flags)
|
||||
#if MDBX_MODE_ENABLED
|
||||
txn->mt_canary = meta->mm_canary;
|
||||
#endif
|
||||
/* LY: Retry on a race, ITS#7970. */
|
||||
const txnid_t snap = txn->mt_env->me_txns->mti_txnid;
|
||||
if (likely(lead == snap))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
txn->mt_u.reader = r;
|
||||
txn->mt_dbxs = env->me_dbxs; /* mostly static anyway */
|
||||
|
Loading…
x
Reference in New Issue
Block a user