diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-06-04 16:13:59 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-06-04 16:13:59 +1000 |
commit | a4453792546595cc89028b8193574ab937a4ac79 (patch) | |
tree | 3218e0d700c767c24317cda267cd613130974070 | |
parent | 439b5ef263a014069871f3df6f0896c74713d5b0 (diff) | |
download | mongo-a4453792546595cc89028b8193574ab937a4ac79.tar.gz |
Drop the eviction lock while waiting for LRU eviction to drain: avoid a deadlock where LRU eviction has to take the eviction lock to clear.
-rw-r--r-- | src/btree/bt_evict.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c index 678e2454b9c..a478cf16edf 100644 --- a/src/btree/bt_evict.c +++ b/src/btree/bt_evict.c @@ -520,8 +520,11 @@ __evict_file_request_walk(WT_SESSION_IMPL *session) * to reason about sync or forced eviction if we know there are * no other threads evicting in the tree. */ - while (request_session->btree->lru_count > 0) + while (request_session->btree->lru_count > 0) { + __wt_spin_unlock(session, &cache->evict_lock); __wt_yield(); + __wt_spin_lock(session, &cache->evict_lock); + } ret = __evict_file_request(request_session, syncop); @@ -644,8 +647,11 @@ __evict_page_request_walk(WT_SESSION_IMPL *session) * to reason about sync or forced eviction if we know there are * no other threads evicting in the tree. */ - while (session->btree->lru_count > 0) + while (session->btree->lru_count > 0) { + __wt_spin_unlock(session, &cache->evict_lock); __wt_yield(); + __wt_spin_lock(session, &cache->evict_lock); + } ref = page->ref; WT_ASSERT(session, ref->page == page); @@ -653,13 +659,6 @@ __evict_page_request_walk(WT_SESSION_IMPL *session) ref->state = WT_REF_LOCKED; /* - * At this point, the page is locked, which stalls new readers. - * Pause before attempting to evict it to give existing readers - * a chance to drop their references. - */ - __wt_yield(); - - /* * If eviction fails, it will free up the page: hope it works * next time. Application threads may be holding a reference * while trying to get another (e.g., if they have two cursors |