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;
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;
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.
*/
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);