summaryrefslogtreecommitdiff
path: root/src/evict/evict_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/evict/evict_file.c')
-rw-r--r--src/evict/evict_file.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/evict/evict_file.c b/src/evict/evict_file.c
index 17b038fb003..3d8f4a61ca7 100644
--- a/src/evict/evict_file.c
+++ b/src/evict/evict_file.c
@@ -15,15 +15,27 @@
int
__wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
{
+ WT_BTREE *btree;
WT_DECL_RET;
WT_PAGE *page;
WT_REF *next_ref, *ref;
+ btree = S2BT(session);
+
/*
- * We need exclusive access to the file -- disable ordinary eviction
- * and drain any blocks already queued.
+ * We need exclusive access to the file, we're about to discard the root
+ * page. Assert eviction has been locked out.
*/
- WT_RET(__wt_evict_file_exclusive_on(session));
+ WT_ASSERT(session,
+ btree->evict_disabled > 0 ||
+ !F_ISSET(session->dhandle, WT_DHANDLE_OPEN));
+
+ /*
+ * We do discard objects without pages in memory. If that's the case,
+ * we're done.
+ */
+ if (btree->root.page == NULL)
+ return (0);
/* Make sure the oldest transaction ID is up-to-date. */
WT_RET(__wt_txn_update_oldest(
@@ -102,7 +114,5 @@ err: /* On error, clear any left-over tree walk. */
session, next_ref, WT_READ_NO_EVICT));
}
- __wt_evict_file_exclusive_off(session);
-
return (ret);
}