summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Jin Kang Park <yujin.kang@mongodb.com>2022-03-16 11:09:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-19 17:20:38 +0000
commit250e543f214ee5c327a5b569f04f9f76278a3f82 (patch)
treec127708a06a68b6506531fdd998c4f5b1d911465
parent16bb3ad6ffb24791d83a82c8794fbf423e4c104c (diff)
downloadmongo-250e543f214ee5c327a5b569f04f9f76278a3f82.tar.gz
SERVER-63387 Reverse return order of backup cursors in StreamingCursor
-rw-r--r--src/mongo/db/storage/backup_cursor_state.h6
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp10
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.h2
-rw-r--r--src/mongo/db/storage/kv/kv_engine.h2
-rw-r--r--src/mongo/db/storage/storage_engine.h4
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp3
-rw-r--r--src/mongo/db/storage/storage_engine_impl.h2
-rw-r--r--src/mongo/db/storage/storage_engine_mock.h2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp14
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h2
10 files changed, 23 insertions, 24 deletions
diff --git a/src/mongo/db/storage/backup_cursor_state.h b/src/mongo/db/storage/backup_cursor_state.h
index 317dd3ff05f..2d8083eab11 100644
--- a/src/mongo/db/storage/backup_cursor_state.h
+++ b/src/mongo/db/storage/backup_cursor_state.h
@@ -30,8 +30,8 @@
#pragma once
#include <boost/optional.hpp>
+#include <deque>
#include <string>
-#include <vector>
#include "mongo/db/exec/document_value/document.h"
#include "mongo/db/storage/storage_engine.h"
@@ -44,11 +44,11 @@ struct BackupCursorState {
std::unique_ptr<StorageEngine::StreamingCursor> streamingCursor;
// 'otherBackupBlocks' includes the backup blocks for the encrypted storage engine in the
// enterprise module.
- std::vector<StorageEngine::BackupBlock> otherBackupBlocks;
+ std::deque<StorageEngine::BackupBlock> otherBackupBlocks;
};
struct BackupCursorExtendState {
- std::vector<std::string> filenames;
+ std::deque<std::string> filenames;
};
} // namespace mongo
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index 413dee06859..dc87e97a661 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -273,9 +273,9 @@ public:
return BSONObj();
}
- StatusWith<std::vector<StorageEngine::BackupBlock>> getNextBatch(const std::size_t batchSize) {
+ StatusWith<std::deque<StorageEngine::BackupBlock>> getNextBatch(const std::size_t batchSize) {
if (_exhaustCursor) {
- std::vector<StorageEngine::BackupBlock> emptyVector;
+ std::deque<StorageEngine::BackupBlock> emptyVector;
return emptyVector;
}
_exhaustCursor = true;
@@ -283,7 +283,7 @@ public:
}
private:
- std::vector<StorageEngine::BackupBlock> _backupBlocks;
+ std::deque<StorageEngine::BackupBlock> _backupBlocks;
bool _exhaustCursor;
};
@@ -294,8 +294,8 @@ StatusWith<std::unique_ptr<StorageEngine::StreamingCursor>> DevNullKVEngine::beg
return std::make_unique<StreamingCursorImpl>(options);
}
-StatusWith<std::vector<std::string>> DevNullKVEngine::extendBackupCursor(OperationContext* opCtx) {
- std::vector<std::string> filesToCopy = {"journal/WiredTigerLog.999"};
+StatusWith<std::deque<std::string>> DevNullKVEngine::extendBackupCursor(OperationContext* opCtx) {
+ std::deque<std::string> filesToCopy = {"journal/WiredTigerLog.999"};
return filesToCopy;
}
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h
index 97e414852ea..39d990097f4 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.h
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h
@@ -143,7 +143,7 @@ public:
virtual void endNonBlockingBackup(OperationContext* opCtx) override {}
- virtual StatusWith<std::vector<std::string>> extendBackupCursor(
+ virtual StatusWith<std::deque<std::string>> extendBackupCursor(
OperationContext* opCtx) override;
virtual boost::optional<Timestamp> getLastStableRecoveryTimestamp() const override {
diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h
index 07a8887f884..89faafe5fd0 100644
--- a/src/mongo/db/storage/kv/kv_engine.h
+++ b/src/mongo/db/storage/kv/kv_engine.h
@@ -208,7 +208,7 @@ public:
MONGO_UNREACHABLE;
}
- virtual StatusWith<std::vector<std::string>> extendBackupCursor(OperationContext* opCtx) {
+ virtual StatusWith<std::deque<std::string>> extendBackupCursor(OperationContext* opCtx) {
return Status(ErrorCodes::CommandNotSupported,
"The current storage engine doesn't support backup mode");
}
diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h
index aed7c3978d4..4d4fb703539 100644
--- a/src/mongo/db/storage/storage_engine.h
+++ b/src/mongo/db/storage/storage_engine.h
@@ -349,7 +349,7 @@ public:
virtual ~StreamingCursor() = default;
- virtual StatusWith<std::vector<BackupBlock>> getNextBatch(const std::size_t batchSize) = 0;
+ virtual StatusWith<std::deque<BackupBlock>> getNextBatch(const std::size_t batchSize) = 0;
protected:
BackupOptions options;
@@ -360,7 +360,7 @@ public:
virtual void endNonBlockingBackup(OperationContext* opCtx) = 0;
- virtual StatusWith<std::vector<std::string>> extendBackupCursor(OperationContext* opCtx) = 0;
+ virtual StatusWith<std::deque<std::string>> extendBackupCursor(OperationContext* opCtx) = 0;
/**
* Recover as much data as possible from a potentially corrupt RecordStore.
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index 6af5185e793..6f4d99c6dfc 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -878,8 +878,7 @@ void StorageEngineImpl::endNonBlockingBackup(OperationContext* opCtx) {
return _engine->endNonBlockingBackup(opCtx);
}
-StatusWith<std::vector<std::string>> StorageEngineImpl::extendBackupCursor(
- OperationContext* opCtx) {
+StatusWith<std::deque<std::string>> StorageEngineImpl::extendBackupCursor(OperationContext* opCtx) {
return _engine->extendBackupCursor(opCtx);
}
diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h
index 119de49c4bf..5731d3c934d 100644
--- a/src/mongo/db/storage/storage_engine_impl.h
+++ b/src/mongo/db/storage/storage_engine_impl.h
@@ -98,7 +98,7 @@ public:
virtual void endNonBlockingBackup(OperationContext* opCtx) override;
- virtual StatusWith<std::vector<std::string>> extendBackupCursor(
+ virtual StatusWith<std::deque<std::string>> extendBackupCursor(
OperationContext* opCtx) override;
virtual bool isDurable() const override;
diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h
index 3d69c854a5b..cdeb564a004 100644
--- a/src/mongo/db/storage/storage_engine_mock.h
+++ b/src/mongo/db/storage/storage_engine_mock.h
@@ -78,7 +78,7 @@ public:
"The current storage engine doesn't support backup mode");
}
void endNonBlockingBackup(OperationContext* opCtx) final {}
- StatusWith<std::vector<std::string>> extendBackupCursor(OperationContext* opCtx) final {
+ StatusWith<std::deque<std::string>> extendBackupCursor(OperationContext* opCtx) final {
return Status(ErrorCodes::CommandNotSupported,
"The current storage engine doesn't support backup mode");
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index e0dc11b2bf1..63e679ac7ec 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1013,9 +1013,9 @@ const boost::filesystem::path constructFilePath(std::string path, std::string fi
return filePath;
}
-std::vector<std::string> getUniqueFiles(const std::vector<std::string>& files,
- const std::set<std::string>& referenceFiles) {
- std::vector<std::string> result;
+std::deque<std::string> getUniqueFiles(const std::vector<std::string>& files,
+ const std::set<std::string>& referenceFiles) {
+ std::deque<std::string> result;
for (auto& file : files) {
if (referenceFiles.find(file) == referenceFiles.end()) {
result.push_back(file);
@@ -1038,9 +1038,9 @@ public:
~StreamingCursorImpl() = default;
- StatusWith<std::vector<StorageEngine::BackupBlock>> getNextBatch(const std::size_t batchSize) {
+ StatusWith<std::deque<StorageEngine::BackupBlock>> getNextBatch(const std::size_t batchSize) {
int wtRet;
- std::vector<StorageEngine::BackupBlock> backupBlocks;
+ std::deque<StorageEngine::BackupBlock> backupBlocks;
stdx::lock_guard<Latch> backupCursorLk(_wtBackup->wtBackupCursorMutex);
while (backupBlocks.size() < batchSize) {
@@ -1113,7 +1113,7 @@ private:
boost::filesystem::path filePath,
const std::uint64_t fileSize,
const std::size_t batchSize,
- std::vector<StorageEngine::BackupBlock>* backupBlocks) {
+ std::deque<StorageEngine::BackupBlock>* backupBlocks) {
// For each file listed, open a duplicate backup cursor and get the blocks to copy.
std::stringstream ss;
ss << "incremental=(file=" << filename << ")";
@@ -1251,7 +1251,7 @@ void WiredTigerKVEngine::endNonBlockingBackup(OperationContext* opCtx) {
_wtBackup.logFilePathsSeenByGetNextBatch = {};
}
-StatusWith<std::vector<std::string>> WiredTigerKVEngine::extendBackupCursor(
+StatusWith<std::deque<std::string>> WiredTigerKVEngine::extendBackupCursor(
OperationContext* opCtx) {
uassert(51033, "Cannot extend backup cursor with in-memory mode.", !isEphemeral());
invariant(_wtBackup.cursor);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index 70c0a217bda..11766b6a80a 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -182,7 +182,7 @@ public:
void endNonBlockingBackup(OperationContext* opCtx) override;
- virtual StatusWith<std::vector<std::string>> extendBackupCursor(
+ virtual StatusWith<std::deque<std::string>> extendBackupCursor(
OperationContext* opCtx) override;
int64_t getIdentSize(OperationContext* opCtx, StringData ident) override;