summaryrefslogtreecommitdiff
path: root/src/include/cache.i
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-06-08 17:48:11 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2015-06-08 17:48:11 -0400
commit32144696f78cf726b8b1df8becca0a86d870efa3 (patch)
treee87fde199a1ad73768403ae3fd193d928238696b /src/include/cache.i
parent6310c3fc7bc4eda819591f4a0366a625e2e8074d (diff)
downloadmongo-32144696f78cf726b8b1df8becca0a86d870efa3.tar.gz
SERVER-18829 Have pages start in the middle of the LRU queue for eviction.
Also make sure that when eviction first needs to run, it can find some pages to evict.
Diffstat (limited to 'src/include/cache.i')
-rw-r--r--src/include/cache.i19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/include/cache.i b/src/include/cache.i
index 31bae1ac679..ad1e17e1fdc 100644
--- a/src/include/cache.i
+++ b/src/include/cache.i
@@ -27,11 +27,11 @@ __wt_cache_read_gen_incr(WT_SESSION_IMPL *session)
}
/*
- * __wt_cache_read_gen_set --
- * Get the read generation to store in a page.
+ * __wt_cache_read_gen_bump --
+ * Get the read generation to keep a page in memory.
*/
static inline uint64_t
-__wt_cache_read_gen_set(WT_SESSION_IMPL *session)
+__wt_cache_read_gen_bump(WT_SESSION_IMPL *session)
{
/*
* We return read-generations from the future (where "the future" is
@@ -46,6 +46,19 @@ __wt_cache_read_gen_set(WT_SESSION_IMPL *session)
}
/*
+ * __wt_cache_read_gen_new --
+ * Get the read generation for a new page in memory.
+ */
+static inline uint64_t
+__wt_cache_read_gen_new(WT_SESSION_IMPL *session)
+{
+ WT_CACHE *cache;
+
+ cache = S2C(session)->cache;
+ return (__wt_cache_read_gen(session) + cache->read_gen_oldest) / 2;
+}
+
+/*
* __wt_cache_pages_inuse --
* Return the number of pages in use.
*/