From: Howard Chu Date: Fri, 7 Oct 2011 01:53:07 +0000 (-0700) Subject: Fix page_split with MDB_RESERVE X-Git-Tag: OPENLDAP_REL_ENG_2_4_27~148^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=331bf92df58eefbf2272a235a7a19ef0f6fe7493;p=openldap Fix page_split with MDB_RESERVE --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index dc333e91ab..5ef3022b07 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -5520,10 +5520,6 @@ newsep: 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); for (i=0; imp_ptrs[i] = copy->mp_ptrs[i]; @@ -5532,6 +5528,16 @@ newsep: memcpy(NODEPTR(mp, nkeys-1), NODEPTR(copy, nkeys-1), 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 */ copy->mp_next = mc->mc_txn->mt_env->me_dpages; mc->mc_txn->mt_env->me_dpages = copy;