summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2013-05-14 11:12:15 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2013-05-14 11:12:15 +1000
commit5432949c4f9bf536b3932d7cc9b0186461316009 (patch)
treef32478ec09cffb157abffd225444817cc9b40a16 /src
parentade4fe29cb4cbb3ad557fec58e0db4053c82733f (diff)
downloadmongo-5432949c4f9bf536b3932d7cc9b0186461316009.tar.gz
Fix an off-by-one error in the transaction used for eviction. We track the oldest ID that can *not* be written.
Diffstat (limited to 'src')
-rw-r--r--src/btree/bt_evict.c8
-rw-r--r--src/txn/txn.c11
2 files changed, 15 insertions, 4 deletions
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c
index 3bbc31e1582..a81c65a1ecd 100644
--- a/src/btree/bt_evict.c
+++ b/src/btree/bt_evict.c
@@ -333,6 +333,14 @@ __wt_evict_page(WT_SESSION_IMPL *session, WT_PAGE *page)
__wt_txn_get_evict_snapshot(session);
txn->isolation = TXN_ISO_READ_COMMITTED;
+
+ /*
+ * Sanity check: if a transaction is running, its updates should not
+ * be visible to eviction.
+ */
+ WT_ASSERT(session, !was_running ||
+ !__wt_txn_visible(session, saved_txn.id));
+
ret = __wt_rec_evict(session, page, 0);
if (was_running) {
diff --git a/src/txn/txn.c b/src/txn/txn.c
index c1a72ecd671..587983bc14e 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -168,9 +168,14 @@ __wt_txn_get_evict_snapshot(WT_SESSION_IMPL *session)
txn = &session->txn;
+ /*
+ * The oldest active snapshot ID in the system should *not* be visible
+ * to eviction. Create a snapshot containing that ID.
+ */
__wt_txn_get_oldest(session);
+ txn->snapshot[0] = txn->oldest_snap_min;
__txn_sort_snapshot(
- session, 0, txn->oldest_snap_min, txn->oldest_snap_min);
+ session, 1, txn->oldest_snap_min, txn->oldest_snap_min);
/*
* Note that we carefully don't update the global table with this
@@ -397,9 +402,7 @@ __wt_txn_init(WT_SESSION_IMPL *session)
txn->mod = NULL;
txn->modref = NULL;
- /* The default isolation level is read-committed. */
- txn->isolation = session->isolation = TXN_ISO_READ_COMMITTED;
-
+ txn->isolation = session->isolation;
return (0);
}