summaryrefslogtreecommitdiffstats
path: root/lib/libc/db
diff options
context:
space:
mode:
authorguido <guido@FreeBSD.org>1998-06-25 18:50:06 +0000
committerguido <guido@FreeBSD.org>1998-06-25 18:50:06 +0000
commitbf3ddf370de2e66b091a53016b595372edd2e6de (patch)
treeec4d21ae53340429d89145d2fbef4a9978ab47f0 /lib/libc/db
parentc6c8ca45cd01d561b7a60e45f816463c4a147d86 (diff)
downloadFreeBSD-src-bf3ddf370de2e66b091a53016b595372edd2e6de.zip
FreeBSD-src-bf3ddf370de2e66b091a53016b595372edd2e6de.tar.gz
Fix btree problems. This passes regressions tests.
PR: 7009 Obtained from: http://www.sleepycat.com/update/patch.185.html, patches 1.2, 1.3 and 1.4
Diffstat (limited to 'lib/libc/db')
-rw-r--r--lib/libc/db/btree/bt_page.c2
-rw-r--r--lib/libc/db/btree/bt_split.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/db/btree/bt_page.c b/lib/libc/db/btree/bt_page.c
index 0d9d138..ce9cbf1 100644
--- a/lib/libc/db/btree/bt_page.c
+++ b/lib/libc/db/btree/bt_page.c
@@ -65,6 +65,7 @@ __bt_free(t, h)
h->prevpg = P_INVALID;
h->nextpg = t->bt_free;
t->bt_free = h->pgno;
+ F_SET(t, B_METADIRTY);
/* Make sure the page gets written back. */
return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
@@ -92,6 +93,7 @@ __bt_new(t, npg)
(h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
*npg = t->bt_free;
t->bt_free = h->nextpg;
+ F_SET(t, B_METADIRTY);
return (h);
}
return (mpool_new(t->bt_mp, npg));
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c
index 1646d82..c7779b8 100644
--- a/lib/libc/db/btree/bt_split.c
+++ b/lib/libc/db/btree/bt_split.c
@@ -673,7 +673,8 @@ bt_psplit(t, h, l, r, pskip, ilen)
* where we decide to try and copy too much onto the left page.
* Make sure that doesn't happen.
*/
- if (skip <= off && used + nbytes >= full) {
+ if (skip <= off &&
+ used + nbytes + sizeof(indx_t) >= full || nxt == top - 1) {
--off;
break;
}
@@ -686,7 +687,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
memmove((char *)l + l->upper, src, nbytes);
}
- used += nbytes;
+ used += nbytes + sizeof(indx_t);
if (used >= half) {
if (!isbigkey || bigkeycnt == 3)
break;
OpenPOWER on IntegriCloud