Skip to content

Commit c62a281

Browse files
committed
Import wiredtiger-wiredtiger-mongodb-3.0.9-3-g3dbc6c6.tar.gz from wiredtiger branch mongodb-3.0
ref: 62b3ca8..3dbc6c6 WT-2130 Improve on-disk page utlilization with random workloads SERVER-22898 High fragmentation on WiredTiger databases under write workloads
1 parent cf6f3fb commit c62a281

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/third_party/wiredtiger/src/include/misc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
#define WT_ALIGN(n, v) \
4848
((((uintmax_t)(n)) + ((v) - 1)) & ~(((uintmax_t)(v)) - 1))
4949

50+
#define WT_ALIGN_NEAREST(n, v) \
51+
((((uintmax_t)(n)) + ((v) / 2)) & ~(((uintmax_t)(v)) - 1))
52+
5053
/* Min, max. */
5154
#define WT_MIN(a, b) ((a) < (b) ? (a) : (b))
5255
#define WT_MAX(a, b) ((a) < (b) ? (b) : (a))

src/third_party/wiredtiger/src/reconcile/rec_write.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,15 +1628,18 @@ __wt_split_page_size(WT_BTREE *btree, uint32_t maxpagesize)
16281628
* we don't waste space when we write).
16291629
*/
16301630
a = maxpagesize; /* Don't overflow. */
1631-
split_size = (uint32_t)
1632-
WT_ALIGN((a * (u_int)btree->split_pct) / 100, btree->allocsize);
1631+
split_size = (uint32_t)WT_ALIGN_NEAREST(
1632+
(a * (u_int)btree->split_pct) / 100, btree->allocsize);
16331633

16341634
/*
1635-
* If the result of that calculation is the same as the allocation unit
1636-
* (that happens if the maximum size is the same size as an allocation
1637-
* unit, use a percentage of the maximum page size).
1635+
* Respect the configured split percentage if the calculated split
1636+
* size is either zero or a full page. The user has either configured
1637+
* an allocation size that matches the page size, or a split
1638+
* percentage that is close to zero or one hundred. Rounding is going
1639+
* to provide a worse outcome than having a split point that doesn't
1640+
* fall on an allocation size boundary in those cases.
16381641
*/
1639-
if (split_size == btree->allocsize)
1642+
if (split_size == 0 || split_size == maxpagesize)
16401643
split_size = (uint32_t)((a * (u_int)btree->split_pct) / 100);
16411644

16421645
return (split_size);
@@ -2957,6 +2960,17 @@ __rec_split_write(WT_SESSION_IMPL *session,
29572960
}
29582961
}
29592962

2963+
bnd->entries = r->entries;
2964+
/* Output a verbose message if we create a page without many entries */
2965+
if (WT_VERBOSE_ISSET(session, WT_VERB_SPLIT) && r->entries < 6)
2966+
WT_ERR(__wt_verbose(session, WT_VERB_SPLIT,
2967+
"Reconciliation creating a page with %" PRIu32
2968+
" entries, memory footprint %" PRIu64
2969+
", page count %" PRIu32 ", %s, split state: %d\n",
2970+
r->entries, r->page->memory_footprint, r->bnd_next,
2971+
F_ISSET(r, WT_EVICTING) ? "evict" : "checkpoint",
2972+
r->bnd_state));
2973+
29602974
WT_ERR(__wt_bt_write(session,
29612975
buf, addr, &addr_size, false, bnd->already_compressed));
29622976
WT_ERR(__wt_strndup(session, addr, addr_size, &bnd->addr.addr));

0 commit comments

Comments
 (0)