summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2013-05-14 13:51:36 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2013-05-14 13:51:36 +1000
commit08435211a109db4ac0137d100d7fcfb9e3428fb9 (patch)
tree4610f9fd390051b65b812f20e98435ed17c67a8d
parent5432949c4f9bf536b3932d7cc9b0186461316009 (diff)
downloadmongo-08435211a109db4ac0137d100d7fcfb9e3428fb9.tar.gz
Snapshots (including eviction) *should* include the last committed transaction.
-rw-r--r--src/session/session_api.c3
-rw-r--r--src/txn/txn.c6
-rw-r--r--test/suite/test_shared_cache.py20
3 files changed, 15 insertions, 14 deletions
diff --git a/src/session/session_api.c b/src/session/session_api.c
index 27eba2e2276..0cbb2e1bf5b 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -795,7 +795,8 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, int internal,
TAILQ_INIT(&session_ret->cursors);
TAILQ_INIT(&session_ret->dhandles);
- /* Initialize transaction support. */
+ /* Initialize transaction support: default to read-committed. */
+ session_ret->isolation = TXN_ISO_READ_COMMITTED;
WT_ERR(__wt_txn_init(session_ret));
/*
diff --git a/src/txn/txn.c b/src/txn/txn.c
index 587983bc14e..97cdeb9a881 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -77,7 +77,7 @@ __wt_txn_get_oldest(WT_SESSION_IMPL *session)
txn_global = &conn->txn_global;
oldest_snap_min =
- (txn->id != WT_TXN_NONE) ? txn->id : txn_global->current;
+ (txn->id != WT_TXN_NONE) ? txn->id : txn_global->current + 1;
WT_ORDERED_READ(session_cnt, conn->session_cnt);
for (i = 0, s = txn_global->states;
@@ -122,7 +122,7 @@ __wt_txn_get_snapshot(
/* Take a copy of the current session ID. */
txn->last_gen = txn_global->gen;
txn->last_id = oldest_snap_min = current_id =
- txn_global->current;
+ txn_global->current + 1;
/* Copy the array of concurrent transactions. */
WT_ORDERED_READ(session_cnt, conn->session_cnt);
@@ -146,7 +146,7 @@ __wt_txn_get_snapshot(
* the global current ID.
*/
WT_READ_BARRIER();
- } while (current_id != txn_global->current);
+ } while (current_id != txn_global->current + 1);
__txn_sort_snapshot(session, n,
(max_id != WT_TXN_NONE) ? max_id : current_id,
diff --git a/test/suite/test_shared_cache.py b/test/suite/test_shared_cache.py
index 7bf54432e3a..7c5c2218804 100644
--- a/test/suite/test_shared_cache.py
+++ b/test/suite/test_shared_cache.py
@@ -91,7 +91,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.sessions = [] # Implicitly closed when closing sessions.
# Basic test of shared cache
- def test_shared_cache(self):
+ def test_shared_cache01(self):
nops = 1000
self.openConnections(['WT_TEST1', 'WT_TEST2'])
@@ -101,7 +101,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.closeConnections()
# Test of shared cache with more connections
- def test_shared_cache2(self):
+ def test_shared_cache02(self):
nops = 1000
self.openConnections(['WT_TEST1', 'WT_TEST2', 'WT_TEST3', 'WT_TEST4'])
@@ -110,8 +110,8 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.add_records(sess, 0, nops)
self.closeConnections()
- # Do enough work, so that the shared cache gets used.
- def test_shared_cache3(self):
+ # Do enough work for the shared cache to be fully allocated.
+ def test_shared_cache03(self):
nops = 10000
self.openConnections(['WT_TEST1', 'WT_TEST2'])
for sess in self.sessions:
@@ -123,7 +123,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.closeConnections()
# Switch the work between connections, to test rebalancing.
- def test_shared_cache4(self):
+ def test_shared_cache04(self):
# About 100 MB of data with ~250 byte values.
nops = 200000
self.openConnections(['WT_TEST1', 'WT_TEST2'])
@@ -134,7 +134,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.closeConnections()
# Add a new connection once the shared cache is already established.
- def test_shared_cache5(self):
+ def test_shared_cache05(self):
nops = 1000
self.openConnections(['WT_TEST1', 'WT_TEST2'])
@@ -149,7 +149,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.closeConnections()
# Close a connection and keep using other connections.
- def test_shared_cache6(self):
+ def test_shared_cache06(self):
nops = 10000
self.openConnections(['WT_TEST1', 'WT_TEST2', 'WT_TEST3'])
@@ -165,7 +165,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
# Test verbose output
@unittest.skip("Verbose output handling")
- def test_shared_cache7(self):
+ def test_shared_cache07(self):
nops = 1000
self.openConnections(
['WT_TEST1', 'WT_TEST2'], extra_opts="verbose=[shared_cache]")
@@ -176,7 +176,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.closeConnections()
# Test opening a connection outside of the shared cache
- def test_shared_cache8(self):
+ def test_shared_cache08(self):
nops = 1000
self.openConnections(['WT_TEST1', 'WT_TEST2'])
@@ -187,7 +187,7 @@ class test_shared_cache(wttest.WiredTigerTestCase):
self.closeConnections()
# Test default config values
- def test_shared_cache9(self):
+ def test_shared_cache09(self):
nops = 1000
self.openConnections(['WT_TEST1', 'WT_TEST2'], pool_opts=',shared_cache=(name=pool,size=200M)')