|
|
|
@ -521,11 +521,6 @@ typedef struct MDB_txbody { |
|
|
|
|
* when readers release their slots. |
|
|
|
|
*/ |
|
|
|
|
unsigned mtb_numreaders; |
|
|
|
|
/** The ID of the most recent meta page in the database.
|
|
|
|
|
* This is recorded here only for convenience; the value can always |
|
|
|
|
* be determined by reading the main database meta pages. |
|
|
|
|
*/ |
|
|
|
|
uint32_t mtb_me_toggle; |
|
|
|
|
} MDB_txbody; |
|
|
|
|
|
|
|
|
|
/** The actual reader table definition. */ |
|
|
|
@ -538,7 +533,6 @@ typedef struct MDB_txninfo { |
|
|
|
|
#define mti_rmname mt1.mtb.mtb_rmname |
|
|
|
|
#define mti_txnid mt1.mtb.mtb_txnid |
|
|
|
|
#define mti_numreaders mt1.mtb.mtb_numreaders |
|
|
|
|
#define mti_me_toggle mt1.mtb.mtb_me_toggle |
|
|
|
|
char pad[(sizeof(MDB_txbody)+CACHELINE-1) & ~(CACHELINE-1)]; |
|
|
|
|
} mt1; |
|
|
|
|
union { |
|
|
|
@ -1575,8 +1569,9 @@ mdb_txn_renew0(MDB_txn *txn) |
|
|
|
|
r = &env->me_txns->mti_readers[i]; |
|
|
|
|
pthread_setspecific(env->me_txkey, r); |
|
|
|
|
} |
|
|
|
|
txn->mt_toggle = env->me_txns->mti_me_toggle; |
|
|
|
|
txn->mt_txnid = env->me_txns->mti_txnid; |
|
|
|
|
txn->mt_toggle = txn->mt_txnid & 1; |
|
|
|
|
txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1; |
|
|
|
|
/* This happens if a different process was the
|
|
|
|
|
* last writer to the DB. |
|
|
|
|
*/ |
|
|
|
@ -1588,6 +1583,8 @@ mdb_txn_renew0(MDB_txn *txn) |
|
|
|
|
LOCK_MUTEX_W(env); |
|
|
|
|
|
|
|
|
|
txn->mt_txnid = env->me_txns->mti_txnid; |
|
|
|
|
txn->mt_toggle = txn->mt_txnid & 1; |
|
|
|
|
txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1; |
|
|
|
|
if (env->me_wtxnid < txn->mt_txnid) |
|
|
|
|
mt_dbflag = DB_STALE; |
|
|
|
|
txn->mt_txnid++; |
|
|
|
@ -1595,14 +1592,12 @@ mdb_txn_renew0(MDB_txn *txn) |
|
|
|
|
if (txn->mt_txnid == mdb_debug_start) |
|
|
|
|
mdb_debug = 1; |
|
|
|
|
#endif |
|
|
|
|
txn->mt_toggle = env->me_txns->mti_me_toggle; |
|
|
|
|
txn->mt_u.dirty_list = env->me_dirty_list; |
|
|
|
|
txn->mt_u.dirty_list[0].mid = 0; |
|
|
|
|
txn->mt_free_pgs = env->me_free_pgs; |
|
|
|
|
txn->mt_free_pgs[0] = 0; |
|
|
|
|
env->me_txn = txn; |
|
|
|
|
} |
|
|
|
|
txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1; |
|
|
|
|
|
|
|
|
|
/* Copy the DB arrays */ |
|
|
|
|
LAZY_RWLOCK_RDLOCK(&env->me_dblock); |
|
|
|
@ -2394,7 +2389,6 @@ mdb_env_write_meta(MDB_txn *txn) |
|
|
|
|
* how stale their view of these values is. |
|
|
|
|
*/ |
|
|
|
|
LAZY_MUTEX_LOCK(&env->me_txns->mti_mutex); |
|
|
|
|
txn->mt_env->me_txns->mti_me_toggle = toggle; |
|
|
|
|
txn->mt_env->me_txns->mti_txnid = txn->mt_txnid; |
|
|
|
|
LAZY_MUTEX_UNLOCK(&env->me_txns->mti_mutex); |
|
|
|
|
|
|
|
|
@ -2598,7 +2592,6 @@ mdb_env_share_locks(MDB_env *env) |
|
|
|
|
{ |
|
|
|
|
int toggle = mdb_env_pick_meta(env); |
|
|
|
|
|
|
|
|
|
env->me_txns->mti_me_toggle = toggle; |
|
|
|
|
env->me_txns->mti_txnid = env->me_metas[toggle]->mm_txnid; |
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
@ -2916,7 +2909,6 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) |
|
|
|
|
env->me_txns->mti_magic = MDB_MAGIC; |
|
|
|
|
env->me_txns->mti_txnid = 0; |
|
|
|
|
env->me_txns->mti_numreaders = 0; |
|
|
|
|
env->me_txns->mti_me_toggle = 0; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
if (env->me_txns->mti_magic != MDB_MAGIC) { |
|
|
|
|