]> git.sur5r.net Git - openldap/commitdiff
ITS#8300 fix rebalance after node_move
authorHoward Chu <hyc@openldap.org>
Wed, 4 Nov 2015 20:38:30 +0000 (20:38 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 4 Nov 2015 20:38:30 +0000 (20:38 +0000)
ITS#8258, ITS#7829 fixes checked parent index to see if we were moving
from a left neighbor. Should have just checked to see if current index
was 0, meaning we added on the left. (Parent index may not tell us
anything meaningful after a nested rebalance.)

libraries/liblmdb/mdb.c

index 0bff10e75933687912cb62909bf0f3e6bbac2efd..37bdee98943a97e9f331586065c6d2ccb3a81632 100644 (file)
@@ -8009,7 +8009,8 @@ mdb_rebalance(MDB_cursor *mc)
         */
        if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= thresh && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) {
                rc = mdb_node_move(&mn, mc);
-               if (mc->mc_ki[mc->mc_top-1]) {
+               if (!mc->mc_ki[mc->mc_top]) {
+                       /* if we inserted on left, bump position up */
                        oldki++;
                }
        } else {