]> git.sur5r.net Git - openldap/commitdiff
ITS#8316 cursor fixup in page_merge
authorHoward Chu <hyc@openldap.org>
Thu, 19 Nov 2015 20:04:16 +0000 (20:04 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 23 Nov 2015 01:47:39 +0000 (01:47 +0000)
Deleting the merged page requires bumping down other ki's
of the page's parent.

libraries/liblmdb/mdb.c

index 5cd4536efb0ea48e54dcf4da8e6a234d3d97aa14..819a6319109df39887c6cad9cdd6a7e91562edca 100644 (file)
@@ -7842,6 +7842,9 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst)
                                m3->mc_pg[top] = pdst;
                                m3->mc_ki[top] += nkeys;
                                m3->mc_ki[top-1] = cdst->mc_ki[top-1];
+                       } else if (m3->mc_pg[top-1] == csrc->mc_pg[top-1] &&
+                               m3->mc_ki[top-1] > csrc->mc_ki[top-1]) {
+                               m3->mc_ki[top-1]--;
                        }
                }
        }