From cd57e9741f11d59882f5699636fdfe00a579b7e7 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 28 Jun 2011 02:40:46 -0700 Subject: [PATCH] Fix splits, cursor navigation, newpage flags --- libraries/libmdb/mdb.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 63ef4c6a0f..09d67692ff 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -1123,8 +1123,15 @@ mdb_search_page_root(MDB_db *bt, MDB_val *key, if (cursor && cursor_push_page(cursor, mp) == NULL) return MDB_FAIL; - if (modify && (rc = mdb_touch(bt->md_env->me_txn, mpp))) - return rc; + if (modify) { + MDB_dhead *dh = ((MDB_dhead *)mp)-1; + if (rc = mdb_touch(bt->md_env->me_txn, mpp)) + return rc; + dh = ((MDB_dhead *)mpp->mp_page)-1; + dh->md_parent = mpp->mp_parent; + dh->md_pi = mpp->mp_pi; + } + mp = mpp->mp_page; } @@ -1295,10 +1302,10 @@ mdb_sibling(MDB_cursor *cursor, int move_right) } assert(IS_BRANCH(parent->mp_page)); -#if 0 indx = NODEPTR(parent->mp_page, parent->mp_ki); - if ((mp = mdbenv_get_page(cursor->bt, indx->n_pgno)) == NULL) + if ((mp = mdbenv_get_page(cursor->mc_db->md_env, indx->mn_pgno)) == NULL) return MDB_FAIL; +#if 0 mp->parent = parent->mp_page; mp->parent_index = parent->mp_ki; #endif @@ -1492,7 +1499,7 @@ mdbenv_new_page(MDB_env *env, uint32_t flags, int num) env->me_txn->mt_next_pgno, env->me_head.mh_psize); if ((dp = mdb_newpage(env->me_txn, NULL, 0, num)) == NULL) return NULL; - dp->p.mp_flags = flags; + dp->p.mp_flags = flags | P_DIRTY; dp->p.mp_lower = PAGEHDRSZ; dp->p.mp_upper = env->me_head.mh_psize; -- 2.39.5