]> git.sur5r.net Git - openldap/commitdiff
ITS#7815 more for page_split
authorHoward Chu <hyc@symas.com>
Thu, 6 Mar 2014 04:40:12 +0000 (20:40 -0800)
committerHoward Chu <hyc@symas.com>
Thu, 6 Mar 2014 04:40:12 +0000 (20:40 -0800)
This case didn't come up in testing. Needs finer grained test.

libraries/liblmdb/mdb.c

index 4f0081c6fc4f1eb4601a8f53e8b1244e040cf555..fd0a3b56961c3593eb561d9f1b363303d586f898 100644 (file)
@@ -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--;