1 /* $NetBSD: bt_split.c,v 1.20 2011/06/20 09:11:17 mrg Exp $ */
4 * Copyright (c) 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #if HAVE_NBTOOL_CONFIG_H
36 #include "nbtool_config.h"
39 #include <sys/cdefs.h>
40 __RCSID("$NetBSD: bt_split.c,v 1.20 2011/06/20 09:11:17 mrg Exp $");
42 #include "namespace.h"
43 #include <sys/types.h>
54 static int bt_broot(BTREE
*, PAGE
*, PAGE
*, PAGE
*);
55 static PAGE
*bt_page(BTREE
*, PAGE
*, PAGE
**, PAGE
**, indx_t
*, size_t);
56 static int bt_preserve(BTREE
*, pgno_t
);
57 static PAGE
*bt_psplit(BTREE
*, PAGE
*, PAGE
*, PAGE
*, indx_t
*, size_t);
58 static PAGE
*bt_root(BTREE
*, PAGE
*, PAGE
**, PAGE
**, indx_t
*, size_t);
59 static int bt_rroot(BTREE
*, PAGE
*, PAGE
*, PAGE
*);
60 static recno_t
rec_total(PAGE
*);
63 unsigned long bt_rootsplit
, bt_split
, bt_sortsplit
, bt_pfxsaved
;
67 * __BT_SPLIT -- Split the tree.
73 * data: data to insert
74 * flags: BIGKEY/BIGDATA flags
76 * skip: index to leave open
79 * RET_ERROR, RET_SUCCESS
82 __bt_split(BTREE
*t
, PAGE
*sp
, const DBT
*key
, const DBT
*data
, int flags
,
83 size_t ilen
, uint32_t argskip
)
85 BINTERNAL
*bi
= NULL
; /* pacify gcc */
86 BLEAF
*bl
= NULL
, *tbl
; /* pacify gcc */
89 PAGE
*h
, *l
, *r
, *lchild
, *rchild
;
92 uint32_t n
, nbytes
, nksize
= 0; /* pacify gcc */
97 * Split the page into two pages, l and r. The split routines return
98 * a pointer to the page into which the key should be inserted and with
99 * skip set to the offset which should be used. Additionally, l and r
103 h
= sp
->pgno
== P_ROOT
?
104 bt_root(t
, sp
, &l
, &r
, &skip
, ilen
) :
105 bt_page(t
, sp
, &l
, &r
, &skip
, ilen
);
110 * Insert the new key/data pair into the leaf page. (Key inserts
111 * always cause a leaf page to split first.)
113 _DBFIT(ilen
, indx_t
);
114 h
->upper
-= (indx_t
)ilen
;
115 h
->linp
[skip
] = h
->upper
;
116 dest
= (char *)(void *)h
+ h
->upper
;
117 if (F_ISSET(t
, R_RECNO
))
118 WR_RLEAF(dest
, data
, flags
);
120 WR_BLEAF(dest
, key
, data
, flags
);
122 /* If the root page was split, make it look right. */
123 if (sp
->pgno
== P_ROOT
&&
124 (F_ISSET(t
, R_RECNO
) ?
125 bt_rroot(t
, sp
, l
, r
) : bt_broot(t
, sp
, l
, r
)) == RET_ERROR
)
129 * Now we walk the parent page stack -- a LIFO stack of the pages that
130 * were traversed when we searched for the page that split. Each stack
131 * entry is a page number and a page index offset. The offset is for
132 * the page traversed on the search. We've just split a page, so we
133 * have to insert a new key into the parent page.
135 * If the insert into the parent page causes it to split, may have to
136 * continue splitting all the way up the tree. We stop if the root
137 * splits or the page inserted into didn't have to split to hold the
138 * new key. Some algorithms replace the key for the old page as well
139 * as the new page. We don't, as there's no reason to believe that the
140 * first key on the old page is any better than the key we have, and,
141 * in the case of a key being placed at index 0 causing the split, the
142 * key is unavailable.
144 * There are a maximum of 5 pages pinned at any time. We keep the left
145 * and right pages pinned while working on the parent. The 5 are the
146 * two children, left parent and right parent (when the parent splits)
147 * and the root page or the overflow key page when calling bt_preserve.
148 * This code must make sure that all pins are released other than the
149 * root page or overflow page which is unlocked elsewhere.
151 while ((parent
= BT_POP(t
)) != NULL
) {
155 /* Get the parent page. */
156 if ((h
= mpool_get(t
->bt_mp
, parent
->pgno
, 0)) == NULL
)
160 * The new key goes ONE AFTER the index, because the split
163 skip
= parent
->index
+ 1;
166 * Calculate the space needed on the parent page.
168 * Prefix trees: space hack when inserting into BINTERNAL
169 * pages. Retain only what's needed to distinguish between
170 * the new entry and the LAST entry on the page to its left.
171 * If the keys compare equal, retain the entire key. Note,
172 * we don't touch overflow keys, and the entire key must be
173 * retained for the next-to-left most key on the leftmost
174 * page of each level, or the search will fail. Applicable
175 * ONLY to internal pages that have leaf pages as children.
176 * Further reduction of the key between pairs of internal
177 * pages loses too much information.
179 switch (rchild
->flags
& P_TYPE
) {
181 bi
= GETBINTERNAL(rchild
, 0);
182 nbytes
= NBINTERNAL(bi
->ksize
);
185 bl
= GETBLEAF(rchild
, 0);
186 nbytes
= NBINTERNAL(bl
->ksize
);
187 if (t
->bt_pfx
&& !(bl
->flags
& P_BIGKEY
) &&
188 (h
->prevpg
!= P_INVALID
|| skip
> 1)) {
190 tbl
= GETBLEAF(lchild
, NEXTINDEX(lchild
) - 1);
195 temp
= t
->bt_pfx(&a
, &b
);
196 _DBFIT(temp
, uint32_t);
197 nksize
= (uint32_t)temp
;
198 n
= NBINTERNAL(nksize
);
201 bt_pfxsaved
+= nbytes
- n
;
217 /* Split the parent page if necessary or shift the indices. */
218 if ((uint32_t)h
->upper
- (uint32_t)h
->lower
< nbytes
+ sizeof(indx_t
)) {
220 h
= h
->pgno
== P_ROOT
?
221 bt_root(t
, h
, &l
, &r
, &skip
, nbytes
) :
222 bt_page(t
, h
, &l
, &r
, &skip
, nbytes
);
227 if (skip
< (nxtindex
= NEXTINDEX(h
)))
228 memmove(h
->linp
+ skip
+ 1, h
->linp
+ skip
,
229 (nxtindex
- skip
) * sizeof(indx_t
));
230 h
->lower
+= sizeof(indx_t
);
234 /* Insert the key into the parent page. */
235 switch (rchild
->flags
& P_TYPE
) {
237 h
->linp
[skip
] = h
->upper
-= nbytes
;
238 dest
= (char *)(void *)h
+ h
->linp
[skip
];
239 memmove(dest
, bi
, nbytes
);
240 ((BINTERNAL
*)(void *)dest
)->pgno
= rchild
->pgno
;
243 h
->linp
[skip
] = h
->upper
-= nbytes
;
244 dest
= (char *)(void *)h
+ h
->linp
[skip
];
245 WR_BINTERNAL(dest
, nksize
? nksize
: bl
->ksize
,
246 rchild
->pgno
, bl
->flags
& P_BIGKEY
);
247 memmove(dest
, bl
->bytes
, nksize
? nksize
: bl
->ksize
);
248 if (bl
->flags
& P_BIGKEY
) {
250 memcpy(&pgno
, bl
->bytes
, sizeof(pgno
));
251 if (bt_preserve(t
, pgno
) == RET_ERROR
)
257 * Update the left page count. If split
258 * added at index 0, fix the correct page.
261 dest
= (char *)(void *)h
+ h
->linp
[skip
- 1];
263 dest
= (char *)(void *)l
+ l
->linp
[NEXTINDEX(l
) - 1];
264 ((RINTERNAL
*)(void *)dest
)->nrecs
= rec_total(lchild
);
265 ((RINTERNAL
*)(void *)dest
)->pgno
= lchild
->pgno
;
267 /* Update the right page count. */
268 h
->linp
[skip
] = h
->upper
-= nbytes
;
269 dest
= (char *)(void *)h
+ h
->linp
[skip
];
270 ((RINTERNAL
*)(void *)dest
)->nrecs
= rec_total(rchild
);
271 ((RINTERNAL
*)(void *)dest
)->pgno
= rchild
->pgno
;
275 * Update the left page count. If split
276 * added at index 0, fix the correct page.
279 dest
= (char *)(void *)h
+ h
->linp
[skip
- 1];
281 dest
= (char *)(void *)l
+ l
->linp
[NEXTINDEX(l
) - 1];
282 ((RINTERNAL
*)(void *)dest
)->nrecs
= NEXTINDEX(lchild
);
283 ((RINTERNAL
*)(void *)dest
)->pgno
= lchild
->pgno
;
285 /* Update the right page count. */
286 h
->linp
[skip
] = h
->upper
-= nbytes
;
287 dest
= (char *)(void *)h
+ h
->linp
[skip
];
288 ((RINTERNAL
*)(void *)dest
)->nrecs
= NEXTINDEX(rchild
);
289 ((RINTERNAL
*)(void *)dest
)->pgno
= rchild
->pgno
;
295 /* Unpin the held pages. */
297 mpool_put(t
->bt_mp
, h
, MPOOL_DIRTY
);
301 /* If the root page was split, make it look right. */
302 if (sp
->pgno
== P_ROOT
&&
303 (F_ISSET(t
, R_RECNO
) ?
304 bt_rroot(t
, sp
, l
, r
) : bt_broot(t
, sp
, l
, r
)) == RET_ERROR
)
307 mpool_put(t
->bt_mp
, lchild
, MPOOL_DIRTY
);
308 mpool_put(t
->bt_mp
, rchild
, MPOOL_DIRTY
);
311 /* Unpin the held pages. */
312 mpool_put(t
->bt_mp
, l
, MPOOL_DIRTY
);
313 mpool_put(t
->bt_mp
, r
, MPOOL_DIRTY
);
315 /* Clear any pages left on the stack. */
316 return (RET_SUCCESS
);
319 * If something fails in the above loop we were already walking back
320 * up the tree and the tree is now inconsistent. Nothing much we can
321 * do about it but release any memory we're holding.
323 err1
: mpool_put(t
->bt_mp
, lchild
, MPOOL_DIRTY
);
324 mpool_put(t
->bt_mp
, rchild
, MPOOL_DIRTY
);
326 err2
: mpool_put(t
->bt_mp
, l
, 0);
327 mpool_put(t
->bt_mp
, r
, 0);
328 __dbpanic(t
->bt_dbp
);
333 * BT_PAGE -- Split a non-root page of a btree.
338 * lp: pointer to left page pointer
339 * rp: pointer to right page pointer
340 * skip: pointer to index to leave open
341 * ilen: insert length
344 * Pointer to page in which to insert or NULL on error.
347 bt_page(BTREE
*t
, PAGE
*h
, PAGE
**lp
, PAGE
**rp
, indx_t
*skip
, size_t ilen
)
355 /* Put the new right page for the split into place. */
356 if ((r
= __bt_new(t
, &npg
)) == NULL
)
359 r
->lower
= BTDATAOFF
;
360 r
->upper
= t
->bt_psize
;
361 r
->nextpg
= h
->nextpg
;
363 r
->flags
= h
->flags
& P_TYPE
;
366 * If we're splitting the last page on a level because we're appending
367 * a key to it (skip is NEXTINDEX()), it's likely that the data is
368 * sorted. Adding an empty page on the side of the level is less work
369 * and can push the fill factor much higher than normal. If we're
370 * wrong it's no big deal, we'll just do the split the right way next
371 * time. It may look like it's equally easy to do a similar hack for
372 * reverse sorted data, that is, split the tree left, but it's not.
375 if (h
->nextpg
== P_INVALID
&& *skip
== NEXTINDEX(h
)) {
380 r
->lower
= BTDATAOFF
+ sizeof(indx_t
);
387 /* Put the new left page for the split into place. */
388 if ((l
= calloc(1, t
->bt_psize
)) == NULL
) {
389 mpool_put(t
->bt_mp
, r
, 0);
393 memset(l
, 0xff, t
->bt_psize
);
397 l
->prevpg
= h
->prevpg
;
398 l
->lower
= BTDATAOFF
;
399 l
->upper
= t
->bt_psize
;
400 l
->flags
= h
->flags
& P_TYPE
;
402 /* Fix up the previous pointer of the page after the split page. */
403 if (h
->nextpg
!= P_INVALID
) {
404 if ((tp
= mpool_get(t
->bt_mp
, h
->nextpg
, 0)) == NULL
) {
406 /* XXX mpool_free(t->bt_mp, r->pgno); */
409 tp
->prevpg
= r
->pgno
;
410 mpool_put(t
->bt_mp
, tp
, MPOOL_DIRTY
);
414 * Split right. The key/data pairs aren't sorted in the btree page so
415 * it's simpler to copy the data from the split page onto two new pages
416 * instead of copying half the data to the right page and compacting
417 * the left page in place. Since the left page can't change, we have
418 * to swap the original and the allocated left page after the split.
420 tp
= bt_psplit(t
, h
, l
, r
, skip
, ilen
);
422 /* Move the new left page onto the old left page. */
423 memmove(h
, l
, t
->bt_psize
);
434 * BT_ROOT -- Split the root page of a btree.
439 * lp: pointer to left page pointer
440 * rp: pointer to right page pointer
441 * skip: pointer to index to leave open
442 * ilen: insert length
445 * Pointer to page in which to insert or NULL on error.
448 bt_root(BTREE
*t
, PAGE
*h
, PAGE
**lp
, PAGE
**rp
, indx_t
*skip
, size_t ilen
)
457 /* Put the new left and right pages for the split into place. */
458 if ((l
= __bt_new(t
, &lnpg
)) == NULL
||
459 (r
= __bt_new(t
, &rnpg
)) == NULL
)
465 l
->prevpg
= r
->nextpg
= P_INVALID
;
466 l
->lower
= r
->lower
= BTDATAOFF
;
467 l
->upper
= r
->upper
= t
->bt_psize
;
468 l
->flags
= r
->flags
= h
->flags
& P_TYPE
;
470 /* Split the root page. */
471 tp
= bt_psplit(t
, h
, l
, r
, skip
, ilen
);
479 * BT_RROOT -- Fix up the recno root page after it has been split.
488 * RET_ERROR, RET_SUCCESS
491 bt_rroot(BTREE
*t
, PAGE
*h
, PAGE
*l
, PAGE
*r
)
497 temp
= t
->bt_psize
- NRINTERNAL
;
498 _DBFIT(temp
, uint32_t);
501 /* Insert the left and right keys, set the header information. */
503 h
->linp
[0] = h
->upper
= (indx_t
)sz
;
504 dest
= (char *)(void *)h
+ h
->upper
;
506 l
->flags
& P_RLEAF
? NEXTINDEX(l
) : rec_total(l
), l
->pgno
);
508 h
->linp
[1] = h
->upper
-= NRINTERNAL
;
509 dest
= (char *)(void *)h
+ h
->upper
;
511 r
->flags
& P_RLEAF
? NEXTINDEX(r
) : rec_total(r
), r
->pgno
);
513 h
->lower
= BTDATAOFF
+ 2 * sizeof(indx_t
);
515 /* Unpin the root page, set to recno internal page. */
517 h
->flags
|= P_RINTERNAL
;
518 mpool_put(t
->bt_mp
, h
, MPOOL_DIRTY
);
520 return (RET_SUCCESS
);
524 * BT_BROOT -- Fix up the btree root page after it has been split.
533 * RET_ERROR, RET_SUCCESS
536 bt_broot(BTREE
*t
, PAGE
*h
, PAGE
*l
, PAGE
*r
)
538 BINTERNAL
*bi
= NULL
; /* pacify gcc */
544 * If the root page was a leaf page, change it into an internal page.
545 * We copy the key we split on (but not the key's data, in the case of
546 * a leaf page) to the new root page.
548 * The btree comparison code guarantees that the left-most key on any
549 * level of the tree is never used, so it doesn't need to be filled in.
551 nbytes
= NBINTERNAL(0);
552 h
->linp
[0] = h
->upper
= t
->bt_psize
- nbytes
;
553 dest
= (char *)(void *)h
+ h
->upper
;
554 WR_BINTERNAL(dest
, 0, l
->pgno
, 0);
556 switch (h
->flags
& P_TYPE
) {
559 nbytes
= NBINTERNAL(bl
->ksize
);
560 h
->linp
[1] = h
->upper
-= nbytes
;
561 dest
= (char *)(void *)h
+ h
->upper
;
562 WR_BINTERNAL(dest
, bl
->ksize
, r
->pgno
, 0);
563 memmove(dest
, bl
->bytes
, bl
->ksize
);
566 * If the key is on an overflow page, mark the overflow chain
567 * so it isn't deleted when the leaf copy of the key is deleted.
569 if (bl
->flags
& P_BIGKEY
) {
571 memcpy(&pgno
, bl
->bytes
, sizeof(pgno
));
572 if (bt_preserve(t
, pgno
) == RET_ERROR
)
577 bi
= GETBINTERNAL(r
, 0);
578 nbytes
= NBINTERNAL(bi
->ksize
);
579 h
->linp
[1] = h
->upper
-= nbytes
;
580 dest
= (char *)(void *)h
+ h
->upper
;
581 memmove(dest
, bi
, nbytes
);
582 ((BINTERNAL
*)(void *)dest
)->pgno
= r
->pgno
;
588 /* There are two keys on the page. */
589 h
->lower
= BTDATAOFF
+ 2 * sizeof(indx_t
);
591 /* Unpin the root page, set to btree internal page. */
593 h
->flags
|= P_BINTERNAL
;
594 mpool_put(t
->bt_mp
, h
, MPOOL_DIRTY
);
596 return (RET_SUCCESS
);
600 * BT_PSPLIT -- Do the real work of splitting the page.
604 * h: page to be split
605 * l: page to put lower half of data
606 * r: page to put upper half of data
607 * pskip: pointer to index to leave open
608 * ilen: insert length
611 * Pointer to page in which to insert.
614 bt_psplit(BTREE
*t
, PAGE
*h
, PAGE
*l
, PAGE
*r
, indx_t
*pskip
, size_t ilen
)
621 void *src
= NULL
; /* pacify gcc */
622 indx_t full
, half
, nxt
, off
, skip
, top
, used
;
625 int bigkeycnt
, isbigkey
;
628 * Split the data to the left and right pages. Leave the skip index
629 * open. Additionally, make some effort not to split on an overflow
630 * key. This makes internal page processing faster and can save
631 * space as overflow keys used by internal pages are never deleted.
635 temp
= t
->bt_psize
- BTDATAOFF
;
636 _DBFIT(temp
, indx_t
);
640 for (nxt
= off
= 0, top
= NEXTINDEX(h
); nxt
< top
; ++off
) {
642 _DBFIT(ilen
, uint32_t);
643 nbytes
= (uint32_t)ilen
;
644 isbigkey
= 0; /* XXX: not really known. */
646 switch (h
->flags
& P_TYPE
) {
648 src
= bi
= GETBINTERNAL(h
, nxt
);
649 nbytes
= NBINTERNAL(bi
->ksize
);
650 isbigkey
= bi
->flags
& P_BIGKEY
;
653 src
= bl
= GETBLEAF(h
, nxt
);
655 isbigkey
= bl
->flags
& P_BIGKEY
;
658 src
= GETRINTERNAL(h
, nxt
);
663 src
= rl
= GETRLEAF(h
, nxt
);
672 * If the key/data pairs are substantial fractions of the max
673 * possible size for the page, it's possible to get situations
674 * where we decide to try and copy too much onto the left page.
675 * Make sure that doesn't happen.
677 if ((skip
<= off
&& used
+ nbytes
+ sizeof(indx_t
) >= full
) ||
683 /* Copy the key/data pair, if not the skipped index. */
687 l
->linp
[off
] = l
->upper
-= nbytes
;
688 memmove((char *)(void *)l
+ l
->upper
, src
, nbytes
);
691 temp
= nbytes
+ sizeof(indx_t
);
692 _DBFIT(temp
, indx_t
);
693 used
+= (indx_t
)temp
;
695 if (!isbigkey
|| bigkeycnt
== 3)
703 * Off is the last offset that's valid for the left page.
704 * Nxt is the first offset to be placed on the right page.
706 temp
= (off
+ 1) * sizeof(indx_t
);
707 _DBFIT(temp
, indx_t
);
708 l
->lower
+= (indx_t
)temp
;
711 * If splitting the page that the cursor was on, the cursor has to be
712 * adjusted to point to the same record as before the split. If the
713 * cursor is at or past the skipped slot, the cursor is incremented by
714 * one. If the cursor is on the right page, it is decremented by the
715 * number of records split to the left page.
718 if (F_ISSET(c
, CURS_INIT
) && c
->pg
.pgno
== h
->pgno
) {
719 if (c
->pg
.index
>= skip
)
721 if (c
->pg
.index
< nxt
) /* Left page. */
722 c
->pg
.pgno
= l
->pgno
;
723 else { /* Right page. */
724 c
->pg
.pgno
= r
->pgno
;
730 * If the skipped index was on the left page, just return that page.
731 * Otherwise, adjust the skip index to reflect the new position on
735 skip
= MAX_PAGE_OFFSET
;
742 for (off
= 0; nxt
< top
; ++off
) {
745 skip
= MAX_PAGE_OFFSET
;
747 switch (h
->flags
& P_TYPE
) {
749 src
= bi
= GETBINTERNAL(h
, nxt
);
750 nbytes
= NBINTERNAL(bi
->ksize
);
753 src
= bl
= GETBLEAF(h
, nxt
);
757 src
= GETRINTERNAL(h
, nxt
);
761 src
= rl
= GETRLEAF(h
, nxt
);
768 r
->linp
[off
] = r
->upper
-= nbytes
;
769 memmove((char *)(void *)r
+ r
->upper
, src
, nbytes
);
771 temp
= off
* sizeof(indx_t
);
772 _DBFIT(temp
, indx_t
);
773 r
->lower
+= (indx_t
)temp
;
775 /* If the key is being appended to the page, adjust the index. */
777 r
->lower
+= sizeof(indx_t
);
783 * BT_PRESERVE -- Mark a chain of pages as used by an internal node.
785 * Chains of indirect blocks pointed to by leaf nodes get reclaimed when the
786 * record that references them gets deleted. Chains pointed to by internal
787 * pages never get deleted. This routine marks a chain as pointed to by an
792 * pg: page number of first page in the chain.
795 * RET_SUCCESS, RET_ERROR.
798 bt_preserve(BTREE
*t
, pgno_t pg
)
802 if ((h
= mpool_get(t
->bt_mp
, pg
, 0)) == NULL
)
804 h
->flags
|= P_PRESERVE
;
805 mpool_put(t
->bt_mp
, h
, MPOOL_DIRTY
);
806 return (RET_SUCCESS
);
810 * REC_TOTAL -- Return the number of recno entries below a page.
816 * The number of recno entries below a page.
819 * These values could be set by the bt_psplit routine. The problem is that the
820 * entry has to be popped off of the stack etc. or the values have to be passed
821 * all the way back to bt_split/bt_rroot and it's not very clean.
829 for (recs
= 0, nxt
= 0, top
= NEXTINDEX(h
); nxt
< top
; ++nxt
)
830 recs
+= GETRINTERNAL(h
, nxt
)->nrecs
;