summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2016-08-12 17:15:46 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2016-08-12 17:15:46 +1000
commit06946a6abcc1b41f0f0bcada4fcbebaa97a49f7f (patch)
tree400acc5411af6919be6f7e49269ee87dede92a54
parent707807a81fbf06766006b8d63393414205fda181 (diff)
downloadmongo-06946a6abcc1b41f0f0bcada4fcbebaa97a49f7f.tar.gz
WT-2766 Don't sweep LAS cache when aren't making progess in eviction (#2918)
-rw-r--r--src/conn/conn_sweep.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c
index 5d24ea61607..67c3a734801 100644
--- a/src/conn/conn_sweep.c
+++ b/src/conn/conn_sweep.c
@@ -258,10 +258,12 @@ __sweep_server(void *arg)
WT_DECL_RET;
WT_SESSION_IMPL *session;
time_t now;
+ uint64_t last_las_sweep_id, oldest_id;
u_int dead_handles;
session = arg;
conn = S2C(session);
+ last_las_sweep_id = WT_TXN_NONE;
/*
* Sweep for dead and excess handles.
@@ -278,9 +280,22 @@ __sweep_server(void *arg)
/*
* Sweep the lookaside table. If the lookaside table hasn't yet
* been written, there's no work to do.
+ *
+ * Don't sweep the lookaside table if the cache is stuck full.
+ * The sweep uses the cache and can exacerbate the problem.
+ * If we try to sweep when the cache is full or we aren't
+ * making progress in eviction, sweeping can wind up constantly
+ * bringing in and evicting pages from the lookaside table,
+ * which will stop the WT_CACHE_STUCK flag from being set.
*/
- if (__wt_las_is_written(session))
- WT_ERR(__wt_las_sweep(session));
+ if (__wt_las_is_written(session) &&
+ !F_ISSET(conn->cache, WT_CACHE_STUCK)) {
+ oldest_id = __wt_txn_oldest_id(session);
+ if (WT_TXNID_LT(last_las_sweep_id, oldest_id)) {
+ WT_ERR(__wt_las_sweep(session));
+ last_las_sweep_id = oldest_id;
+ }
+ }
/*
* Mark handles with a time of death, and report whether any