/* * __evict_force_check -- * Check if a page matches the criteria for forced eviction. */ static int __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref) { WT_BTREE *btree; WT_PAGE *page; btree = S2BT(session); page = ref->page; /* Leaf pages only. */ if (WT_PAGE_IS_INTERNAL(page)) return (0); /* * It's hard to imagine a page with a huge memory footprint that has * never been modified, but check to be sure. */ if (page->modify == NULL) return (0); /* Pages are usually small enough, check that first. */ if (page->memory_footprint < btree->splitmempage) return (0); else 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(page); /* Bump the oldest ID, we're about to do some visibility checks. */ __wt_txn_update_oldest(session, false); /* If eviction cannot succeed, don't try. */ return (__wt_page_can_evict(session, ref, NULL)); }
/* * __evict_force_check -- * Check if a page matches the criteria for forced eviction. */ static bool __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref) { WT_BTREE *btree; WT_PAGE *page; btree = S2BT(session); page = ref->page; /* Leaf pages only. */ if (WT_PAGE_IS_INTERNAL(page)) return (false); /* * It's hard to imagine a page with a huge memory footprint that has * never been modified, but check to be sure. */ if (page->modify == NULL) return (false); /* Pages are usually small enough, check that first. */ if (page->memory_footprint < btree->splitmempage) return (false); /* * If this session has more than one hazard pointer, eviction will fail * and there is no point trying. */ if (__wt_hazard_count(session, page) > 1) return (false); /* * If we have already tried and the transaction state has not moved on, * eviction is highly likely to fail. */ if (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)); }