From: Howard Chu Date: Wed, 29 Jun 2011 05:05:54 +0000 (-0700) Subject: Log txnID in msgs X-Git-Tag: OPENLDAP_REL_ENG_2_4_27~148^2~178 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe703b0ee07c8f508e73a3cca34d8e0efbe51efb;p=openldap Log txnID in msgs --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index e3693d78d1..a0740bcacb 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -504,7 +504,7 @@ mdb_txn_begin(MDB_env *env, int rdonly, MDB_txn **ret) txn->mt_next_pgno = env->me_meta.mm_last_pg+1; txn->mt_first_pgno = txn->mt_next_pgno; txn->mt_root = env->me_meta.mm_root; - DPRINTF("begin transaction on mdbenv %p, root page %lu", env, txn->mt_root); + DPRINTF("begin transaction %lu on mdbenv %p, root page %lu", txn->mt_txnid, env, txn->mt_root); *ret = txn; return MDB_SUCCESS; @@ -520,7 +520,7 @@ mdb_txn_abort(MDB_txn *txn) return; env = txn->mt_env; - DPRINTF("abort transaction on mdbenv %p, root page %lu", env, txn->mt_root); + DPRINTF("abort transaction %lu on mdbenv %p, root page %lu", txn->mt_txnid, env, txn->mt_root); if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) { txn->mt_u.reader->mr_txnid = 0; @@ -586,8 +586,8 @@ mdb_txn_commit(MDB_txn *txn) if (SIMPLEQ_EMPTY(txn->mt_u.dirty_queue)) goto done; - DPRINTF("committing transaction on mdbenv %p, root page %lu", - env, txn->mt_root); + DPRINTF("committing transaction %lu on mdbenv %p, root page %lu", + txn->mt_txnid, env, txn->mt_root); /* Commit up to MDB_COMMIT_PAGES dirty pages to disk until done. */ @@ -843,8 +843,10 @@ mdbenv_read_meta(MDB_env *env) if (meta[0]->mm_txnid < meta[1]->mm_txnid) toggle = 1; - bcopy(meta[toggle], &env->me_meta, sizeof(env->me_meta)); - env->me_metatoggle = toggle; + if (meta[toggle]->mm_txnid > env->me_meta.mm_txnid) { + bcopy(meta[toggle], &env->me_meta, sizeof(env->me_meta)); + env->me_metatoggle = toggle; + } DPRINTF("Using meta page %d", toggle);