]> git.sur5r.net Git - openldap/commitdiff
ITS#7815 fix mdb_page_split
authorHoward Chu <hyc@symas.com>
Thu, 6 Mar 2014 04:04:42 +0000 (20:04 -0800)
committerHoward Chu <hyc@symas.com>
Thu, 6 Mar 2014 04:04:42 +0000 (20:04 -0800)
Was leaving cursor pointed at wrong page if the newindx was
in the right sibling page, and the parent was also split.

libraries/liblmdb/mdb.c

index 5a607a4c7e96d0324ec7086036f660191cca42fb..4f0081c6fc4f1eb4601a8f53e8b1244e040cf555 100644 (file)
@@ -7857,12 +7857,10 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno
                         */
                        if (mn.mc_pg[ptop] != mc->mc_pg[ptop] &&
                                mc->mc_ki[ptop] >= NUMKEYS(mc->mc_pg[ptop])) {
-                               for (i=0; i<ptop; i++) {
+                               for (i=0; i<=ptop; i++) {
                                        mc->mc_pg[i] = mn.mc_pg[i];
                                        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;
                        }
                }
                /* return tmp page to freelist */