From e64abfccd2b8ba786083bf1e38d9b70143560b69 Mon Sep 17 00:00:00 2001 From: Luke Chen Date: Tue, 5 Oct 2021 15:12:01 +1100 Subject: Import wiredtiger: 464dc4490f2028b6ac76006c386325e4c67afeb6 from branch mongodb-master ref: 2b1f3d0eec..464dc4490f for: 5.1.0 WT-7980 Create interface to "log:" cursor which switches log files before returning them --- src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/log/log.c | 5 ++--- .../wiredtiger/test/suite/test_backup10.py | 19 ++++--------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 5f48424ce4c..34966c3078a 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "2b1f3d0eec137ceaab33071c1109507c5ebd0b0e" + "commit": "464dc4490f2028b6ac76006c386325e4c67afeb6" } diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c index 6b136c6cc84..0222230a473 100644 --- a/src/third_party/wiredtiger/src/log/log.c +++ b/src/third_party/wiredtiger/src/log/log.c @@ -462,14 +462,13 @@ __wt_log_get_backup_files( * log file will be removed from the list of files returned. New writes will not be included in * the backup. */ - if (active_only) - F_SET(log, WT_LOG_FORCE_NEWFILE); + F_SET(log, WT_LOG_FORCE_NEWFILE); WT_RET(__wt_log_force_write(session, 1, NULL)); WT_RET(__log_get_files(session, WT_LOG_FILENAME, &files, &count)); for (max = 0, i = 0; i < count;) { WT_ERR(__wt_log_extract_lognum(session, files[i], &id)); - if (active_only && (id < min_file || id > max_file)) { + if ((active_only && id < min_file) || id > max_file) { /* * Any files not being returned are individually freed and the array adjusted. */ diff --git a/src/third_party/wiredtiger/test/suite/test_backup10.py b/src/third_party/wiredtiger/test/suite/test_backup10.py index 36593c205e2..988b8467e87 100644 --- a/src/third_party/wiredtiger/test/suite/test_backup10.py +++ b/src/third_party/wiredtiger/test/suite/test_backup10.py @@ -56,6 +56,7 @@ class test_backup10(backup_base): def test_backup10(self): log2 = "WiredTigerLog.0000000002" log3 = "WiredTigerLog.0000000003" + log4 = "WiredTigerLog.0000000004" self.session.create(self.uri, "key_format=S,value_format=S") @@ -84,7 +85,8 @@ class test_backup10(backup_base): # We expect that the duplicate logs are a superset of the # original logs. And we expect the difference to be the - # addition of log file 3 only. + # addition of two log files, one switch when opening the backup + # cursor and a switch when opening the duplicate cursor. orig_set = set(orig_logs) dup_set = set(dup_logs) self.assertTrue(dup_set.issuperset(orig_set)) @@ -92,6 +94,7 @@ class test_backup10(backup_base): self.assertEqual(len(diff), 1) self.assertTrue(log3 in dup_set) self.assertFalse(log3 in orig_set) + self.assertFalse(log4 in dup_set) # Test a few error cases now. # - We cannot make multiple duplcate backup cursors. @@ -114,20 +117,6 @@ class test_backup10(backup_base): lambda:self.assertEquals(self.session.open_cursor(None, bkup_c, None), 0), msg) - # Open duplicate backup cursor again now that the first - # one is closed. Test every log file returned is the same - # as the first time. - dupc = self.session.open_cursor(None, bkup_c, config) - while True: - ret = dupc.next() - if ret != 0: - break - newfile = dupc.get_key() - self.assertTrue("WiredTigerLog" in newfile) - self.assertTrue(newfile in dup_logs) - self.assertEqual(ret, wiredtiger.WT_NOTFOUND) - - dupc.close() bkup_c.close() # After the full backup, open and recover the backup database. -- cgit v1.2.1