summaryrefslogtreecommitdiffstats
path: root/lib/libc/db/btree/bt_split.c
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/btree/bt_split.c
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/btree/bt_split.c')
-rw-r--r--lib/libc/db/btree/bt_split.c5
1 files changed, 3 insertions, 2 deletions
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