summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2015-06-09 13:44:30 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2015-06-29 14:04:09 +1000
commit28c395baf4be3cdceb398fea80eb8f7b7513759c (patch)
tree74c2ec860d4b991ec2e7771e5c1f47a8900dbfe3 /src/include
parent597dddd70578fe4b6e6533fba1a76899f9e4f99f (diff)
downloadmongo-28c395baf4be3cdceb398fea80eb8f7b7513759c.tar.gz
SERVER-18829 Have pages start in the middle of the LRU queue for eviction.
(cherry picked from commit d57dc26729bbc59c5bc3928aa90bb2ac3cd15d6d)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/cache.h2
-rw-r--r--src/include/cache.i19
2 files changed, 18 insertions, 3 deletions
diff --git a/src/include/cache.h b/src/include/cache.h
index 11f631416af..58b7b4dbddb 100644
--- a/src/include/cache.h
+++ b/src/include/cache.h
@@ -71,6 +71,8 @@ struct __wt_cache {
* Read information.
*/
uint64_t read_gen; /* Page read generation (LRU) */
+ uint64_t read_gen_oldest; /* The oldest read generation that
+ eviction knows about */
/*
* Eviction thread information.
diff --git a/src/include/cache.i b/src/include/cache.i
index f952f1bf698..d84069c43fb 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.
*/