More for VL32

In cursor_sibling, don't unmap old page until we're sure
we will be finding a new sibling page.
vl32
Howard Chu 10 years ago
parent af80e8d161
commit 69d7cb8d44
  1. 32
      libraries/liblmdb/mdb.c

@ -5421,25 +5421,16 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right)
int rc; int rc;
MDB_node *indx; MDB_node *indx;
MDB_page *mp; MDB_page *mp;
#ifdef VL32
MDB_page *op;
#endif
if (mc->mc_snum < 2) { if (mc->mc_snum < 2) {
return MDB_NOTFOUND; /* root has no siblings */ return MDB_NOTFOUND; /* root has no siblings */
} }
#ifdef VL32 #ifdef VL32
mp = mc->mc_pg[mc->mc_top]; op = mc->mc_pg[mc->mc_top];
{
MDB_ID2L rl = mc->mc_txn->mt_rpages;
unsigned x = mdb_mid2l_search(rl, mp->mp_pgno);
if (x <= rl[0].mid && rl[x].mid == mp->mp_pgno) {
munmap(mp, mc->mc_txn->mt_env->me_psize);
while (x < rl[0].mid) {
rl[x] = rl[x+1];
x++;
}
rl[0].mid--;
}
}
#endif #endif
mdb_cursor_pop(mc); mdb_cursor_pop(mc);
DPRINTF(("parent page is page %"Z"u, index %u", DPRINTF(("parent page is page %"Z"u, index %u",
@ -5465,6 +5456,21 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right)
} }
mdb_cassert(mc, IS_BRANCH(mc->mc_pg[mc->mc_top])); mdb_cassert(mc, IS_BRANCH(mc->mc_pg[mc->mc_top]));
#ifdef VL32
{
MDB_ID2L rl = mc->mc_txn->mt_rpages;
unsigned x = mdb_mid2l_search(rl, op->mp_pgno);
if (x <= rl[0].mid && rl[x].mid == op->mp_pgno) {
munmap(op, mc->mc_txn->mt_env->me_psize);
while (x < rl[0].mid) {
rl[x] = rl[x+1];
x++;
}
rl[0].mid--;
}
}
#endif
indx = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); indx = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
if ((rc = mdb_page_get(mc->mc_txn, NODEPGNO(indx), &mp, NULL)) != 0) { if ((rc = mdb_page_get(mc->mc_txn, NODEPGNO(indx), &mp, NULL)) != 0) {
/* mc will be inconsistent if caller does mc_snum++ as above */ /* mc will be inconsistent if caller does mc_snum++ as above */

Loading…
Cancel
Save