summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/btree/bt_evict.c3
-rw-r--r--src/include/cursor.i5
-rw-r--r--src/include/txn.h3
-rw-r--r--src/include/txn.i4
-rw-r--r--src/txn/txn.c1
5 files changed, 12 insertions, 4 deletions
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c
index cbf8a350237..69b633409bf 100644
--- a/src/btree/bt_evict.c
+++ b/src/btree/bt_evict.c
@@ -692,7 +692,8 @@ err: /* On error, clear any left-over tree walk. */
if (txn_state != NULL)
txn_state->snap_min = WT_TXN_NONE;
- else if (txn->isolation == TXN_ISO_READ_COMMITTED)
+ else if (txn->isolation == TXN_ISO_READ_COMMITTED &&
+ !F_ISSET(txn, TXN_PINNED))
__wt_txn_release_snapshot(session);
if (WT_VERBOSE_ISSET(session, checkpoint)) {
diff --git a/src/include/cursor.i b/src/include/cursor.i
index 2790c5ebb49..34fc14f46e2 100644
--- a/src/include/cursor.i
+++ b/src/include/cursor.i
@@ -74,8 +74,10 @@ __cursor_leave(WT_SESSION_IMPL *session)
* snapshot we're holding for read committed isolation.
*/
WT_ASSERT(session, session->ncursors > 0);
- if (--session->ncursors == 0)
+ if (--session->ncursors == 0) {
+ F_CLR(&session->txn, TXN_PINNED);
__wt_txn_read_last(session);
+ }
return (0);
}
@@ -140,6 +142,7 @@ __cursor_func_init(WT_CURSOR_BTREE *cbt, int reenter)
if (!F_ISSET(cbt, WT_CBT_ACTIVE))
WT_RET(__curfile_enter(cbt));
__wt_txn_cursor_op(session);
+ F_SET(&session->txn, TXN_PINNED);
return (0);
}
diff --git a/src/include/txn.h b/src/include/txn.h
index 857fa3c0e7b..e634320bd80 100644
--- a/src/include/txn.h
+++ b/src/include/txn.h
@@ -130,6 +130,7 @@ struct __wt_txn {
#define TXN_AUTOCOMMIT 0x01
#define TXN_ERROR 0x02
#define TXN_OLDEST 0x04
-#define TXN_RUNNING 0x08
+#define TXN_PINNED 0x08
+#define TXN_RUNNING 0x10
uint32_t flags;
};
diff --git a/src/include/txn.i b/src/include/txn.i
index e869de8b3ce..da9d2c3d465 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -299,8 +299,10 @@ __wt_txn_cursor_op(WT_SESSION_IMPL *session)
*/
if (txn->isolation == TXN_ISO_READ_UNCOMMITTED &&
!F_ISSET(txn, TXN_RUNNING) &&
- TXNID_LT(txn_state->snap_min, txn_global->last_running))
+ TXNID_LT(txn_state->snap_min, txn_global->last_running)) {
txn_state->snap_min = txn_global->last_running;
+ F_SET(&session->txn, TXN_PINNED);
+ }
}
/*
diff --git a/src/txn/txn.c b/src/txn/txn.c
index d448084b803..92976f4ebb3 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -56,6 +56,7 @@ __wt_txn_release_snapshot(WT_SESSION_IMPL *session)
WT_ASSERT(session,
session->txn.isolation == TXN_ISO_READ_UNCOMMITTED ||
!__wt_txn_visible_all(session, txn_state->snap_min));
+ WT_ASSERT(session, !F_ISSET(&session->txn, TXN_PINNED));
txn_state->snap_min = WT_TXN_NONE;
}
}