]> git.sur5r.net Git - openldap/commitdiff
ITS#7701 fix mdb_rebalance
authorHoward Chu <hyc@symas.com>
Sat, 21 Sep 2013 21:37:11 +0000 (14:37 -0700)
committerHoward Chu <hyc@symas.com>
Sat, 21 Sep 2013 21:37:11 +0000 (14:37 -0700)
Must copy tmp cursor back to real cursor when merging into tmp cursor.

libraries/liblmdb/mdb.c

index 9c5e7389de17f0d71764ac048b80fa44796e7583..e5313b0c8516609aa9d78e423f93743127a2b325 100644 (file)
@@ -7248,8 +7248,11 @@ mdb_rebalance(MDB_cursor *mc)
        else {
                if (mc->mc_ki[ptop] == 0)
                        rc = mdb_page_merge(&mn, mc);
-               else
+               else {
+                       mn.mc_ki[mn.mc_top] += mc->mc_ki[mn.mc_top] + 1;
                        rc = mdb_page_merge(mc, &mn);
+                       mdb_cursor_copy(&mn, mc);
+               }
                mc->mc_flags &= ~(C_INITIALIZED|C_EOF);
        }
        return rc;