summaryrefslogtreecommitdiff
path: root/src/include/cursor.i
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/cursor.i')
-rw-r--r--src/include/cursor.i12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/cursor.i b/src/include/cursor.i
index ae6aafdd638..8fa9790e096 100644
--- a/src/include/cursor.i
+++ b/src/include/cursor.i
@@ -176,11 +176,23 @@ static inline int
__cursor_func_init(WT_CURSOR_BTREE *cbt, int reenter)
{
WT_SESSION_IMPL *session;
+ WT_TXN *txn;
session = (WT_SESSION_IMPL *)cbt->iface.session;
+ txn = &session->txn;
if (reenter)
WT_RET(__curfile_leave(cbt));
+
+ /*
+ * If there is no transaction active in this thread and we haven't
+ * checked if the cache is full, do it now. If we have to block for
+ * eviction, this is the best time to do it.
+ */
+ if (F_ISSET(txn, TXN_RUNNING) &&
+ !F_ISSET(txn, TXN_HAS_ID) && !F_ISSET(txn, TXN_HAS_SNAPSHOT))
+ WT_RET(__wt_cache_full_check(session));
+
if (!F_ISSET(cbt, WT_CBT_ACTIVE))
WT_RET(__curfile_enter(cbt));
__wt_txn_cursor_op(session);