Merge remote branch 'origin/mdb.master'

This commit is contained in:
Howard Chu 2011-10-04 02:22:01 -07:00
commit 1adc0b9b1c

View File

@ -1128,7 +1128,7 @@ mdb_page_alloc(MDB_cursor *mc, int num)
if (pgno == P_INVALID) { if (pgno == P_INVALID) {
/* DB size is maxed out */ /* DB size is maxed out */
if (txn->mt_next_pgno + num >= txn->mt_env->me_maxpg) { if (txn->mt_next_pgno + num >= txn->mt_env->me_maxpg) {
DPRINTF("DB size maxed out"); DPUTS("DB size maxed out");
return NULL; return NULL;
} }
} }
@ -1764,13 +1764,13 @@ mdb_txn_commit(MDB_txn *txn)
MDB_oldpages *mop; MDB_oldpages *mop;
mop = env->me_pghead; mop = env->me_pghead;
env->me_pghead = NULL;
key.mv_size = sizeof(pgno_t); key.mv_size = sizeof(pgno_t);
key.mv_data = &mop->mo_txnid; key.mv_data = &mop->mo_txnid;
data.mv_size = MDB_IDL_SIZEOF(mop->mo_pages); data.mv_size = MDB_IDL_SIZEOF(mop->mo_pages);
data.mv_data = mop->mo_pages; data.mv_data = mop->mo_pages;
mdb_cursor_put(&mc, &key, &data, 0); mdb_cursor_put(&mc, &key, &data, 0);
free(env->me_pghead); free(mop);
env->me_pghead = NULL;
} }
/* Update DB root pointers. Their pages have already been /* Update DB root pointers. Their pages have already been
@ -3202,6 +3202,7 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int modify)
} }
} }
assert(root > 1);
if ((rc = mdb_page_get(mc->mc_txn, root, &mc->mc_pg[0]))) if ((rc = mdb_page_get(mc->mc_txn, root, &mc->mc_pg[0])))
return rc; return rc;
@ -4081,6 +4082,8 @@ new_sub:
nflags = flags & NODE_ADD_FLAGS; nflags = flags & NODE_ADD_FLAGS;
nsize = IS_LEAF2(mc->mc_pg[mc->mc_top]) ? key->mv_size : mdb_leaf_size(mc->mc_txn->mt_env, key, rdata); nsize = IS_LEAF2(mc->mc_pg[mc->mc_top]) ? key->mv_size : mdb_leaf_size(mc->mc_txn->mt_env, key, rdata);
if (SIZELEFT(mc->mc_pg[mc->mc_top]) < nsize) { if (SIZELEFT(mc->mc_pg[mc->mc_top]) < nsize) {
if (( flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA )
nflags &= ~MDB_APPEND;
rc = mdb_page_split(mc, key, rdata, P_INVALID, nflags); rc = mdb_page_split(mc, key, rdata, P_INVALID, nflags);
} else { } else {
/* There is room already in this leaf page. */ /* There is room already in this leaf page. */