diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2014-12-22 12:40:08 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2014-12-22 12:40:08 +1100 |
commit | 01818b70ac4df0c54afd08f5721f0ffc1d90e2d5 (patch) | |
tree | 31e2d5925cdcfff13ec75d18393f9929cccb2e42 | |
parent | 42a5beaba747023f0b6b96651a83ab4b4543d520 (diff) | |
download | mongo-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.c | 2 | ||||
-rw-r--r-- | src/btree/bt_curprev.c | 2 | ||||
-rw-r--r-- | src/btree/bt_page.c | 4 | ||||
-rw-r--r-- | src/evict/evict_page.c | 9 | ||||
-rw-r--r-- | src/include/btree.i | 6 | ||||
-rw-r--r-- | src/include/cursor.i | 2 |
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; /* |