From: Howard Chu Date: Thu, 6 Mar 2014 04:40:12 +0000 (-0800) Subject: ITS#7815 more for page_split X-Git-Tag: OPENLDAP_REL_ENG_2_4_40~132^2~34 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=797ff136a8852d8301a946a2f29b2c34caa084d0;p=openldap ITS#7815 more for page_split This case didn't come up in testing. Needs finer grained test. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 4f0081c6fc..fd0a3b5696 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -7765,7 +7765,13 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno mc->mc_ki[i] = mn.mc_ki[i]; } mc->mc_pg[ptop] = mn.mc_pg[ptop]; - mc->mc_ki[ptop] = mn.mc_ki[ptop] - 1; + if (mn.mc_ki[ptop]) { + mc->mc_ki[ptop] = mn.mc_ki[ptop] - 1; + } else { + /* find right page's left sibling */ + mc->mc_ki[ptop] = mn.mc_ki[ptop]; + mdb_cursor_sibling(mc, 0); + } } } else { mn.mc_top--;