diff options
author | guido <guido@FreeBSD.org> | 1998-06-25 18:50:06 +0000 |
---|---|---|
committer | guido <guido@FreeBSD.org> | 1998-06-25 18:50:06 +0000 |
commit | bf3ddf370de2e66b091a53016b595372edd2e6de (patch) | |
tree | ec4d21ae53340429d89145d2fbef4a9978ab47f0 /lib/libc/db/btree/bt_split.c | |
parent | c6c8ca45cd01d561b7a60e45f816463c4a147d86 (diff) | |
download | FreeBSD-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.c | 5 |
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; |