summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/include/btree.i
diff options
context:
space:
mode:
authorRamon Fernandez <ramon@mongodb.com>2017-10-12 07:15:30 -0400
committerRamon Fernandez <ramon@mongodb.com>2017-10-12 07:15:30 -0400
commit96dfbfbb8cfc35640034b189ba58fef43751319e (patch)
tree0cee99a3dda7d150795449d3bb80f13d1db9c7fa /src/third_party/wiredtiger/src/include/btree.i
parent8205b768ca58b68b7aaf3b3b1c7a544f8d044d5a (diff)
downloadmongo-96dfbfbb8cfc35640034b189ba58fef43751319e.tar.gz
Import wiredtiger: 4b5ade6072d548fdebe3b376f94e0d672eea5359 from branch mongodb-3.6r3.6.0-rc0
ref: 0cd3d5bbd8..4b5ade6072 for: 3.5.14 WT-3644 Port to FreeBSD release 11.1 WT-3645 Build Failed: Lookaside file occupies 10MB of 11MB cache size WT-3646 Only use lookaside when operations are blocked waiting for cache WT-3649 Disable lookaside eviction during close
Diffstat (limited to 'src/third_party/wiredtiger/src/include/btree.i')
-rw-r--r--src/third_party/wiredtiger/src/include/btree.i27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/third_party/wiredtiger/src/include/btree.i b/src/third_party/wiredtiger/src/include/btree.i
index 3b196dca673..35c7d5d5a1a 100644
--- a/src/third_party/wiredtiger/src/include/btree.i
+++ b/src/third_party/wiredtiger/src/include/btree.i
@@ -1165,6 +1165,24 @@ __wt_ref_block_free(WT_SESSION_IMPL *session, WT_REF *ref)
}
/*
+ * __wt_btree_can_evict_dirty --
+ * Check whether eviction of dirty pages or splits are permitted in the
+ * current tree.
+ *
+ * We cannot evict dirty pages or split while a checkpoint is in progress,
+ * unless the checkpoint thread is doing the work.
+ */
+static inline bool
+__wt_btree_can_evict_dirty(WT_SESSION_IMPL *session)
+{
+ WT_BTREE *btree;
+
+ btree = S2BT(session);
+ return (btree->checkpointing == WT_CKPT_OFF ||
+ WT_SESSION_IS_CHECKPOINT(session));
+}
+
+/*
* __wt_leaf_page_can_split --
* Check whether a page can be split in memory.
*/
@@ -1272,12 +1290,10 @@ static inline bool
__wt_page_can_evict(
WT_SESSION_IMPL *session, WT_REF *ref, uint32_t *evict_flagsp)
{
- WT_BTREE *btree;
WT_PAGE *page;
WT_PAGE_MODIFY *mod;
bool modified;
- btree = S2BT(session);
page = ref->page;
mod = page->modify;
@@ -1291,7 +1307,7 @@ __wt_page_can_evict(
* parent frees the backing blocks for any no-longer-used overflow keys,
* which will corrupt the checkpoint's block management.
*/
- if (btree->checkpointing != WT_CKPT_OFF &&
+ if (!__wt_btree_can_evict_dirty(session) &&
F_ISSET_ATOMIC(ref->home, WT_PAGE_OVERFLOW_KEYS))
return (false);
@@ -1315,8 +1331,7 @@ __wt_page_can_evict(
* previous version might be referenced by an internal page already
* written in the checkpoint, leaving the checkpoint inconsistent.
*/
- if (modified && btree->checkpointing != WT_CKPT_OFF &&
- !WT_SESSION_IS_CHECKPOINT(session)) {
+ if (modified && !__wt_btree_can_evict_dirty(session)) {
WT_STAT_CONN_INCR(session, cache_eviction_checkpoint);
WT_STAT_DATA_INCR(session, cache_eviction_checkpoint);
return (false);
@@ -1385,7 +1400,7 @@ __wt_page_release(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags)
* tree, then perform a general check if eviction will be possible.
*/
page = ref->page;
- if (page->read_gen != WT_READGEN_OLDEST ||
+ if (!WT_READGEN_EVICT_SOON(page->read_gen) ||
LF_ISSET(WT_READ_NO_EVICT) ||
F_ISSET(session, WT_SESSION_NO_EVICTION) ||
btree->evict_disabled > 0 ||