summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-02-10 22:28:50 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-25 22:26:41 +0000
commitbcd8085cb84a03ccf819d547e323ab4701705bf6 (patch)
tree7f8730d08c4934ecd9d2d19e86f8c952f8cd0911
parent6d2375017e9ba507b577baa93be3b4bf767e1f18 (diff)
downloadmongo-bcd8085cb84a03ccf819d547e323ab4701705bf6.tar.gz
SERVER-45821 Re-enable disabled incremental backup cursor tests and add additional tests
(cherry picked from commit 436b0e57a57f8f5ae23d2a58c25ac488d5a8cef3)
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 1c0d17877a6..d3b509fba3f 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -516,6 +516,7 @@ StatusWith<StorageEngine::BackupInformation> getBackupInformationFromBackupCurso
WT_SESSION* session,
WT_CURSOR* cursor,
bool incrementalBackup,
+ bool fullBackup,
std::string dbPath,
const char* statusPrefix) {
int wtRet;
@@ -529,14 +530,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);
@@ -548,13 +546,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);
@@ -1145,8 +1145,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;
@@ -1182,8 +1187,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) {