diff options
-rw-r--r-- | src/evict/evict_lru.c | 19 | ||||
-rw-r--r-- | src/include/btree.i | 12 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 42966d636f6..1314f715907 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -1265,16 +1265,23 @@ fast: /* If the page can't be evicted, give up. */ continue; /* - * If the page is clean but has modifications that appear too - * new to evict, skip it. + * If the oldest transaction hasn't changed since the last time + * this page was written, it's unlikely that we can make + * progress. Similarly, if the most recent update on the page + * is not yet globally visible, eviction will fail. These + * heuristics attempt to avoid repeated attempts to evict the + * same page. * - * Note: take care with ordering: if we detected that the page - * is modified above, we expect mod != NULL. + * That said, if eviction is stuck, or we are helping with + * forced eviction, try anyway: maybe a transaction that was + * running last time we wrote the page has since rolled back, + * or we can help get the checkpoint completed sooner. */ mod = page->modify; - if (!modified && mod != NULL && !LF_ISSET( + if (modified && !LF_ISSET( WT_EVICT_PASS_AGGRESSIVE | WT_EVICT_PASS_WOULD_BLOCK) && - !__wt_txn_visible_all(session, mod->rec_max_txn)) + (mod->disk_snap_min == S2C(session)->txn_global.oldest_id || + !__wt_txn_visible_all(session, mod->update_txn))) continue; WT_ASSERT(session, evict->ref == NULL); diff --git a/src/include/btree.i b/src/include/btree.i index 8086df92087..c58abd356cf 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -1136,15 +1136,11 @@ __wt_page_can_evict(WT_SESSION_IMPL *session, } /* - * If the oldest transaction hasn't changed since the last time this - * page was written, it's unlikely that we can make progress. - * Similarly, if the most recent update on the page is not yet globally - * visible, eviction must fail. These checks also aim to avoid - * repeated attempts to evict the same page. + * If the page is clean, check if it has an update that is too new to + * evict. */ - if (modified && - (mod->disk_snap_min == __wt_txn_oldest_id(session) || - !__wt_txn_visible_all(session, mod->update_txn))) + if (!modified && mod != NULL && + !__wt_txn_visible_all(session, mod->rec_max_txn)) return (false); return (true); |