* btree/bt_split.c (bt_psplit): Correctly account for
authorTom Yu <tlyu@mit.edu>
Wed, 28 Aug 2002 06:34:05 +0000 (06:34 +0000)
committerTom Yu <tlyu@mit.edu>
Wed, 28 Aug 2002 06:34:05 +0000 (06:34 +0000)
sizeof(indx_t) when computing space used in a page by an item.
[patch from www.sleepycat.com]

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14780 dc483132-0cff-0310-8789-dd5450dbe970

src/util/db2/ChangeLog
src/util/db2/btree/bt_split.c

index dc6eff0a598cdadc50aaabf9ae636d265b0413bc..9c04afed202f275ad9c7aa9bd541ec93c4ac0b93 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-28  Tom Yu  <tlyu@mit.edu>
+
+       * btree/bt_split.c (bt_psplit): Correctly account for
+       sizeof(indx_t) when computing space used in a page by an item.
+       [patch from www.sleepycat.com]
+
 2002-08-23  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in, btree/Makefile.in, clib/Makefile.in,
index c6319b55f945b7aefa79e6ddd147ee2d906962fd..0cc6cf09bca090a47568926564963d41737832d5 100644 (file)
@@ -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) || nxt == top - 1) {
+               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;