37 #if defined(LIBC_SCCS) && !defined(lint) 38 static char sccsid[] =
"@(#)bt_split.c 8.9 (Berkeley) 7/26/94";
41 #include <sys/types.h> 48 #include "../include/db.h" 63 u_long bt_rootsplit, bt_split, bt_sortsplit, bt_pfxsaved;
85 const DBT *key, *data;
94 PAGE *h, *l, *r, *lchild, *rchild;
109 bt_root(t, sp, &l, &r, &skip, ilen) :
110 bt_page(t, sp, &l, &r, &skip, ilen);
119 dest = (
char *)h + h->
upper;
166 skip = parent->
index + 1;
197 nksize = t->bt_pfx(&a, &b);
201 bt_pfxsaved += nbytes - n;
219 < nbytes +
sizeof(
indx_t)) {
222 bt_root(t, h, &l, &r, &skip, nbytes) :
223 bt_page(t, h, &l, &r, &skip, nbytes);
229 memmove(h->
linp + skip + 1, h->
linp + skip,
230 (nxtindex - skip) *
sizeof(
indx_t));
239 dest = (
char *)h + h->
linp[skip];
240 memmove(dest, bi, nbytes);
245 dest = (
char *)h + h->
linp[skip];
248 memmove(dest, bl->
bytes, nksize ? nksize : bl->
ksize);
259 dest = (
char *)h + h->
linp[skip - 1];
267 dest = (
char *)h + h->
linp[skip];
277 dest = (
char *)h + h->
linp[skip - 1];
285 dest = (
char *)h + h->
linp[skip];
505 dest = (
char *)h + h->
upper;
510 dest = (
char *)h + h->
upper;
556 dest = (
char *)h + h->
upper;
564 dest = (
char *)h + h->
upper;
580 dest = (
char *)h + h->
upper;
581 memmove(dest, bi, nbytes);
626 indx_t full, half, nxt, off, skip, top, used;
628 int bigkeycnt, isbigkey;
641 for (nxt = off = 0, top =
NEXTINDEX(h); nxt < top; ++off) {
677 if ((skip <= off && used + nbytes +
sizeof(
indx_t) >= full)
688 memmove((
char *)l + l->
upper, src, nbytes);
691 used += nbytes +
sizeof(
indx_t);
693 if (!isbigkey || bigkeycnt == 3)
738 for (off = 0; nxt < top; ++off) {
765 memmove((
char *)r + r->
upper, src, nbytes);
826 for (recs = 0, nxt = 0, top =
NEXTINDEX(h); nxt < top; ++nxt)
static PAGE * bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen)
#define GETBLEAF(pg, indx)
#define WR_RLEAF(p, data, flags)
#define GETRLEAF(pg, indx)
int mpool_put(MPOOL *mp, void *page, u_int flags)
static int bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
#define GETBINTERNAL(pg, indx)
static int bt_preserve(BTREE *t, pgno_t pg)
#define WR_BINTERNAL(p, size, pgno, flags)
#define GETRINTERNAL(pg, indx)
void * mpool_get(MPOOL *mp, pgno_t pgno, u_int flags)
static PAGE * bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
int __bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags, size_t ilen, u_int32_t argskip)
#define WR_RINTERNAL(p, nrecs, pgno)
static int bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
static int bt_broot __P((BTREE *, PAGE *, PAGE *, PAGE *))
static recno_t rec_total(PAGE *h)
#define WR_BLEAF(p, key, data, flags)
PAGE * __bt_new(BTREE *t, pgno_t *npg)
static PAGE * bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)