diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/db/btree/bt_page.c | 2 | ||||
-rw-r--r-- | lib/libc/db/btree/bt_split.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/db/btree/bt_page.c b/lib/libc/db/btree/bt_page.c index 0d9d138..ce9cbf1 100644 --- a/lib/libc/db/btree/bt_page.c +++ b/lib/libc/db/btree/bt_page.c @@ -65,6 +65,7 @@ __bt_free(t, h) h->prevpg = P_INVALID; h->nextpg = t->bt_free; t->bt_free = h->pgno; + F_SET(t, B_METADIRTY); /* Make sure the page gets written back. */ return (mpool_put(t->bt_mp, h, MPOOL_DIRTY)); @@ -92,6 +93,7 @@ __bt_new(t, npg) (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) { *npg = t->bt_free; t->bt_free = h->nextpg; + F_SET(t, B_METADIRTY); return (h); } return (mpool_new(t->bt_mp, npg)); 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; |