|
|
@ -1617,9 +1617,9 @@ mdb_txn_commit(MDB_txn *txn) |
|
|
|
mdb_txn_abort(txn); |
|
|
|
mdb_txn_abort(txn); |
|
|
|
return n; |
|
|
|
return n; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
env->me_wtxnid = txn->mt_txnid; |
|
|
|
|
|
|
|
|
|
|
|
done: |
|
|
|
done: |
|
|
|
env->me_wtxnid = txn->mt_txnid; |
|
|
|
|
|
|
|
env->me_txn = NULL; |
|
|
|
env->me_txn = NULL; |
|
|
|
/* update the DB tables */ |
|
|
|
/* update the DB tables */ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2852,24 +2852,8 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int modify) |
|
|
|
if (F_ISSET(mc->mc_txn->mt_flags, MDB_TXN_ERROR)) { |
|
|
|
if (F_ISSET(mc->mc_txn->mt_flags, MDB_TXN_ERROR)) { |
|
|
|
DPUTS("transaction has failed, must abort"); |
|
|
|
DPUTS("transaction has failed, must abort"); |
|
|
|
return EINVAL; |
|
|
|
return EINVAL; |
|
|
|
} else |
|
|
|
} else { |
|
|
|
root = mc->mc_db->md_root; |
|
|
|
/* Make sure we're using an up-to-date root */ |
|
|
|
|
|
|
|
|
|
|
|
if (root == P_INVALID) { /* Tree is empty. */ |
|
|
|
|
|
|
|
DPUTS("tree is empty"); |
|
|
|
|
|
|
|
return MDB_NOTFOUND; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((rc = mdb_page_get(mc->mc_txn, root, &mc->mc_pg[0]))) |
|
|
|
|
|
|
|
return rc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mc->mc_snum = 1; |
|
|
|
|
|
|
|
mc->mc_top = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DPRINTF("db %u root page %zu has flags 0x%X", |
|
|
|
|
|
|
|
mc->mc_dbi, root, mc->mc_pg[0]->mp_flags); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* For sub-databases, update main root first */ |
|
|
|
|
|
|
|
if (mc->mc_dbi > MAIN_DBI) { |
|
|
|
if (mc->mc_dbi > MAIN_DBI) { |
|
|
|
if ((*mc->mc_dbflag & DB_STALE) || |
|
|
|
if ((*mc->mc_dbflag & DB_STALE) || |
|
|
|
(modify && !(*mc->mc_dbflag & DB_DIRTY))) { |
|
|
|
(modify && !(*mc->mc_dbflag & DB_DIRTY))) { |
|
|
@ -2894,6 +2878,23 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int modify) |
|
|
|
*mc->mc_dbflag = dbflag; |
|
|
|
*mc->mc_dbflag = dbflag; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
root = mc->mc_db->md_root; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (root == P_INVALID) { /* Tree is empty. */ |
|
|
|
|
|
|
|
DPUTS("tree is empty"); |
|
|
|
|
|
|
|
return MDB_NOTFOUND; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((rc = mdb_page_get(mc->mc_txn, root, &mc->mc_pg[0]))) |
|
|
|
|
|
|
|
return rc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mc->mc_snum = 1; |
|
|
|
|
|
|
|
mc->mc_top = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DPRINTF("db %u root page %zu has flags 0x%X", |
|
|
|
|
|
|
|
mc->mc_dbi, root, mc->mc_pg[0]->mp_flags); |
|
|
|
|
|
|
|
|
|
|
|
if (modify) { |
|
|
|
if (modify) { |
|
|
|
if (!F_ISSET(mc->mc_pg[0]->mp_flags, P_DIRTY)) { |
|
|
|
if (!F_ISSET(mc->mc_pg[0]->mp_flags, P_DIRTY)) { |
|
|
|
if ((rc = mdb_page_touch(mc))) |
|
|
|
if ((rc = mdb_page_touch(mc))) |
|
|
|