diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-02-10 22:28:50 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-12 16:08:53 +0000 |
commit | 436b0e57a57f8f5ae23d2a58c25ac488d5a8cef3 (patch) | |
tree | 2ea2fcc11ee671b88e83c5f2e3a5b29264b82836 | |
parent | 20f37580bdf89817db398c477d619627ce1feef7 (diff) | |
download | mongo-436b0e57a57f8f5ae23d2a58c25ac488d5a8cef3.tar.gz |
SERVER-45821 Re-enable disabled incremental backup cursor tests and add additional tests
-rw-r--r-- | buildscripts/resmokeconfig/suites/no_passthrough.yml | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 27 |
2 files changed, 18 insertions, 12 deletions
diff --git a/buildscripts/resmokeconfig/suites/no_passthrough.yml b/buildscripts/resmokeconfig/suites/no_passthrough.yml index 37e64623dbf..453ba6d861b 100644 --- a/buildscripts/resmokeconfig/suites/no_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/no_passthrough.yml @@ -10,9 +10,6 @@ selector: exclude_files: # Disable inmem_full as per SERVER-27014 - jstests/noPassthrough/inmem_full.js - # TODO(SERVER-45821): enable backup_cursor_format.js and incremental_backup_cursor.js - - src/mongo/db/modules/*/jstests/hot_backups/backup_cursor_format.js - - src/mongo/db/modules/*/jstests/hot_backups/incremental_backup_cursor.js # noPassthrough tests start their own mongod's. executor: diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index ad60e26840c..d71063e6569 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -677,6 +677,7 @@ StatusWith<StorageEngine::BackupInformation> getBackupInformationFromBackupCurso WT_SESSION* session, WT_CURSOR* cursor, bool incrementalBackup, + bool fullBackup, std::string dbPath, const char* statusPrefix) { int wtRet; @@ -690,14 +691,11 @@ StatusWith<StorageEngine::BackupInformation> getBackupInformationFromBackupCurso std::string name(filename); boost::filesystem::path filePath = directoryPath; - boost::filesystem::path relativePath; if (name.find(wiredTigerLogFilePrefix) == 0) { // TODO SERVER-13455:replace `journal/` with the configurable journal path. filePath /= boost::filesystem::path("journal"); - relativePath /= boost::filesystem::path("journal"); } filePath /= name; - relativePath /= name; boost::system::error_code errorCode; const std::uint64_t fileSize = boost::filesystem::file_size(filePath, errorCode); @@ -709,13 +707,15 @@ StatusWith<StorageEngine::BackupInformation> getBackupInformationFromBackupCurso StorageEngine::BackupFile backupFile(fileSize); backupInformation.insert({filePath.string(), backupFile}); - if (!incrementalBackup) { + // Full backups cannot open an incremental cursor, even if they are the first full backup + // for incremental. + if (!incrementalBackup || fullBackup) { continue; } // For each file listed, open a duplicate backup cursor and get the blocks to copy. std::stringstream ss; - ss << "incremental=(file=\"" << str::escape(relativePath.string()) << "\")"; + ss << "incremental=(file=" << filename << ")"; const std::string config = ss.str(); WT_CURSOR* dupCursor; wtRet = session->open_cursor(session, nullptr, cursor, config.c_str(), &dupCursor); @@ -1322,8 +1322,13 @@ StatusWith<StorageEngine::BackupInformation> WiredTigerKVEngine::beginNonBlockin return wtRCToStatus(wtRet); } - auto swBackupInfo = getBackupInformationFromBackupCursor( - session, cursor, options.incrementalBackup, _path, "Error opening backup cursor."); + const bool fullBackup = !options.srcBackupName; + auto swBackupInfo = getBackupInformationFromBackupCursor(session, + cursor, + options.incrementalBackup, + fullBackup, + _path, + "Error opening backup cursor."); if (!swBackupInfo.isOK()) { return swBackupInfo; @@ -1359,8 +1364,12 @@ StatusWith<std::vector<std::string>> WiredTigerKVEngine::extendBackupCursor( } StatusWith<StorageEngine::BackupInformation> swBackupInfo = - getBackupInformationFromBackupCursor( - session, cursor, /*incrementalBackup=*/false, _path, "Error extending backup cursor."); + getBackupInformationFromBackupCursor(session, + cursor, + /*incrementalBackup=*/false, + /*fullBackup=*/true, + _path, + "Error extending backup cursor."); wtRet = cursor->close(cursor); if (wtRet != 0) { |