summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-08-12 13:37:39 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-08-19 17:52:42 +1000
commit1c2542ff9337af935ce95a63c91cd2024694634e (patch)
tree77bef233e927360b41d8f49581958a9198a78bb3
parent009216b9ee84635d622374dd6a418514f0730a32 (diff)
downloadmongo-1c2542ff9337af935ce95a63c91cd2024694634e.tar.gz
WT-2038 Fix cases where a tree could be discarded while marked as the next tree for eviction to walk.mongodb-3.0.6
(cherry picked from commit 393344d5d4b436fe3519cb8ab541bab22663553d)
-rw-r--r--src/evict/evict_lru.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index 4d6e482b1d9..4cb29d4e1b9 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -614,7 +614,8 @@ __evict_request_walk_clear(WT_SESSION_IMPL *session)
F_SET(session, WT_SESSION_CLEAR_EVICT_WALK);
- while (btree->evict_ref != NULL && ret == 0) {
+ while (ret == 0 && (btree->evict_ref != NULL ||
+ cache->evict_file_next == session->dhandle)) {
F_SET(cache, WT_CACHE_CLEAR_WALKS);
ret = __wt_cond_wait(
session, cache->evict_waiter_cond, 100000);
@@ -1055,6 +1056,9 @@ retry: while (slot < max_entries && ret == 0) {
}
if (incr) {
+ /* Remember the file we should visit first, next loop. */
+ cache->evict_file_next = dhandle;
+
WT_ASSERT(session, dhandle->session_inuse > 0);
(void)WT_ATOMIC_SUB4(dhandle->session_inuse, 1);
incr = 0;
@@ -1068,21 +1072,17 @@ retry: while (slot < max_entries && ret == 0) {
/*
* Walk the list of files a few times if we don't find enough pages.
* Try two passes through all the files, give up when we have some
- * candidates and we aren't finding more. Take care not to skip files
- * on subsequent passes.
+ * candidates and we aren't finding more.
*/
if (!F_ISSET(cache, WT_CACHE_CLEAR_WALKS) && ret == 0 &&
slot < max_entries && (retries < 2 ||
(!LF_ISSET(WT_EVICT_PASS_WOULD_BLOCK) && retries < 10 &&
(slot == cache->evict_entries || slot > start_slot)))) {
- cache->evict_file_next = NULL;
start_slot = slot;
++retries;
goto retry;
}
- /* Remember the file we should visit first, next loop. */
- cache->evict_file_next = dhandle;
cache->evict_entries = slot;
return (ret);
}