diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2017-02-02 16:40:30 +1100 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-02-02 16:40:30 +1100 |
commit | 0562f92104f0b2d8ef218d9fe465ef718bc2d9cd (patch) | |
tree | 295f153f50cf500c3294025c974ea8219caf1708 | |
parent | 1e24579efee68f6fdb6a4c582275a50d95d7eb81 (diff) | |
download | mongo-0562f92104f0b2d8ef218d9fe465ef718bc2d9cd.tar.gz |
WT-3150 Reduce impact of checkpoints on eviction. (#3265)
In particular, don't have the eviction server give up all walks each
time it is interrupted, and only wait for requesting threads to make
progress: don't go to sleep.
-rw-r--r-- | src/evict/evict_lru.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index de1cff85816..3cb513fd87b 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -281,7 +281,7 @@ __wt_evict_thread_run(WT_SESSION_IMPL *session, WT_THREAD *thread) WT_CACHE *cache; WT_CONNECTION_IMPL *conn; WT_DECL_RET; - bool did_work; + bool did_work, was_intr; conn = S2C(session); cache = conn->cache; @@ -309,8 +309,21 @@ __wt_evict_thread_run(WT_SESSION_IMPL *session, WT_THREAD *thread) ret = __evict_server(session, &did_work); F_CLR(cache->walk_session, WT_SESSION_LOCKED_PASS); F_CLR(session, WT_SESSION_LOCKED_PASS); + was_intr = cache->pass_intr != 0; __wt_spin_unlock(session, &cache->evict_pass_lock); WT_ERR(ret); + + /* + * If the eviction server was interrupted, wait until + * requests have been processed: the system may + * otherwise be busy so don't go to sleep. + */ + if (was_intr) { + while (cache->pass_intr != 0) + __wt_yield(); + continue; + } + __wt_verbose(session, WT_VERB_EVICTSERVER, "sleeping"); /* Don't rely on signals: check periodically. */ @@ -372,7 +385,8 @@ __evict_server(WT_SESSION_IMPL *session, bool *did_work) /* Evict pages from the cache as needed. */ WT_RET(__evict_pass(session)); - if (!F_ISSET(conn, WT_CONN_EVICTION_RUN)) + if (!F_ISSET(conn, WT_CONN_EVICTION_RUN) || + cache->pass_intr != 0) return (0); /* |