diff options
Diffstat (limited to 'src/third_party/wiredtiger/test')
8 files changed, 216 insertions, 26 deletions
diff --git a/src/third_party/wiredtiger/test/csuite/Makefile.am b/src/third_party/wiredtiger/test/csuite/Makefile.am index cf58cecc8a6..553738fd418 100644 --- a/src/third_party/wiredtiger/test/csuite/Makefile.am +++ b/src/third_party/wiredtiger/test/csuite/Makefile.am @@ -121,8 +121,7 @@ all_TESTS += test_wt3874_pad_byte_collator test_wt4105_large_doc_small_upd_SOURCES = wt4105_large_doc_small_upd/main.c noinst_PROGRAMS += test_wt4105_large_doc_small_upd -# Temporarily disabled (WT-5579) -# all_TESTS += test_wt4105_large_doc_small_upd +all_TESTS += test_wt4105_large_doc_small_upd test_wt4117_checksum_SOURCES = wt4117_checksum/main.c noinst_PROGRAMS += test_wt4117_checksum diff --git a/src/third_party/wiredtiger/test/csuite/wt4105_large_doc_small_upd/main.c b/src/third_party/wiredtiger/test/csuite/wt4105_large_doc_small_upd/main.c index b56a638c6ed..c831180c130 100644 --- a/src/third_party/wiredtiger/test/csuite/wt4105_large_doc_small_upd/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt4105_large_doc_small_upd/main.c @@ -130,7 +130,7 @@ main(int argc, char *argv[]) modify_entry.offset = offset; modify_entry.size = modify_entry.data.size; /* FIXME-WT-6113: extend timeout to pass the test */ - (void)alarm(7); + (void)alarm(15); testutil_check(c->modify(c, &modify_entry, 1)); (void)alarm(0); testutil_check(session2->commit_transaction(session2, NULL)); diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml index c6cc86249da..8d8893f4bad 100755 --- a/src/third_party/wiredtiger/test/evergreen.yml +++ b/src/third_party/wiredtiger/test/evergreen.yml @@ -556,6 +556,7 @@ tasks: posix_configure_flags: --enable-silent-rules --enable-strict --enable-diagnostic --disable-static - func: "make check all" vars: + smp_command: -j 1 test_env_vars: MSAN_OPTIONS=abort_on_error=1:disable_coredump=0 MSAN_SYMBOLIZER_PATH=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer TESTUTIL_SLOW_MACHINE=1 - name: make-check-asan-test @@ -571,6 +572,7 @@ tasks: posix_configure_flags: --enable-silent-rules --enable-strict --enable-diagnostic --disable-static - func: "make check all" vars: + smp_command: -j 1 test_env_vars: ASAN_OPTIONS=detect_leaks=1:abort_on_error=1:disable_coredump=0 ASAN_SYMBOLIZER_PATH=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer TESTUTIL_SLOW_MACHINE=1 - name: make-check-linux-no-ftruncate-test diff --git a/src/third_party/wiredtiger/test/suite/test_compact02.py b/src/third_party/wiredtiger/test/suite/test_compact02.py index e466aa81a95..0b68b695e38 100644 --- a/src/third_party/wiredtiger/test/suite/test_compact02.py +++ b/src/third_party/wiredtiger/test/suite/test_compact02.py @@ -149,7 +149,7 @@ class test_compact02(wttest.WiredTigerTestCase): # Compact can collide with eviction, if that happens we retry. Wait for # a long time, the check for EBUSY means we're not retrying on any real # errors. - for i in range(1, 80): + for i in range(1, 100): if not self.raisesBusy( lambda: self.session.compact(self.uri, None)): break diff --git a/src/third_party/wiredtiger/test/suite/test_prepare08.py b/src/third_party/wiredtiger/test/suite/test_prepare08.py index 87e9997b110..9b2ac655ede 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare08.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare08.py @@ -34,12 +34,12 @@ from wtdataset import SimpleDataSet def timestamp_str(t): return '%x' % t -# test_prepare07.py -# Test to ensure prepared tombstones are properly aborted even when they are written +# test_prepare08.py +# Test to ensure prepared tombstones are properly aborted/committed even when they are written # to the data store. class test_prepare08(wttest.WiredTigerTestCase): # Force a small cache. - conn_config = 'cache_size=10MB,eviction_dirty_trigger=80,eviction_updates_trigger=80' + conn_config = 'cache_size=5MB,eviction_dirty_trigger=80,eviction_updates_trigger=80' def updates(self, ds, uri, nrows, value, ts): cursor = self.session.open_cursor(uri) @@ -47,7 +47,16 @@ class test_prepare08(wttest.WiredTigerTestCase): for i in range(1, nrows): cursor.set_key(ds.key(i)) cursor.set_value(value) - self.assertEquals(cursor.insert(), 0) + self.assertEquals(cursor.update(), 0) + self.session.commit_transaction('commit_timestamp=' + timestamp_str(ts)) + cursor.close() + + def removes(self, ds, uri, nrows, ts): + cursor = self.session.open_cursor(uri) + self.session.begin_transaction('isolation=snapshot') + for i in range(1, nrows): + cursor.set_key(ds.key(i)) + self.assertEquals(cursor.remove(), 0) self.session.commit_transaction('commit_timestamp=' + timestamp_str(ts)) cursor.close() @@ -56,50 +65,220 @@ class test_prepare08(wttest.WiredTigerTestCase): self.session.begin_transaction('ignore_prepare=true,read_timestamp=' + timestamp_str(ts)) for i in range(1, nrows): cursor.set_key(ds.key(i)) - self.assertEquals(cursor.search(), 0) - self.assertEquals(cursor.get_value(),value) + if value == None: + self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND) + else: + self.assertEquals(cursor.search(), 0) + self.assertEquals(cursor.get_value(),value) self.session.commit_transaction() cursor.close() - def test_prepare(self): + def test_prepare_delete_rollback(self): + nrows = 2000 + # Create a small table. - uri = "table:test" - nrows = 1000 - ds = SimpleDataSet(self, uri, 0, key_format="S", value_format='u') - ds.populate() + uri_1 = "table:test_prepare08_1" + ds_1 = SimpleDataSet(self, uri_1, 0, key_format="S", value_format='u') + ds_1.populate() + + uri_2 = "table:test_prepare08_2" + ds_2 = SimpleDataSet(self, uri_2, 0, key_format="S", value_format='u') + ds_2.populate() value_a = b"aaaaa" * 100 value_b = b"bbbbb" * 100 + value_c = b"ccccc" * 100 + value_d = b"ddddd" * 100 + value_e = b"eeeee" * 100 # Commit some updates along with a prepared update, which is not resolved. self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10)) self.conn.set_timestamp('stable_timestamp=' + timestamp_str(10)) # Initially load huge data - self.updates(ds, uri, nrows, value_a, 20) + self.updates(ds_1, uri_1, nrows, value_a, 20) + self.updates(ds_2, uri_2, nrows, value_a, 20) + # Add some more updates - self.updates(ds, uri, nrows, value_b, 30) + self.updates(ds_1, uri_1, nrows, value_b, 30) + self.updates(ds_2, uri_2, nrows, value_b, 30) + + # Verify the updates + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, nrows, value_b, 30) + + self.check(ds_2, uri_2, nrows, value_a, 20) + self.check(ds_2, uri_2, nrows, value_b, 30) # Checkpoint self.session.checkpoint() - # Remove the updates from a prepare session and and keep it open. + # Remove the updates from a prepare session and keep it open. session_p = self.conn.open_session() - cursor_p = session_p.open_cursor(uri) + cursor_p = session_p.open_cursor(uri_1) session_p.begin_transaction('isolation=snapshot') for i in range(1, nrows): - cursor_p.set_key(ds.key(i)) + cursor_p.set_key(ds_1.key(i)) self.assertEquals(cursor_p.remove(), 0) session_p.prepare_transaction('prepare_timestamp=' + timestamp_str(40)) - self.check(ds, uri, nrows, value_a, 20) - self.check(ds, uri, nrows, value_b, 50) + # Adding more updates to other table should trigger eviction on uri_1 + self.updates(ds_2, uri_2, nrows, value_c, 40) + self.updates(ds_2, uri_2, nrows, value_d, 50) + self.updates(ds_2, uri_2, nrows, value_e, 60) + + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, nrows, value_b, 50) #rollback the prepared session session_p.rollback_transaction() - self.check(ds, uri, nrows, value_a, 20) - self.check(ds, uri, nrows, value_b, 50) + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, nrows, value_b, 50) + + # close sessions. + cursor_p.close() + session_p.close() + self.session.close() + + def test_prepare_update_delete_commit(self): + nrows = 2000 + + # Create a small table. + uri_1 = "table:test_prepare10_1" + ds_1 = SimpleDataSet(self, uri_1, 0, key_format="S", value_format='u') + ds_1.populate() + + # Create another small table. + uri_2 = "table:test_prepare10_2" + ds_2 = SimpleDataSet(self, uri_2, 0, key_format="S", value_format='u') + ds_2.populate() + + value_a = b"aaaaa" * 100 + value_b = b"bbbbb" * 100 + value_c = b"ccccc" * 100 + value_d = b"ddddd" * 100 + value_e = b"eeeee" * 100 + + # Commit some updates along with a prepared update, which is not resolved. + self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10)) + self.conn.set_timestamp('stable_timestamp=' + timestamp_str(10)) + + # Initially load huge data + self.updates(ds_1, uri_1, nrows, value_a, 20) + self.updates(ds_2, uri_2, nrows, value_a, 20) + + # Add some more updates + self.updates(ds_1, uri_1, nrows, value_b, 30) + self.updates(ds_2, uri_2, nrows, value_b, 30) + + # Verify the updates + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, nrows, value_b, 30) + + self.check(ds_2, uri_2, nrows, value_a, 20) + self.check(ds_2, uri_2, nrows, value_b, 30) + + # Checkpoint + self.session.checkpoint() + + # Remove the updates from a prepare session and keep it open. + session_p = self.conn.open_session() + cursor_p = session_p.open_cursor(uri_1) + session_p.begin_transaction('isolation=snapshot') + for i in range(1, nrows): + cursor_p.set_key(ds_1.key(i)) + cursor_p.set_value(value_c) + self.assertEquals(cursor_p.update(), 0) + cursor_p.set_key(ds_1.key(i)) + self.assertEquals(cursor_p.remove(), 0) + session_p.prepare_transaction('prepare_timestamp=' + timestamp_str(40)) + + # Adding more updates to other table should trigger eviction on uri_1 + self.updates(ds_2, uri_2, nrows, value_c, 40) + self.updates(ds_2, uri_2, nrows, value_d, 50) + self.updates(ds_2, uri_2, nrows, value_e, 60) + + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, nrows, value_b, 30) + self.check(ds_1, uri_1, nrows, value_b, 50) + + # Commit the prepared session + session_p.commit_transaction('commit_timestamp=' + timestamp_str(50) + ',durable_timestamp=' + timestamp_str(60)) + + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, nrows, value_b, 30) + self.check(ds_1, uri_1, 0, None, 50) + + # close sessions. + cursor_p.close() + session_p.close() + self.session.close() + + def test_prepare_update_delete_commit_with_no_base_update(self): + nrows = 2000 + + # Create a small table. + uri_1 = "table:test_prepare10_1" + ds_1 = SimpleDataSet(self, uri_1, 0, key_format="S", value_format='u') + ds_1.populate() + + # Create another small table. + uri_2 = "table:test_prepare10_2" + ds_2 = SimpleDataSet(self, uri_2, 0, key_format="S", value_format='u') + ds_2.populate() + + value_a = b"aaaaa" * 100 + value_b = b"bbbbb" * 100 + value_c = b"ccccc" * 100 + value_d = b"ddddd" * 100 + value_e = b"eeeee" * 100 + + # Commit some updates along with a prepared update, which is not resolved. + self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10)) + self.conn.set_timestamp('stable_timestamp=' + timestamp_str(10)) + + # Initially load huge data + self.updates(ds_1, uri_1, nrows, value_a, 20) + self.updates(ds_2, uri_2, nrows, value_a, 20) + + # Remove updates from one table and add some more updates to another table + self.removes(ds_1, uri_1, nrows, 30) + self.updates(ds_2, uri_2, nrows, value_b, 30) + + # Checkpoint + self.session.checkpoint() + + # Remove the updates from a prepare session and and keep it open. + session_p = self.conn.open_session() + cursor_p = session_p.open_cursor(uri_1) + session_p.begin_transaction('isolation=snapshot') + for i in range(1, nrows): + cursor_p.set_key(ds_1.key(i)) + cursor_p.set_value(value_c) + self.assertEquals(cursor_p.update(), 0) + cursor_p.set_key(ds_1.key(i)) + cursor_p.set_value(value_d) + self.assertEquals(cursor_p.update(), 0) + cursor_p.set_key(ds_1.key(i)) + self.assertEquals(cursor_p.remove(), 0) + session_p.prepare_transaction('prepare_timestamp=' + timestamp_str(40)) + + # Adding more updates to other table should trigger eviction on uri_1 + self.updates(ds_2, uri_2, nrows, value_c, 40) + self.updates(ds_2, uri_2, nrows, value_d, 50) + self.updates(ds_2, uri_2, nrows, value_e, 60) + + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, 0, None, 30) + self.check(ds_1, uri_1, 0, None, 50) + + # Commit the prepared session + session_p.commit_transaction('commit_timestamp=' + timestamp_str(50) + ',durable_timestamp=' + timestamp_str(60)) + + self.check(ds_1, uri_1, nrows, value_a, 20) + self.check(ds_1, uri_1, 0, None, 30) + self.check(ds_1, uri_1, 0, None, 50) # close sessions. cursor_p.close() diff --git a/src/third_party/wiredtiger/test/suite/test_prepare10.py b/src/third_party/wiredtiger/test/suite/test_prepare10.py index 8a6548d9ee5..42408fac3b0 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare10.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare10.py @@ -133,7 +133,7 @@ class test_prepare10(wttest.WiredTigerTestCase): cursor3.reset() session3.begin_transaction() - # Remove the updates from a prepare session and and keep it open. + # Insert the updates from a prepare session and keep it open. session_p = self.conn.open_session() cursor_p = session_p.open_cursor(uri) session_p.begin_transaction() diff --git a/src/third_party/wiredtiger/test/suite/test_rollback_to_stable10.py b/src/third_party/wiredtiger/test/suite/test_rollback_to_stable10.py index 05e165fdfcf..1938193b77b 100755 --- a/src/third_party/wiredtiger/test/suite/test_rollback_to_stable10.py +++ b/src/third_party/wiredtiger/test/suite/test_rollback_to_stable10.py @@ -50,7 +50,7 @@ class test_rollback_to_stable10(test_rollback_to_stable_base): scenarios = make_scenarios(prepare_values) def conn_config(self): - config = 'cache_size=5MB,statistics=(all),statistics_log=(json,on_close,wait=1),log=(enabled=true),timing_stress_for_test=[history_store_checkpoint_delay]' + config = 'cache_size=6MB,statistics=(all),statistics_log=(json,on_close,wait=1),log=(enabled=true),timing_stress_for_test=[history_store_checkpoint_delay]' return config def simulate_crash_restart(self, olddir, newdir): diff --git a/src/third_party/wiredtiger/test/suite/test_txn21.py b/src/third_party/wiredtiger/test/suite/test_txn21.py index 5abf907ac84..06db7ce76aa 100644 --- a/src/third_party/wiredtiger/test/suite/test_txn21.py +++ b/src/third_party/wiredtiger/test/suite/test_txn21.py @@ -43,7 +43,17 @@ class test_txn21(wttest.WiredTigerTestCase): # Transaction-level configuration. def test_operation_timeout_txn(self): + # Test during begin. self.session.begin_transaction('operation_timeout_ms=2000') + self.session.rollback_transaction() + + # Test during rollback. + self.session.begin_transaction() + self.session.rollback_transaction('operation_timeout_ms=2000') + + # Test during commit. + self.session.begin_transaction() + self.session.commit_transaction('operation_timeout_ms=2000') if __name__ == '__main__': wttest.run() |