From: Howard Chu Date: Wed, 9 Oct 2013 09:24:45 +0000 (-0700) Subject: ITS#7722 fix page_merge for collapsing root X-Git-Tag: OPENLDAP_REL_ENG_2_4_37~12^2~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=940f5cb3736bf21fef1f4faa6c653cf2bb28f78d;p=openldap ITS#7722 fix page_merge for collapsing root Other cursors being fixed up are not necessarily height 1. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index e935dc633a..f282f185d4 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -7161,10 +7161,13 @@ mdb_rebalance(MDB_cursor *mc) m3 = m2; if (m3 == mc || m3->mc_snum < mc->mc_snum) continue; if (m3->mc_pg[0] == mp) { - m3->mc_pg[0] = mc->mc_pg[0]; - m3->mc_snum = 1; - m3->mc_top = 0; - m3->mc_ki[0] = m3->mc_ki[1]; + int i; + m3->mc_snum--; + m3->mc_top--; + for (i=0; imc_snum; i++) { + m3->mc_pg[i] = m3->mc_pg[i+1]; + m3->mc_ki[i] = m3->mc_ki[i+1]; + } } } }