mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#7635 simplify 9474c1a0b6
This commit is contained in:
parent
9474c1a0b6
commit
fb674c1cf5
@ -1743,7 +1743,6 @@ mdb_txn_renew0(MDB_txn *txn)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint16_t x;
|
uint16_t x;
|
||||||
int rc, new_notls = 0;
|
int rc, new_notls = 0;
|
||||||
pgno_t lastpg2;
|
|
||||||
|
|
||||||
/* Setup db info */
|
/* Setup db info */
|
||||||
txn->mt_numdbs = env->me_numdbs;
|
txn->mt_numdbs = env->me_numdbs;
|
||||||
@ -1790,13 +1789,11 @@ mdb_txn_renew0(MDB_txn *txn)
|
|||||||
txn->mt_u.reader = r;
|
txn->mt_u.reader = r;
|
||||||
}
|
}
|
||||||
txn->mt_toggle = txn->mt_txnid & 1;
|
txn->mt_toggle = txn->mt_txnid & 1;
|
||||||
txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1;
|
|
||||||
} else {
|
} else {
|
||||||
LOCK_MUTEX_W(env);
|
LOCK_MUTEX_W(env);
|
||||||
|
|
||||||
txn->mt_txnid = env->me_txns->mti_txnid;
|
txn->mt_txnid = env->me_txns->mti_txnid;
|
||||||
txn->mt_toggle = txn->mt_txnid & 1;
|
txn->mt_toggle = txn->mt_txnid & 1;
|
||||||
txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1;
|
|
||||||
txn->mt_txnid++;
|
txn->mt_txnid++;
|
||||||
#if MDB_DEBUG
|
#if MDB_DEBUG
|
||||||
if (txn->mt_txnid == mdb_debug_start)
|
if (txn->mt_txnid == mdb_debug_start)
|
||||||
@ -1812,17 +1809,10 @@ mdb_txn_renew0(MDB_txn *txn)
|
|||||||
|
|
||||||
/* Copy the DB info and flags */
|
/* Copy the DB info and flags */
|
||||||
memcpy(txn->mt_dbs, env->me_metas[txn->mt_toggle]->mm_dbs, 2 * sizeof(MDB_db));
|
memcpy(txn->mt_dbs, env->me_metas[txn->mt_toggle]->mm_dbs, 2 * sizeof(MDB_db));
|
||||||
/* In a read txn, there is a data race here. Make sure our
|
|
||||||
* last_pg/next_pg are up to date.
|
/* Moved to here to avoid a data race in read TXNs */
|
||||||
*/
|
txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1;
|
||||||
lastpg2 = env->me_metas[txn->mt_toggle]->mm_last_pg+1;
|
|
||||||
if (lastpg2 != txn->mt_next_pgno) {
|
|
||||||
txn->mt_next_pgno = lastpg2;
|
|
||||||
/* When this situation occurs, the txnid will certainly also
|
|
||||||
* be out of date. But as noted before, we don't care about having
|
|
||||||
* up to date read txn IDs.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
for (i=2; i<txn->mt_numdbs; i++) {
|
for (i=2; i<txn->mt_numdbs; i++) {
|
||||||
x = env->me_dbflags[i];
|
x = env->me_dbflags[i];
|
||||||
txn->mt_dbs[i].md_flags = x & PERSISTENT_FLAGS;
|
txn->mt_dbs[i].md_flags = x & PERSISTENT_FLAGS;
|
||||||
|
Loading…
Reference in New Issue
Block a user