]> git.sur5r.net Git - openldap/commitdiff
ITS#7121 fix page splits when newindx == 0
authorHoward Chu <hyc@symas.com>
Sat, 21 Jan 2012 16:18:37 +0000 (08:18 -0800)
committerHoward Chu <hyc@symas.com>
Sat, 21 Jan 2012 16:18:37 +0000 (08:18 -0800)
libraries/libmdb/mdb.c

index cdd46c98d73c58a0b38572d12b0551b87eaa7572..9480a4339ef75e6ad974b07383848987d2ad95c5 100644 (file)
@@ -5585,6 +5585,8 @@ newsep:
                        ins_new = 1;
 
                        /* Update page and index for the new key. */
+                       if (!newindx)
+                               mc->mc_pg[mc->mc_top] = copy;
                        mc->mc_ki[mc->mc_top] = j;
                } else if (i == nkeys) {
                        break;
@@ -5620,7 +5622,7 @@ newsep:
                mc->mc_txn->mt_env->me_psize - copy->mp_upper);
 
        /* reset back to original page */
-       if (newindx < split_indx) {
+       if (!newindx || (newindx < split_indx)) {
                mc->mc_pg[mc->mc_top] = mp;
                if (nflags & MDB_RESERVE) {
                        node = NODEPTR(mp, mc->mc_ki[mc->mc_top]);