diff options
author | Luke Chen <luke.chen@mongodb.com> | 2020-07-01 16:53:26 +1000 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2020-07-01 17:37:58 +1000 |
commit | 8100fd85b68031907520613ac686e52588835bd3 (patch) | |
tree | f6aed217e281e8c737c40a34f384aa3b48eadc2c /src/third_party/wiredtiger/test | |
parent | 6c7c37470bdf4b9dc5ed0215ed161945f9553f0f (diff) | |
download | mongo-8100fd85b68031907520613ac686e52588835bd3.tar.gz |
Import wiredtiger: 5d5d26e79db5244a5fc748346e0e578aed306be1 from branch mongodb-4.4
ref: 46eb0217d4..5d5d26e79d
for: 4.4.0-rc12
WT-6349 Don't truncate history store updates for globally visible timestamped deletes
WT-6462 Use read uncommitted isolation level for history store operations
WT-6483 Add debugging for log file lists
WT-6484 Don't retry eviction if last_eviction_timestamp is not set
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_bug019.py | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_hs11.py | 67 |
2 files changed, 76 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_bug019.py b/src/third_party/wiredtiger/test/suite/test_bug019.py index 0cfcc2b13cb..abf68827959 100644 --- a/src/third_party/wiredtiger/test/suite/test_bug019.py +++ b/src/third_party/wiredtiger/test/suite/test_bug019.py @@ -86,6 +86,7 @@ class test_bug019(wttest.WiredTigerTestCase): self.assertTrue(self.max_prealloc > start_prealloc) # Loop, making sure pre-allocation is working and the range is moving. + self.pr("Check pre-allocation range is moving") older = self.prepfiles() for i in range(1, 10): self.populate(self.entries) @@ -94,6 +95,12 @@ class test_bug019(wttest.WiredTigerTestCase): # Files can be returned in any order when reading a directory, older # pre-allocated files can persist longer than newer files when newer # files are returned first. Confirm files are being consumed. + if set(older) < set(newer): + self.pr("FAILURE on Iteration " + str(i)) + self.pr("FAILURE: Older") + self.pr(str(older)) + self.pr("FAILURE: Newer") + self.pr(str(newer)) self.assertFalse(set(older) < set(newer)) older = newer @@ -107,6 +114,9 @@ class test_bug019(wttest.WiredTigerTestCase): if new_prealloc < self.max_prealloc: break time.sleep(1.0) + if sleepcount >= max_wait_time: + self.pr("FAILURE: sleepcount " + str(sleepcount)) + self.pr("FAILURE: max_wait_time " + str(max_wait_time)) self.assertTrue(sleepcount < max_wait_time) if __name__ == '__main__': diff --git a/src/third_party/wiredtiger/test/suite/test_hs11.py b/src/third_party/wiredtiger/test/suite/test_hs11.py index eaa991557ee..a1b9d037cb6 100644 --- a/src/third_party/wiredtiger/test/suite/test_hs11.py +++ b/src/third_party/wiredtiger/test/suite/test_hs11.py @@ -28,6 +28,7 @@ import wiredtiger, wttest from wtscenario import make_scenarios +from wiredtiger import stat def timestamp_str(t): return '%x' % t @@ -35,13 +36,19 @@ def timestamp_str(t): # test_hs11.py # Ensure that updates without timestamps clear the history store records. class test_hs11(wttest.WiredTigerTestCase): - conn_config = 'cache_size=50MB' + conn_config = 'cache_size=50MB,statistics=(all)' session_config = 'isolation=snapshot' scenarios = make_scenarios([ ('deletion', dict(update_type='deletion')), ('update', dict(update_type='update')), ]) + def get_stat(self, stat): + stat_cursor = self.session.open_cursor('statistics:') + val = stat_cursor[stat][2] + stat_cursor.close() + return val + def test_non_ts_updates_clears_hs(self): uri = 'table:test_hs11' create_params = 'key_format=S,value_format=S' @@ -71,6 +78,9 @@ class test_hs11(wttest.WiredTigerTestCase): else: cursor[str(i)] = value2 + # Reconcile and remove the obsolete entries. + self.session.checkpoint() + # Now apply an update at timestamp 10. for i in range(1, 10000): self.session.begin_transaction() @@ -90,3 +100,58 @@ class test_hs11(wttest.WiredTigerTestCase): else: self.assertEqual(cursor[str(i)], value1) self.session.rollback_transaction() + + if self.update_type == 'deletion': + hs_truncate = self.get_stat(stat.conn.cache_hs_key_truncate_onpage_removal) + self.assertGreater(hs_truncate, 0) + + def test_ts_updates_donot_clears_hs(self): + uri = 'table:test_hs11' + create_params = 'key_format=S,value_format=S' + self.session.create(uri, create_params) + + value1 = 'a' * 500 + value2 = 'b' * 500 + + # Apply a series of updates from timestamps 1-4. + self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(1)) + cursor = self.session.open_cursor(uri) + for ts in range(1, 5): + for i in range(1, 10000): + self.session.begin_transaction() + cursor[str(i)] = value1 + self.session.commit_transaction('commit_timestamp=' + timestamp_str(ts)) + + # Reconcile and flush versions 1-3 to the history store. + self.session.checkpoint() + + # Remove the key with timestamp 10. + for i in range(1, 10000): + if i % 2 == 0: + self.session.begin_transaction() + cursor.set_key(str(i)) + cursor.remove() + self.session.commit_transaction('commit_timestamp=' + timestamp_str(10)) + + # Reconcile and remove the obsolete entries. + self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10)) + self.session.checkpoint() + + # Now apply an update at timestamp 20. + for i in range(1, 10000): + self.session.begin_transaction() + cursor[str(i)] = value2 + self.session.commit_transaction('commit_timestamp=' + timestamp_str(20)) + + # Ensure that we didn't select old history store content even if it is not blew away. + self.session.begin_transaction('read_timestamp=' + timestamp_str(10)) + for i in range(1, 10000): + if i % 2 == 0: + cursor.set_key(str(i)) + self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND) + else: + self.assertEqual(cursor[str(i)], value1) + self.session.rollback_transaction() + + hs_truncate = self.get_stat(stat.conn.cache_hs_key_truncate_onpage_removal) + self.assertEqual(hs_truncate, 0) |