From: Howard Chu Date: Wed, 4 Nov 2015 20:38:30 +0000 (+0000) Subject: ITS#8300 fix rebalance after node_move X-Git-Tag: LMDB_0.9.17~51 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=af45cf3a04bc86d17c879e944d367661a6d34aaf;p=openldap ITS#8300 fix rebalance after node_move 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.) --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 0bff10e759..37bdee9894 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -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 {