diff options
-rw-r--r-- | src/btree/bt_read.c | 17 | ||||
-rw-r--r-- | src/btree/bt_split.c | 15 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 6 | ||||
-rw-r--r-- | src/include/btmem.h | 2 |
4 files changed, 22 insertions, 18 deletions
diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index 679f20bdac5..90188498535 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -327,25 +327,28 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref) if (__wt_hazard_count(session, page) > 1) return (false); + /* If we can do an in-memory split, do it. */ + if (__wt_leaf_page_can_split(session, page)) + return (true); + if (page->memory_footprint < btree->maxmempage) + return (false); + + /* Bump the oldest ID, we're about to do some visibility checks. */ + WT_IGNORE_RET(__wt_txn_update_oldest(session, 0)); + /* * Allow some leeway if the transaction ID isn't moving forward since * it is unlikely eviction will be able to evict the page. Don't keep * skipping the page indefinitely or large records can lead to * extremely large memory footprints. */ - if (page->memory_footprint < btree->maxmempage && + if (page->modify->update_restored && page->modify->last_eviction_id == __wt_txn_oldest_id(session)) return (false); - if (page->memory_footprint < btree->maxmempage) - return (__wt_leaf_page_can_split(session, page)); - /* Trigger eviction on the next page release. */ __wt_page_evict_soon(session, ref); - /* Bump the oldest ID, we're about to do some visibility checks. */ - WT_IGNORE_RET(__wt_txn_update_oldest(session, 0)); - /* If eviction cannot succeed, don't try. */ return (__wt_page_can_evict(session, ref, NULL)); } diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index ea667460966..017c820ea29 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -1582,6 +1582,13 @@ __split_multi_inmem( */ page->modify->first_dirty_txn = WT_TXN_FIRST; + /* + * If the new page is modified, save the oldest ID from reconciliation + * to avoid repeatedly attempting eviction on the same page. + */ + page->modify->last_eviction_id = orig->modify->last_eviction_id; + page->modify->update_restored = 1; + err: /* Free any resources that may have been cached in the cursor. */ WT_TRET(__wt_btcur_close(&cbt, true)); @@ -2245,14 +2252,6 @@ __wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, WT_MULTI *multi) WT_ERR(__split_multi_inmem(session, page, multi, new)); /* - * If the new page is modified, save the oldest ID from reconciliation - * to avoid repeatedly attempting eviction on the same page. - */ - if (new->page->modify != NULL) - new->page->modify->last_eviction_id = - page->modify->last_eviction_id; - - /* * The rewrite succeeded, we can no longer fail. * * Finalize the move, discarding moved update lists from the original diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 8ca73160cd5..6c99f3a13dc 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -1284,8 +1284,8 @@ __evict_push_candidate(WT_SESSION_IMPL *session, * Get a few page eviction candidates from a single underlying file. */ static int -__evict_walk_file(WT_SESSION_IMPL *session, - WT_EVICT_QUEUE *queue, u_int max_entries, u_int *slotp) +__evict_walk_file(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue, + u_int max_entries, u_int *slotp) { WT_BTREE *btree; WT_CACHE *cache; @@ -1559,7 +1559,7 @@ __evict_get_ref( server_only = is_server && !WT_EVICT_HAS_WORKERS(session); urgent_ok = (!is_app && !is_server) || !WT_EVICT_HAS_WORKERS(session) || - __wt_cache_aggressive(session); + (is_app && __wt_cache_aggressive(session)); urgent_queue = cache->evict_urgent_queue; *btreep = NULL; *refp = NULL; diff --git a/src/include/btmem.h b/src/include/btmem.h index 278d0e50ee8..84c91097a99 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -430,6 +430,8 @@ struct __wt_page_modify { #define WT_PM_REC_MULTIBLOCK 2 /* Reconciliation: multiple blocks */ #define WT_PM_REC_REPLACE 3 /* Reconciliation: single block */ uint8_t rec_result; /* Reconciliation state */ + + uint8_t update_restored; /* Page created by restoring updates */ }; /* |