diff options
| author | Michael Cahill <michael.cahill@mongodb.com> | 2017-12-06 08:34:25 +1100 |
|---|---|---|
| committer | Sulabh Mahajan <sulabh.mahajan@mongodb.com> | 2017-12-07 11:00:44 +1100 |
| commit | dcc86acdc9d579e5ce45e4e983a63e89437585ac (patch) | |
| tree | adf511f466866b7b9e0049a883308b52a29133ff | |
| parent | 20d6c35a9fd434c684d716d8dfb50ddcd5bd01be (diff) | |
WT-3786 Transactions should read their writes regardless of timestamps. (#3826)
(cherry picked from commit 2f489ea88e61b00d52dd0000d18841b85f32be27)
| -rw-r--r-- | src/include/txn.i | 4 | ||||
| -rw-r--r-- | test/suite/test_timestamp02.py | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/include/txn.i b/src/include/txn.i index 2ecbd5dc440..1683ce8fbe2 100644 --- a/src/include/txn.i +++ b/src/include/txn.i @@ -456,6 +456,10 @@ __wt_txn_visible( if (!__txn_visible_id(session, id)) return (false); + /* Transactions read their writes, regardless of timestamps. */ + if (F_ISSET(&session->txn, WT_TXN_HAS_ID) && id == session->txn.id) + return (true); + #ifdef HAVE_TIMESTAMPS { WT_TXN *txn = &session->txn; diff --git a/test/suite/test_timestamp02.py b/test/suite/test_timestamp02.py index f928dbc184f..60a6eef3a55 100644 --- a/test/suite/test_timestamp02.py +++ b/test/suite/test_timestamp02.py @@ -135,5 +135,23 @@ class test_timestamp02(wttest.WiredTigerTestCase, suite_subprocess): self.check(self.session, 'read_timestamp=' + timestamp_str(t + 200), dict((k, 2) for k in orig_keys[i+1:])) + def test_read_your_writes(self): + if not wiredtiger.timestamp_build(): + self.skipTest('requires a timestamp build') + + self.session.create(self.uri, + 'key_format=i,value_format=i' + self.extra_config) + c = self.session.open_cursor(self.uri) + + k = 10 + c[k] = 0 + + self.session.begin_transaction('read_timestamp=10') + self.session.timestamp_transaction('commit_timestamp=20') + c[k] = 1 + # We should see the value we just inserted + self.assertEqual(c[k], 1) + self.session.commit_transaction() + if __name__ == '__main__': wttest.run() |
