Fix page_split with MDB_RESERVE

vmware
Howard Chu 13 years ago
parent 19e4df476d
commit 331bf92df5
  1. 14
      libraries/libmdb/mdb.c

@ -5520,10 +5520,6 @@ newsep:
rc = mdb_node_add(mc, j, &rkey, rdata, pgno, flags); rc = mdb_node_add(mc, j, &rkey, rdata, pgno, flags);
} }
/* reset back to original page */
if (newindx < split_indx)
mc->mc_pg[mc->mc_top] = mp;
nkeys = NUMKEYS(copy); nkeys = NUMKEYS(copy);
for (i=0; i<nkeys; i++) for (i=0; i<nkeys; i++)
mp->mp_ptrs[i] = copy->mp_ptrs[i]; mp->mp_ptrs[i] = copy->mp_ptrs[i];
@ -5532,6 +5528,16 @@ newsep:
memcpy(NODEPTR(mp, nkeys-1), NODEPTR(copy, nkeys-1), memcpy(NODEPTR(mp, nkeys-1), NODEPTR(copy, nkeys-1),
mc->mc_txn->mt_env->me_psize - copy->mp_upper); mc->mc_txn->mt_env->me_psize - copy->mp_upper);
/* reset back to original page */
if (newindx < split_indx) {
mc->mc_pg[mc->mc_top] = mp;
if (nflags & MDB_RESERVE) {
node = NODEPTR(mp, mc->mc_ki[mc->mc_top]);
if (!(node->mn_flags & F_BIGDATA))
newdata->mv_data = NODEDATA(node);
}
}
/* return tmp page to freelist */ /* return tmp page to freelist */
copy->mp_next = mc->mc_txn->mt_env->me_dpages; copy->mp_next = mc->mc_txn->mt_env->me_dpages;
mc->mc_txn->mt_env->me_dpages = copy; mc->mc_txn->mt_env->me_dpages = copy;

Loading…
Cancel
Save