summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2017-04-08 00:56:28 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-08 02:07:41 +1000
commit7a3e2484ec1ced43653cf33f4c68b0ebc8a0ee55 (patch)
treef27d9672cab5c54da3ebf8a902dc946ee2a025d0
parent03810f1362e3768aea6ed25cbdd9ebc01ec79c46 (diff)
downloadmongo-7a3e2484ec1ced43653cf33f4c68b0ebc8a0ee55.tar.gz
WT-3262 Don't check if the cache is full when accessing metadata. (#3376)
Also don't check for a full cache while holding the table lock (we're likely reading the metadata in that case, just being extra careful).
-rw-r--r--src/include/cache.i17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/include/cache.i b/src/include/cache.i
index d71978ccf35..90dd1bcdda8 100644
--- a/src/include/cache.i
+++ b/src/include/cache.i
@@ -360,11 +360,13 @@ __wt_cache_eviction_check(WT_SESSION_IMPL *session, bool busy, bool *didworkp)
/*
* LSM sets the no-cache-check flag when holding the LSM tree lock, in
- * that case, or when holding the schema or handle list locks (which
- * block eviction), we don't want to highjack the thread for eviction.
+ * that case, or when holding the handle list, schema or table locks
+ * (which can block checkpoints and eviction), don't block the thread
+ * for eviction.
*/
if (F_ISSET(session, WT_SESSION_NO_EVICTION |
- WT_SESSION_LOCKED_HANDLE_LIST_WRITE | WT_SESSION_LOCKED_SCHEMA))
+ WT_SESSION_LOCKED_HANDLE_LIST | WT_SESSION_LOCKED_SCHEMA |
+ WT_SESSION_LOCKED_TABLE))
return (0);
/* In memory configurations don't block when the cache is full. */
@@ -372,11 +374,14 @@ __wt_cache_eviction_check(WT_SESSION_IMPL *session, bool busy, bool *didworkp)
return (0);
/*
- * Threads operating on cache-resident trees are ignored because they're
- * not contributing to the problem.
+ * Threads operating on cache-resident trees are ignored because
+ * they're not contributing to the problem. We also don't block while
+ * reading metadata because we're likely to be holding some other
+ * resources that could block checkpoints or eviction.
*/
btree = S2BT_SAFE(session);
- if (btree != NULL && F_ISSET(btree, WT_BTREE_IN_MEMORY))
+ if (btree != NULL && (F_ISSET(btree, WT_BTREE_IN_MEMORY) ||
+ WT_IS_METADATA(session->dhandle)))
return (0);
/* Check if eviction is needed. */