diff options
author | Luke Chen <luke.chen@mongodb.com> | 2019-05-07 16:35:05 +1000 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2019-05-07 16:35:05 +1000 |
commit | 400e0500147836ba11ab611bdac2675d65cb7b48 (patch) | |
tree | b87b043ef767d5ca50d43ec6a7ad09f6f4d27073 /src/third_party/wiredtiger/test/suite | |
parent | 8ad1effc48ac5193c5f57630d1fbce8bda0cfdaf (diff) | |
download | mongo-400e0500147836ba11ab611bdac2675d65cb7b48.tar.gz |
Import wiredtiger: d9ec69f9111b036ee0b19b47368e15bff8d4818d from branch mongodb-4.2
ref: 617a81369c..d9ec69f911
for: 4.1.11
WT-4278 Clarify in docs that schema operations are not transactional
WT-4309 Increase the maximum expected LAS test reads
WT-4352 Resolve birthmarks during eviction in more cases
WT-4582 Respect prepared updates in lookaside
WT-4642 Store transaction IDs durably
WT-4670 Remove support for WiredTiger LevelDB APIs
WT-4688 Fix test and docs for correct log cursor usage
WT-4690 Make sure eviction does not split during checkpoints
WT-4697 Python3: change workgen to work with Python3
WT-4706 Add a statistic to track the lookaside table size
WT-4723 Restructure the reconciliation code
WT-4725 Python3: change miscellaneous scripts to run under Python3
WT-4726 Python3: set up pull request tester to run with Python3
WT-4728 Remove the stop timestamp from the WT_UPDATE structure
WT-4738 Tighten rules around use of timestamps
WT-4745 Update upgrading documentation before 3.2.0 WiredTiger release
WT-4746 Document that transactions without timestamps clear history
WT-4749 Fix error message formatting (possible SEGV) for prepare_transaction
WT-4751 Change __wt_timestamp_to_string() to return a pointer to simplify verbose
WT-4752 WiredTiger autoconfig check for the compiler incorrectly quoted
WT-4753 Strip the timing_stress configuration options from the base configuration
WT-4754 Change the checkpoint code to not require a list order
WT-4755 Switch to a better timestamp and transaction ID ordering convention
WT-4756 Fix comment in python integer encoder
WT-4759 Save a copy when an old overflow value is discarded
WT-4764 Avoid choosing a transaction frequency of 0 in test/format
Diffstat (limited to 'src/third_party/wiredtiger/test/suite')
39 files changed, 118 insertions, 124 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_alter02.py b/src/third_party/wiredtiger/test/suite/test_alter02.py index 7a135d99b74..156bf855c90 100755 --- a/src/third_party/wiredtiger/test/suite/test_alter02.py +++ b/src/third_party/wiredtiger/test/suite/test_alter02.py @@ -116,14 +116,16 @@ class test_alter02(wttest.WiredTigerTestCase): keys = c.get_key() # txnid, rectype, optype, fileid, logrec_key, logrec_value values = c.get_value() - # We are only looking for log records that that have a key/value - # pair. - if values[4] != b'': - if self.value.encode() in values[5]: # logrec_value - count += 1 - self.assertFalse(self.value2.encode() in values[5]) + if self.value.encode() in values[5]: # logrec_value + count += 1 + self.assertFalse(self.value2.encode() in values[5]) c.close() - self.assertEqual(count, expected_keys) + # + # We check that we saw the expected keys at twice the rate because + # the log cursor, for each commit record, will first return the entire, + # full record, and then return the individual operation. We will detect + # the string in both records. + self.assertEqual(count, expected_keys * 2) # Alter: Change the log setting after creation def test_alter02_log(self): diff --git a/src/third_party/wiredtiger/test/suite/test_assert01.py b/src/third_party/wiredtiger/test/suite/test_assert01.py index 2cacee4c608..af20375ed35 100644 --- a/src/third_party/wiredtiger/test/suite/test_assert01.py +++ b/src/third_party/wiredtiger/test/suite/test_assert01.py @@ -48,6 +48,7 @@ class test_assert01(wttest.WiredTigerTestCase, suite_subprocess): cfg_def = '' cfg_never = 'assert=(commit_timestamp=never)' cfg_none = 'assert=(commit_timestamp=none)' + session_config = 'isolation=snapshot' count = 1 # diff --git a/src/third_party/wiredtiger/test/suite/test_assert02.py b/src/third_party/wiredtiger/test/suite/test_assert02.py index b1207e26c37..46b4f191917 100644 --- a/src/third_party/wiredtiger/test/suite/test_assert02.py +++ b/src/third_party/wiredtiger/test/suite/test_assert02.py @@ -37,6 +37,8 @@ def timestamp_str(t): return '%x' % t class test_assert02(wttest.WiredTigerTestCase, suite_subprocess): + session_config = 'isolation=snapshot' + def test_read_timestamp(self): #if not wiredtiger.diagnostic_build(): # self.skipTest('requires a diagnostic build') diff --git a/src/third_party/wiredtiger/test/suite/test_assert04.py b/src/third_party/wiredtiger/test/suite/test_assert04.py index 59aafd2d4cc..808f9607783 100644 --- a/src/third_party/wiredtiger/test/suite/test_assert04.py +++ b/src/third_party/wiredtiger/test/suite/test_assert04.py @@ -37,6 +37,8 @@ def timestamp_str(t): return '%x' % t class test_assert04(wttest.WiredTigerTestCase, suite_subprocess): + session_config = 'isolation=snapshot' + def test_timestamp_alter(self): base = 'assert04' uri = 'file:' + base diff --git a/src/third_party/wiredtiger/test/suite/test_assert05.py b/src/third_party/wiredtiger/test/suite/test_assert05.py index 39c79054baf..ab7f8265930 100644 --- a/src/third_party/wiredtiger/test/suite/test_assert05.py +++ b/src/third_party/wiredtiger/test/suite/test_assert05.py @@ -39,6 +39,7 @@ def timestamp_str(t): class test_assert05(wttest.WiredTigerTestCase, suite_subprocess): base = 'assert05' base_uri = 'file:' + base + session_config = 'isolation=snapshot' uri_always = base_uri + '.always.wt' uri_def = base_uri + '.def.wt' uri_never = base_uri + '.never.wt' diff --git a/src/third_party/wiredtiger/test/suite/test_assert06.py b/src/third_party/wiredtiger/test/suite/test_assert06.py index 17b38fb0f03..bc7532cd648 100644 --- a/src/third_party/wiredtiger/test/suite/test_assert06.py +++ b/src/third_party/wiredtiger/test/suite/test_assert06.py @@ -37,6 +37,8 @@ def timestamp_str(t): return '%x' % t class test_assert06(wttest.WiredTigerTestCase, suite_subprocess): + session_config = 'isolation=snapshot' + def apply_timestamps(self, timestamp): self.session.prepare_transaction( 'prepare_timestamp=' + timestamp_str(timestamp)) diff --git a/src/third_party/wiredtiger/test/suite/test_backup08.py b/src/third_party/wiredtiger/test/suite/test_backup08.py index dccb873f5ab..acd1cf82ef6 100644 --- a/src/third_party/wiredtiger/test/suite/test_backup08.py +++ b/src/third_party/wiredtiger/test/suite/test_backup08.py @@ -39,6 +39,7 @@ def timestamp_str(t): class test_backup08(wttest.WiredTigerTestCase): conn_config = 'config_base=false,create,log=(enabled)' + session_config = 'isolation=snapshot' dir = 'backup.dir' coll1_uri = 'table:collection10.1' coll2_uri = 'table:collection10.2' diff --git a/src/third_party/wiredtiger/test/suite/test_durable_rollback_to_stable.py b/src/third_party/wiredtiger/test/suite/test_durable_rollback_to_stable.py index e54bd3deaf2..d5b74c09e6f 100644 --- a/src/third_party/wiredtiger/test/suite/test_durable_rollback_to_stable.py +++ b/src/third_party/wiredtiger/test/suite/test_durable_rollback_to_stable.py @@ -38,6 +38,7 @@ def timestamp_str(t): # Checking visibility and durability of updates with durable_timestamp and # with rollback to stable. class test_durable_rollback_to_stable(wttest.WiredTigerTestCase): + session_config = 'isolation=snapshot' keyfmt = [ ('row-string', dict(keyfmt='S')), @@ -71,7 +72,7 @@ class test_durable_rollback_to_stable(wttest.WiredTigerTestCase): ds = self.ds(self, uri, 50, key_format=self.keyfmt) ds.populate() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) # Set stable timestamp to checkpoint initial data set. @@ -155,7 +156,7 @@ class test_durable_rollback_to_stable(wttest.WiredTigerTestCase): # Check that second update value was not durable by reopening. self.conn.rollback_to_stable() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) self.conn.set_timestamp('stable_timestamp=' + timestamp_str(250)) self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(250)) diff --git a/src/third_party/wiredtiger/test/suite/test_durable_ts01.py b/src/third_party/wiredtiger/test/suite/test_durable_ts01.py index c62372629cb..562d93b3d40 100644 --- a/src/third_party/wiredtiger/test/suite/test_durable_ts01.py +++ b/src/third_party/wiredtiger/test/suite/test_durable_ts01.py @@ -38,6 +38,7 @@ def timestamp_str(t): # Checking visibility and durability of updates with durable_timestamp and # with restart. class test_durable_ts01(wttest.WiredTigerTestCase): + session_config = 'isolation=snapshot' keyfmt = [ ('row-string', dict(keyfmt='S')), @@ -71,7 +72,7 @@ class test_durable_ts01(wttest.WiredTigerTestCase): ds = self.ds(self, uri, 50, key_format=self.keyfmt) ds.populate() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) # Set stable timestamp to checkpoint initial data set. @@ -155,7 +156,7 @@ class test_durable_ts01(wttest.WiredTigerTestCase): # Check that second update value was not durable by reopening. self.reopen_conn() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) self.conn.set_timestamp('stable_timestamp=' + timestamp_str(250)) self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(250)) diff --git a/src/third_party/wiredtiger/test/suite/test_durable_ts02.py b/src/third_party/wiredtiger/test/suite/test_durable_ts02.py index feb238aa268..15b9bfdec82 100644 --- a/src/third_party/wiredtiger/test/suite/test_durable_ts02.py +++ b/src/third_party/wiredtiger/test/suite/test_durable_ts02.py @@ -37,6 +37,7 @@ def timestamp_str(t): # test_durable_ts03.py # Checking visibility and durability of updates with durable_timestamp class test_durable_ts03(wttest.WiredTigerTestCase): + session_config = 'isolation=snapshot' keyfmt = [ ('row-string', dict(keyfmt='S')), @@ -70,7 +71,7 @@ class test_durable_ts03(wttest.WiredTigerTestCase): ds = self.ds(self, uri, 50, key_format=self.keyfmt) ds.populate() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) # Set stable timestamp to checkpoint initial data set. diff --git a/src/third_party/wiredtiger/test/suite/test_durable_ts03.py b/src/third_party/wiredtiger/test/suite/test_durable_ts03.py index 9546c8f267c..19e452e8ce6 100755 --- a/src/third_party/wiredtiger/test/suite/test_durable_ts03.py +++ b/src/third_party/wiredtiger/test/suite/test_durable_ts03.py @@ -35,8 +35,8 @@ def timestamp_str(t): # test_durable_ts03.py # Check that the checkpoint honors the durable timestamp of updates. class test_durable_ts03(wttest.WiredTigerTestCase): - def conn_config(self): - return 'cache_size=10MB' + conn_config = 'cache_size=10MB' + session_config = 'isolation=snapshot' def test_durable_ts03(self): # Create a table. @@ -52,7 +52,7 @@ class test_durable_ts03(wttest.WiredTigerTestCase): ',oldest_timestamp=' + timestamp_str(1)) # Load the data into the table. - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) for i in range(0, nrows): session.begin_transaction() @@ -100,7 +100,7 @@ class test_durable_ts03(wttest.WiredTigerTestCase): session.close() self.reopen_conn() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) self.conn.set_timestamp('stable_timestamp=' + timestamp_str(210) + \ ',oldest_timestamp=' + timestamp_str(210)) @@ -122,7 +122,7 @@ class test_durable_ts03(wttest.WiredTigerTestCase): session.close() self.reopen_conn() - session = self.conn.open_session() + session = self.conn.open_session(self.session_config) cursor = session.open_cursor(uri, None) self.conn.set_timestamp('stable_timestamp=' + timestamp_str(250) + \ ',oldest_timestamp=' + timestamp_str(250)) diff --git a/src/third_party/wiredtiger/test/suite/test_las01.py b/src/third_party/wiredtiger/test/suite/test_las01.py index 25f34c01952..6f736d72238 100755 --- a/src/third_party/wiredtiger/test/suite/test_las01.py +++ b/src/third_party/wiredtiger/test/suite/test_las01.py @@ -37,8 +37,8 @@ def timestamp_str(t): # Smoke tests to ensure lookaside tables are working. class test_las01(wttest.WiredTigerTestCase): # Force a small cache. - def conn_config(self): - return 'cache_size=50MB' + conn_config = 'cache_size=50MB' + session_config = 'isolation=snapshot' def large_updates(self, session, uri, value, ds, nrows, timestamp=False): # Update a large number of records, we'll hang if the lookaside table diff --git a/src/third_party/wiredtiger/test/suite/test_las02.py b/src/third_party/wiredtiger/test/suite/test_las02.py index 2ab4d4ec918..11c4a6579f4 100644 --- a/src/third_party/wiredtiger/test/suite/test_las02.py +++ b/src/third_party/wiredtiger/test/suite/test_las02.py @@ -37,8 +37,8 @@ def timestamp_str(t): # Test that truncate with lookaside entries and timestamps gives expected results. class test_las02(wttest.WiredTigerTestCase): # Force a small cache. - def conn_config(self): - return 'cache_size=50MB,log=(enabled)' + conn_config = 'cache_size=50MB,log=(enabled)' + session_config = 'isolation=snapshot' def large_updates(self, uri, value, ds, nrows, commit_ts): # Update a large number of records, we'll hang if the lookaside table isn't working. diff --git a/src/third_party/wiredtiger/test/suite/test_las03.py b/src/third_party/wiredtiger/test/suite/test_las03.py index 60ad25cf6d7..cf327a19e1e 100755 --- a/src/third_party/wiredtiger/test/suite/test_las03.py +++ b/src/third_party/wiredtiger/test/suite/test_las03.py @@ -38,8 +38,8 @@ def timestamp_str(t): # Ensure checkpoints don't read too unnecessary lookaside entries. class test_las03(wttest.WiredTigerTestCase): # Force a small cache. - def conn_config(self): - return 'cache_size=50MB,statistics=(fast)' + conn_config = 'cache_size=50MB,statistics=(fast)' + session_config = 'isolation=snapshot' def get_stat(self, stat): stat_cursor = self.session.open_cursor('statistics:') @@ -96,7 +96,7 @@ class test_las03(wttest.WiredTigerTestCase): # Since we're dealing with eviction concurrent with checkpoints # and skewing is controlled by a heuristic, we can't put too tight # a bound on this. - self.assertLessEqual(las_reads, 100) + self.assertLessEqual(las_reads, 200) if __name__ == '__main__': wttest.run() diff --git a/src/third_party/wiredtiger/test/suite/test_prepare01.py b/src/third_party/wiredtiger/test/suite/test_prepare01.py index 596ceb6fdf8..94e9d95dc0e 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare01.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare01.py @@ -32,6 +32,8 @@ from wtscenario import make_scenarios # test_prepare01.py # Transactions: basic functionality with prepare class test_prepare01(wttest.WiredTigerTestCase): + session_config = 'isolation=snapshot' + nentries = 1000 scenarios = make_scenarios([ ('col-f', dict(uri='file:text_txn01',key_format='r',value_format='S')), @@ -141,49 +143,5 @@ class test_prepare01(wttest.WiredTigerTestCase): self.session.commit_transaction() self.check(cursor, self.nentries, self.nentries) -# Test that read-committed is the default isolation level. -class test_read_committed_default(wttest.WiredTigerTestCase): - uri = 'table:test_prepare' - - # Return the number of records visible to the cursor. - def cursor_count(self, cursor): - count = 0 - for r in cursor: - count += 1 - return count - - def test_read_committed_default(self): - self.session.create(self.uri, 'key_format=S,value_format=S') - cursor = self.session.open_cursor(self.uri, None) - self.session.begin_transaction() - cursor['key: aaa'] = 'value: aaa' - - self.session.prepare_transaction("prepare_timestamp=2a") - self.session.timestamp_transaction("commit_timestamp=3a") - self.session.timestamp_transaction("durable_timestamp=3a") - self.session.commit_transaction() - self.session.begin_transaction() - cursor['key: bbb'] = 'value: bbb' - - s = self.conn.open_session() - cursor = s.open_cursor(self.uri, None) - s.begin_transaction("isolation=read-committed") - self.assertEqual(self.cursor_count(cursor), 1) - - s.prepare_transaction("prepare_timestamp=4a") - # commit timestamp can be same as prepare timestamp - s.timestamp_transaction("commit_timestamp=4a") - s.timestamp_transaction("durable_timestamp=4a") - s.commit_transaction() - s.begin_transaction() - self.assertEqual(self.cursor_count(cursor), 1) - s.prepare_transaction("prepare_timestamp=7a") - - # commit timestamp can be greater than prepare timestamp - s.timestamp_transaction("commit_timestamp=8a") - s.timestamp_transaction("durable_timestamp=8a") - s.commit_transaction() - s.close() - if __name__ == '__main__': wttest.run() diff --git a/src/third_party/wiredtiger/test/suite/test_prepare02.py b/src/third_party/wiredtiger/test/suite/test_prepare02.py index fc92adaad63..7546cc44d59 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare02.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare02.py @@ -37,6 +37,8 @@ def timestamp_str(t): return '%x' % t class test_prepare02(wttest.WiredTigerTestCase, suite_subprocess): + session_config = 'isolation=snapshot' + def test_prepare_session_operations(self): self.session.create("table:mytable", "key_format=S,value_format=S") cursor = self.session.open_cursor("table:mytable", None) diff --git a/src/third_party/wiredtiger/test/suite/test_prepare03.py b/src/third_party/wiredtiger/test/suite/test_prepare03.py index 9abfa7b2957..f3656caa0af 100755 --- a/src/third_party/wiredtiger/test/suite/test_prepare03.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare03.py @@ -41,6 +41,7 @@ class test_prepare03(wttest.WiredTigerTestCase): """ table_name = 'test_prepare_cursor' nentries = 10 + session_config = 'isolation=snapshot' scenarios = make_scenarios([ ('file-col', dict(tablekind='col',uri='file', format='key_format=r,value_format=S')), diff --git a/src/third_party/wiredtiger/test/suite/test_prepare04.py b/src/third_party/wiredtiger/test/suite/test_prepare04.py index 9d3d78804c0..648c8fbb178 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare04.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare04.py @@ -41,6 +41,8 @@ def timestamp_str(t): class test_prepare04(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_prepare_cursor' uri = 'table:' + tablename + session_config = 'isolation=snapshot' + before_ts = timestamp_str(150) prepare_ts = timestamp_str(200) after_ts = timestamp_str(250) diff --git a/src/third_party/wiredtiger/test/suite/test_prepare05.py b/src/third_party/wiredtiger/test/suite/test_prepare05.py index 6c1f414ddd7..9c812879315 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare05.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare05.py @@ -39,6 +39,7 @@ def timestamp_str(t): class test_prepare05(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_prepare05' uri = 'table:' + tablename + session_config = 'isolation=snapshot' def test_timestamp_api(self): self.session.create(self.uri, 'key_format=i,value_format=i') @@ -76,24 +77,25 @@ class test_prepare05(wttest.WiredTigerTestCase, suite_subprocess): # It is illegal to set a prepare timestamp same as or earlier than an # active read timestamp. # Start a new reader to have an active read timestamp. - s_reader = self.conn.open_session() - s_reader.begin_transaction('read_timestamp=' + timestamp_str(4)) - self.session.begin_transaction() - self.assertRaisesWithMessage(wiredtiger.WiredTigerError, - lambda: self.session.prepare_transaction( - 'prepare_timestamp=' + timestamp_str(4)), - "/must be greater than the latest active read timestamp/") - self.session.rollback_transaction() + if wiredtiger.diagnostic_build(): + s_reader = self.conn.open_session() + s_reader.begin_transaction('read_timestamp=' + timestamp_str(4)) + self.session.begin_transaction() + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.prepare_transaction( + 'prepare_timestamp=' + timestamp_str(4)), + "/must be greater than the latest active read timestamp/") + self.session.rollback_transaction() - # Check setting the prepare timestamp as later than active read - # timestamp is valid. - self.session.begin_transaction() - c[1] = 1 - self.session.prepare_transaction( - 'prepare_timestamp=' + timestamp_str(5)) - # Resolve the reader transaction started earlier. - s_reader.rollback_transaction() - self.session.rollback_transaction() + # Check setting the prepare timestamp as later than active read + # timestamp is valid. + self.session.begin_transaction() + c[1] = 1 + self.session.prepare_transaction( + 'prepare_timestamp=' + timestamp_str(5)) + # Resolve the reader transaction started earlier. + s_reader.rollback_transaction() + self.session.rollback_transaction() # It is illegal to set a commit timestamp older than prepare # timestamp of a transaction. diff --git a/src/third_party/wiredtiger/test/suite/test_prepare06.py b/src/third_party/wiredtiger/test/suite/test_prepare06.py index 68546c4fb6f..6255630d4ef 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare06.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare06.py @@ -39,6 +39,7 @@ def timestamp_str(t): class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_prepare06' uri = 'table:' + tablename + session_config = 'isolation=snapshot' def test_timestamp_api(self): self.session.create(self.uri, 'key_format=i,value_format=i') @@ -81,22 +82,24 @@ class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess): s_reader.begin_transaction('read_timestamp=' + timestamp_str(40)) # It is illegal to set the prepare timestamp as earlier than an active - # read timestamp even with roundup_timestamps settings. - self.session.begin_transaction('roundup_timestamps=(prepared=true)') - self.assertRaisesWithMessage(wiredtiger.WiredTigerError, - lambda: self.session.prepare_transaction( - 'prepare_timestamp=' + timestamp_str(10)), - "/must be greater than the latest active read timestamp/") - self.session.rollback_transaction() + # read timestamp even with roundup_timestamps settings. This is only + # checked in diagnostic builds. + if wiredtiger.diagnostic_build(): + self.session.begin_transaction('roundup_timestamps=(prepared=true)') + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.prepare_transaction( + 'prepare_timestamp=' + timestamp_str(10)), + "/must be greater than the latest active read timestamp/") + self.session.rollback_transaction() - # It is illegal to set the prepare timestamp the same as an active read - # timestamp even with roundup_timestamps settings. - self.session.begin_transaction('roundup_timestamps=(prepared=true)') - self.assertRaisesWithMessage(wiredtiger.WiredTigerError, - lambda: self.session.prepare_transaction( - 'prepare_timestamp=' + timestamp_str(40)), - "/must be greater than the latest active read timestamp/") - self.session.rollback_transaction() + # It is illegal to set the prepare timestamp the same as an active read + # timestamp even with roundup_timestamps settings. + self.session.begin_transaction('roundup_timestamps=(prepared=true)') + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.prepare_transaction( + 'prepare_timestamp=' + timestamp_str(40)), + "/must be greater than the latest active read timestamp/") + self.session.rollback_transaction() # It is illegal to set a commit timestamp less than the prepare # timestamp of a transaction. diff --git a/src/third_party/wiredtiger/test/suite/test_prepare_cursor01.py b/src/third_party/wiredtiger/test/suite/test_prepare_cursor01.py index ba53dcbcdac..63d2c2df60c 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare_cursor01.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare_cursor01.py @@ -87,7 +87,7 @@ class test_prepare_cursor01(wttest.WiredTigerTestCase): after_ts_s = self.conn.open_session() after_ts_c = after_ts_s.open_cursor(uri, None) - prep_session = self.conn.open_session() + prep_session = self.conn.open_session('isolation=snapshot') prep_cursor = prep_session.open_cursor(uri, None) # Scenario-1 : Check cursor navigate with insert in prepared transaction. diff --git a/src/third_party/wiredtiger/test/suite/test_prepare_cursor02.py b/src/third_party/wiredtiger/test/suite/test_prepare_cursor02.py index 0aeb3f62dbf..e21d5b620e6 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare_cursor02.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare_cursor02.py @@ -37,6 +37,7 @@ def timestamp_str(t): # test_prepare_cursor02.py # WT_CURSOR navigation (next/prev) tests with prepared transactions class test_prepare_cursor02(wttest.WiredTigerTestCase): + session_config = 'isolation=snapshot' keyfmt = [ ('row-store', dict(keyfmt='i')), @@ -46,11 +47,7 @@ class test_prepare_cursor02(wttest.WiredTigerTestCase): ('table-simple', dict(uri='table', ds=SimpleDataSet)), ] - iso_types = [ - ('isolation_read_committed', dict(isolation='read-committed')), - ('isolation_snapshot', dict(isolation='snapshot')) - ] - scenarios = make_scenarios(types, keyfmt, iso_types) + scenarios = make_scenarios(types, keyfmt) def skip(self): return self.keyfmt == 'r' and \ @@ -66,7 +63,7 @@ class test_prepare_cursor02(wttest.WiredTigerTestCase): ds = self.ds(self, uri, 0, key_format=self.keyfmt) ds.populate() - session = self.conn.open_session() + session = self.session cursor = session.open_cursor(uri, None) session.begin_transaction() cursor.set_key(ds.key(1)) @@ -74,7 +71,7 @@ class test_prepare_cursor02(wttest.WiredTigerTestCase): cursor.insert() session.prepare_transaction('prepare_timestamp=' + timestamp_str(100)) - prep_session = self.conn.open_session() + prep_session = self.conn.open_session(self.session_config) prep_cursor = prep_session.open_cursor(uri, None) # Check cursor navigate with insert in prepared transaction. diff --git a/src/third_party/wiredtiger/test/suite/test_prepare_lookaside01.py b/src/third_party/wiredtiger/test/suite/test_prepare_lookaside01.py index acfbefb7312..3c996b38903 100755 --- a/src/third_party/wiredtiger/test/suite/test_prepare_lookaside01.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare_lookaside01.py @@ -37,8 +37,7 @@ def timestamp_str(t): # test to ensure lookaside eviction is working for prepared transactions. class test_prepare_lookaside01(wttest.WiredTigerTestCase): # Force a small cache. - def conn_config(self): - return 'cache_size=50MB' + conn_config = 'cache_size=50MB' def prepare_updates(self, uri, ds, nrows, nsessions, nkeys): # Update a large number of records in their individual transactions. @@ -61,11 +60,11 @@ class test_prepare_lookaside01(wttest.WiredTigerTestCase): bigvalue1 = b"bbbbb" * 100 cursor = self.session.open_cursor(uri) for i in range(1, nsessions * nkeys): - self.session.begin_transaction() + self.session.begin_transaction('isolation=snapshot') cursor.set_key(ds.key(nrows + i)) cursor.set_value(bigvalue1) - self.assertEquals(cursor.update(), 0) - self.session.commit_transaction('commit_timestamp=' + timestamp_str(i)) + self.assertEquals(cursor.insert(), 0) + self.session.commit_transaction('commit_timestamp=' + timestamp_str(1)) # Have prepared updates in multiple sessions. This should ensure writing # prepared updates to the lookaside @@ -74,7 +73,7 @@ class test_prepare_lookaside01(wttest.WiredTigerTestCase): bigvalue2 = b"ccccc" * 100 for j in range (0, nsessions): sessions[j] = self.conn.open_session() - sessions[j].begin_transaction("isolation=snapshot") + sessions[j].begin_transaction('isolation=snapshot') cursors[j] = sessions[j].open_cursor(uri) # Each session will update many consecutive keys. start = (j * nkeys) @@ -82,21 +81,19 @@ class test_prepare_lookaside01(wttest.WiredTigerTestCase): for i in range(start, end): cursors[j].set_key(ds.key(nrows + i)) cursors[j].set_value(bigvalue2) - self.assertEquals(cursors[j].update(), 0) + self.assertEquals(cursors[j].insert(), 0) sessions[j].prepare_transaction('prepare_timestamp=' + timestamp_str(2)) - # Commit more regular updates. To do this, the pages that were just - # evicted need to be read back. This ensures reading prepared updates - # from the lookaside - bigvalue3 = b"ddddd" * 100 + # Re-read the original versions of all the data. To do this, the pages + # that were just evicted need to be read back. This ensures reading + # prepared updates from the lookaside cursor = self.session.open_cursor(uri) + self.session.begin_transaction('read_timestamp=' + timestamp_str(1)) for i in range(1, nsessions * nkeys): - self.session.begin_transaction() cursor.set_key(ds.key(nrows + i)) - cursor.set_value(bigvalue3) - self.assertEquals(cursor.update(), 0) - self.session.commit_transaction('commit_timestamp=' + timestamp_str(i + 3)) + self.assertEquals(cursor.search(), 0) cursor.close() + self.session.commit_transaction() # Close all cursors and sessions, this will cause prepared updates to be # rollback-ed diff --git a/src/third_party/wiredtiger/test/suite/test_stat09.py b/src/third_party/wiredtiger/test/suite/test_stat09.py index 8198ebd780d..76e568fcf8d 100644 --- a/src/third_party/wiredtiger/test/suite/test_stat09.py +++ b/src/third_party/wiredtiger/test/suite/test_stat09.py @@ -39,6 +39,7 @@ class test_stat09(wttest.WiredTigerTestCase): tablename = 'test_stat09' uri = 'table:' + tablename conn_config = 'statistics=(all)' + session_config = 'isolation=snapshot' # Check the oldest active read statistic to be at the expected values def check_stat_oldest_read(self, statcursor, expected_oldest, all_committed): diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp01.py b/src/third_party/wiredtiger/test/suite/test_timestamp01.py index bf0c0154c62..a55433fa60a 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp01.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp01.py @@ -37,6 +37,8 @@ def timestamp_str(t): return '%x' % t class test_timestamp01(wttest.WiredTigerTestCase, suite_subprocess): + session_config = 'isolation=snapshot' + def test_timestamp_range(self): # Cannot set a timestamp on a non-running transaction self.assertRaisesWithMessage(wiredtiger.WiredTigerError, diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp02.py b/src/third_party/wiredtiger/test/suite/test_timestamp02.py index c8a60b6f11f..592af1c7e13 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp02.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp02.py @@ -49,6 +49,7 @@ class test_timestamp02(wttest.WiredTigerTestCase, suite_subprocess): ]) conn_config = 'log=(enabled)' + session_config = 'isolation=snapshot' # Check that a cursor (optionally started in a new transaction), sees the # expected values. diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp03.py b/src/third_party/wiredtiger/test/suite/test_timestamp03.py index 4dc1117bb2e..5c96900e121 100755 --- a/src/third_party/wiredtiger/test/suite/test_timestamp03.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp03.py @@ -64,6 +64,7 @@ class test_timestamp03(wttest.WiredTigerTestCase, suite_subprocess): ('V1', dict(conn_config='create,log=(archive=false,enabled),compatibility=(release="2.9")', using_log=True)), ('V2', dict(conn_config='create,log=(archive=false,enabled)', using_log=True)), ] + session_config = 'isolation=snapshot' scenarios = make_scenarios(types, ckpt, conncfg) diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp04.py b/src/third_party/wiredtiger/test/suite/test_timestamp04.py index cf692d43edd..acbad7e02a4 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp04.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp04.py @@ -49,6 +49,7 @@ class test_timestamp04(wttest.WiredTigerTestCase, suite_subprocess): ('V1', dict(conn_config=',log=(enabled),compatibility=(release="2.9")', using_log=True)), ('V2', dict(conn_config=',log=(enabled)', using_log=True)), ] + session_config = 'isolation=snapshot' # Minimum cache_size requirement of lsm is 31MB. types = [ @@ -105,7 +106,7 @@ class test_timestamp04(wttest.WiredTigerTestCase, suite_subprocess): self.conn = wiredtiger.wiredtiger_open(self.home, conn_params) except wiredtiger.WiredTigerError as e: print("Failed conn at '%s' with config '%s'" % (dir, conn_params)) - self.session = self.conn.open_session(None) + self.session = wttest.WiredTigerTestCase.setUpSessionOpen(self, self.conn) def test_rollback_to_stable(self): self.ConnectionOpen(self.cacheSize) diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp05.py b/src/third_party/wiredtiger/test/suite/test_timestamp05.py index 6ef6a92851e..44e1076f3d0 100755 --- a/src/third_party/wiredtiger/test/suite/test_timestamp05.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp05.py @@ -40,6 +40,7 @@ def timestamp_str(t): class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess): uri = 'table:ts05' + session_config = 'isolation=snapshot' def test_create(self): s = self.session diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp06.py b/src/third_party/wiredtiger/test/suite/test_timestamp06.py index a085f0f0d27..55981f67a98 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp06.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp06.py @@ -60,6 +60,7 @@ class test_timestamp06(wttest.WiredTigerTestCase, suite_subprocess): ('V1', dict(conn_config='create,log=(archive=false,enabled),compatibility=(release="2.9")', using_log=True)), ('V2', dict(conn_config='create,log=(archive=false,enabled)', using_log=True)), ] + session_config = 'isolation=snapshot' scenarios = make_scenarios(conncfg, types, ckpt) diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp07.py b/src/third_party/wiredtiger/test/suite/test_timestamp07.py index ab76ff7ea10..2a7193c34a5 100755 --- a/src/third_party/wiredtiger/test/suite/test_timestamp07.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp07.py @@ -53,6 +53,7 @@ class test_timestamp07(wttest.WiredTigerTestCase, suite_subprocess): ('nolog', dict(conn_config='create,cache_size=2M', using_log=False)), ('log', dict(conn_config='create,log=(file_max=1M,archive=false,enabled),cache_size=2M', using_log=True)), ] + session_config = 'isolation=snapshot' nkeys = [ ('100keys', dict(nkeys=100)), diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp09.py b/src/third_party/wiredtiger/test/suite/test_timestamp09.py index 9e06c38df60..c4b545fe2c1 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp09.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp09.py @@ -39,6 +39,7 @@ def timestamp_str(t): class test_timestamp09(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_timestamp09' uri = 'table:' + tablename + session_config = 'isolation=snapshot' def test_timestamp_api(self): self.session.create(self.uri, 'key_format=i,value_format=i') diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp10.py b/src/third_party/wiredtiger/test/suite/test_timestamp10.py index 6fcd73cc7ce..791321463ef 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp10.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp10.py @@ -39,6 +39,7 @@ def timestamp_str(t): class test_timestamp10(wttest.WiredTigerTestCase, suite_subprocess): conn_config = 'config_base=false,create,log=(enabled)' + session_config = 'isolation=snapshot' coll1_uri = 'table:collection10.1' coll2_uri = 'table:collection10.2' coll3_uri = 'table:collection10.3' diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp11.py b/src/third_party/wiredtiger/test/suite/test_timestamp11.py index e9d79e078c5..1256a544d78 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp11.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp11.py @@ -37,6 +37,8 @@ def timestamp_str(t): return '%x' % t class test_timestamp11(wttest.WiredTigerTestCase, suite_subprocess): + session_config = 'isolation=snapshot' + def test_timestamp_range(self): base = 'timestamp11' uri = 'file:' + base diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp12.py b/src/third_party/wiredtiger/test/suite/test_timestamp12.py index d5dd138e313..82621a606e9 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp12.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp12.py @@ -38,6 +38,7 @@ def timestamp_str(t): class test_timestamp12(wttest.WiredTigerTestCase): conn_config = 'config_base=false,create,log=(enabled)' + session_config = 'isolation=snapshot' coll_uri = 'table:collection12' oplog_uri = 'table:oplog12' closecfg = [ diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp13.py b/src/third_party/wiredtiger/test/suite/test_timestamp13.py index 1585a4cb194..0d230da848b 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp13.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp13.py @@ -46,6 +46,7 @@ class test_timestamp13(wttest.WiredTigerTestCase, suite_subprocess): ]) conn_config = 'log=(enabled)' + session_config = 'isolation=snapshot' def test_degenerate_timestamps(self): self.session.create(self.uri, diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp14.py b/src/third_party/wiredtiger/test/suite/test_timestamp14.py index 24b487b193d..f465f4ffcf2 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp14.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp14.py @@ -41,6 +41,7 @@ def timestamp_str(t): class test_timestamp14(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_timestamp14' uri = 'table:' + tablename + session_config = 'isolation=snapshot' def test_all_committed(self): all_committed_uri = self.uri + '_all_committed' diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp16.py b/src/third_party/wiredtiger/test/suite/test_timestamp16.py index 375150e4673..bef116d62a9 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp16.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp16.py @@ -42,6 +42,7 @@ def timestamp_str(t): class test_timestamp16(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_timestamp16' uri = 'table:' + tablename + session_config = 'isolation=snapshot' def test_read_timestamp_cleared(self): # Ensure that the read timestamp doesn't move our checkpoint. diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp17.py b/src/third_party/wiredtiger/test/suite/test_timestamp17.py index cbda72af39c..ad1a9770173 100644 --- a/src/third_party/wiredtiger/test/suite/test_timestamp17.py +++ b/src/third_party/wiredtiger/test/suite/test_timestamp17.py @@ -44,6 +44,7 @@ def timestamp_str(t): class test_timestamp17(wttest.WiredTigerTestCase, suite_subprocess): tablename = 'test_timestamp17' uri = 'table:' + tablename + session_config = 'isolation=snapshot' def test_inconsistent_timestamping(self): self.session.create(self.uri, 'key_format=i,value_format=i') |