]> git.sur5r.net Git - openldap/commitdiff
ITS#7829 more for prev commit
authorHoward Chu <hyc@symas.com>
Mon, 31 Mar 2014 20:42:19 +0000 (13:42 -0700)
committerHoward Chu <hyc@symas.com>
Mon, 31 Mar 2014 20:42:19 +0000 (13:42 -0700)
libraries/liblmdb/mdb.c

index af190c6afd361735d557c48b2dff79c6aa9bf4a4..10a8358449d2333086daf00579f5b7dcc36fbc12 100644 (file)
@@ -7464,7 +7464,11 @@ mdb_rebalance(MDB_cursor *mc)
        minkeys = 1 + (IS_BRANCH(mn.mc_pg[mn.mc_top]));
        if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= FILL_THRESHOLD && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) {
                rc = mdb_node_move(&mn, mc);
-               mc->mc_ki[mc->mc_top] = oldki;
+               if (mc->mc_ki[ptop] == 0) {
+                       mc->mc_ki[mc->mc_top] = oldki;
+               } else {
+                       mc->mc_ki[mc->mc_top] = oldki + 1;
+               }
        } else {
                if (mc->mc_ki[ptop] == 0) {
                        rc = mdb_page_merge(&mn, mc);
@@ -7473,7 +7477,7 @@ mdb_rebalance(MDB_cursor *mc)
                        unsigned int nkeys = NUMKEYS(mn.mc_pg[mn.mc_top]);
                        mn.mc_ki[mn.mc_top] += mc->mc_ki[mn.mc_top] + 1;
                        rc = mdb_page_merge(mc, &mn);
-                       mdb_cursor_copy(&mn, mc);
+                       mc->mc_pg[mc->mc_top] = mn.mc_pg[mn.mc_top];
                        mc->mc_ki[mc->mc_top] = oldki + nkeys;
                }
                mc->mc_flags &= ~C_EOF;