summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-12-22 12:40:08 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-12-22 12:40:08 +1100
commit01818b70ac4df0c54afd08f5721f0ffc1d90e2d5 (patch)
tree31e2d5925cdcfff13ec75d18393f9929cccb2e42
parent42a5beaba747023f0b6b96651a83ab4b4543d520 (diff)
downloadmongo-01818b70ac4df0c54afd08f5721f0ffc1d90e2d5.tar.gz
Only trigger the eviction server to look for pages that would force eviction if regular eviction either fails or does an in-memory split.
-rw-r--r--src/btree/bt_curnext.c2
-rw-r--r--src/btree/bt_curprev.c2
-rw-r--r--src/btree/bt_page.c4
-rw-r--r--src/evict/evict_page.c9
-rw-r--r--src/include/btree.i6
-rw-r--r--src/include/cursor.i2
6 files changed, 14 insertions, 11 deletions
diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c
index 31d272dc09c..9cd7f0241fc 100644
--- a/src/btree/bt_curnext.c
+++ b/src/btree/bt_curnext.c
@@ -483,7 +483,7 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating)
if (page != NULL &&
(cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD ||
(newpage && cbt->page_deleted_count > 0)))
- __wt_page_evict_soon(session, page);
+ __wt_page_evict_soon(page);
cbt->page_deleted_count = 0;
WT_ERR(__wt_tree_walk(session, &cbt->ref, flags));
diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c
index e749a5b5b51..851b01d3732 100644
--- a/src/btree/bt_curprev.c
+++ b/src/btree/bt_curprev.c
@@ -570,7 +570,7 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating)
if (page != NULL &&
(cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD ||
(newpage && cbt->page_deleted_count > 0)))
- __wt_page_evict_soon(session, page);
+ __wt_page_evict_soon(page);
cbt->page_deleted_count = 0;
WT_ERR(__wt_tree_walk(session, &cbt->ref, flags));
diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c
index 3c92cba709c..799f0cca3ee 100644
--- a/src/btree/bt_page.c
+++ b/src/btree/bt_page.c
@@ -48,7 +48,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_PAGE *page)
return (0);
/* Trigger eviction on the next page release. */
- __wt_page_evict_soon(session, page);
+ __wt_page_evict_soon(page);
return (1);
}
@@ -138,7 +138,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
* Otherwise, update the page's read generation.
*/
if (oldgen && page->read_gen == WT_READGEN_NOTSET)
- __wt_page_evict_soon(session, page);
+ __wt_page_evict_soon(page);
else if (!LF_ISSET(WT_READ_NO_GEN) &&
page->read_gen < __wt_cache_read_gen(session))
page->read_gen =
diff --git a/src/evict/evict_page.c b/src/evict/evict_page.c
index f7cbb55dbe4..4f0ab62bc6d 100644
--- a/src/evict/evict_page.c
+++ b/src/evict/evict_page.c
@@ -24,9 +24,10 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
WT_PAGE *page;
WT_PAGE_MODIFY *mod;
WT_TXN_STATE *txn_state;
- int inmem_split, istree;
+ int forced_eviction, inmem_split, istree;
page = ref->page;
+ forced_eviction = (page->read_gen == WT_READGEN_OLDEST);
inmem_split = istree = 0;
WT_RET(__wt_verbose(session, WT_VERB_EVICT,
@@ -116,6 +117,12 @@ done: session->excl_next = 0;
if (txn_state != NULL)
txn_state->snap_min = WT_TXN_NONE;
+ if ((inmem_split || (forced_eviction && ret == EBUSY)) &&
+ !F_ISSET(S2C(session)->cache, WT_EVICT_EARLY_CANDIDATES)) {
+ F_SET(S2C(session)->cache, WT_EVICT_EARLY_CANDIDATES);
+ WT_TRET(__wt_evict_server_wake(session));
+ }
+
return (ret);
}
diff --git a/src/include/btree.i b/src/include/btree.i
index d2198a1462d..6c42155fefb 100644
--- a/src/include/btree.i
+++ b/src/include/btree.i
@@ -227,13 +227,9 @@ __wt_cache_bytes_inuse(WT_CACHE *cache)
* Set a page to be evicted as soon as possible.
*/
static inline void
-__wt_page_evict_soon(WT_SESSION_IMPL *session, WT_PAGE *page)
+__wt_page_evict_soon(WT_PAGE *page)
{
page->read_gen = WT_READGEN_OLDEST;
- if (!F_ISSET(S2C(session)->cache, WT_EVICT_EARLY_CANDIDATES)) {
- F_SET(S2C(session)->cache, WT_EVICT_EARLY_CANDIDATES);
- (void)__wt_evict_server_wake(session);
- }
}
/*
diff --git a/src/include/cursor.i b/src/include/cursor.i
index d56f65db0a6..737ac8dcdba 100644
--- a/src/include/cursor.i
+++ b/src/include/cursor.i
@@ -122,7 +122,7 @@ __curfile_leave(WT_CURSOR_BTREE *cbt)
*/
if (cbt->ref != NULL &&
cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD)
- __wt_page_evict_soon(session, cbt->ref->page);
+ __wt_page_evict_soon(cbt->ref->page);
cbt->page_deleted_count = 0;
/*