diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-02-04 13:17:29 +1100 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-02-04 13:17:29 +1100 |
commit | 6bff4ed03ac73f18719de48b95c2f3c289ea2661 (patch) | |
tree | 910de79bd300780bdfff0740f08210d4e15c20fe | |
parent | 74132dc4877acb8767e214d9a72926643586a698 (diff) | |
parent | 7accfa08d9800eac72edac5de5e18b2a18e42e77 (diff) | |
download | mongo-6bff4ed03ac73f18719de48b95c2f3c289ea2661.tar.gz |
Merge pull request #2455 from wiredtiger/WT-2130-split_pct
WT-2130 Don't round the split_pct to an allocation size.
-rw-r--r-- | src/include/misc.h | 3 | ||||
-rw-r--r-- | src/reconcile/rec_write.c | 26 |
2 files changed, 23 insertions, 6 deletions
diff --git a/src/include/misc.h b/src/include/misc.h index 78997661851..5dadb1b1484 100644 --- a/src/include/misc.h +++ b/src/include/misc.h @@ -48,6 +48,9 @@ #define WT_ALIGN(n, v) \ ((((uintmax_t)(n)) + ((v) - 1)) & ~(((uintmax_t)(v)) - 1)) +#define WT_ALIGN_NEAREST(n, v) \ + ((((uintmax_t)(n)) + ((v) / 2)) & ~(((uintmax_t)(v)) - 1)) + /* Min, max. */ #define WT_MIN(a, b) ((a) < (b) ? (a) : (b)) #define WT_MAX(a, b) ((a) < (b) ? (b) : (a)) diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 332449027a9..c25d7b5e493 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -1889,15 +1889,18 @@ __wt_split_page_size(WT_BTREE *btree, uint32_t maxpagesize) * we don't waste space when we write). */ a = maxpagesize; /* Don't overflow. */ - split_size = (uint32_t) - WT_ALIGN((a * (u_int)btree->split_pct) / 100, btree->allocsize); + split_size = (uint32_t)WT_ALIGN_NEAREST( + (a * (u_int)btree->split_pct) / 100, btree->allocsize); /* - * If the result of that calculation is the same as the allocation unit - * (that happens if the maximum size is the same size as an allocation - * unit, use a percentage of the maximum page size). + * Respect the configured split percentage if the calculated split + * size is either zero or a full page. The user has either configured + * an allocation size that matches the page size, or a split + * percentage that is close to zero or one hundred. Rounding is going + * to provide a worse outcome than having a split point that doesn't + * fall on an allocation size boundary in those cases. */ - if (split_size == btree->allocsize) + if (split_size == 0 || split_size == maxpagesize) split_size = (uint32_t)((a * (u_int)btree->split_pct) / 100); return (split_size); @@ -3286,6 +3289,17 @@ supd_check_complete: } } + bnd->entries = r->entries; + /* Output a verbose message if we create a page without many entries */ + if (WT_VERBOSE_ISSET(session, WT_VERB_SPLIT) && r->entries < 6) + WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + "Reconciliation creating a page with %" PRIu32 + " entries, memory footprint %" PRIu64 + ", page count %" PRIu32 ", %s, split state: %d\n", + r->entries, r->page->memory_footprint, r->bnd_next, + F_ISSET(r, WT_EVICTING) ? "evict" : "checkpoint", + r->bnd_state)); + WT_ERR(__wt_bt_write(session, buf, addr, &addr_size, false, bnd->already_compressed)); WT_ERR(__wt_strndup(session, addr, addr_size, &bnd->addr.addr)); |