summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/devnull
diff options
context:
space:
mode:
authorali-mir <ali.mir@mongodb.com>2021-08-25 14:34:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-30 14:16:21 +0000
commit07f6321133c4db6fcacb99de4da9df31688e7b4d (patch)
tree002a95e88785cad35d96ab0e3c548a729ecebbe2 /src/mongo/db/storage/devnull
parentc68026879e149d796ef3101ff87db05c33e5bdee (diff)
downloadmongo-07f6321133c4db6fcacb99de4da9df31688e7b4d.tar.gz
SERVER-57810 Enable setting mock filenames for devnull KVEngine backup cursor
Diffstat (limited to 'src/mongo/db/storage/devnull')
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp8
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.h7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index f56087b7a95..144b289e27e 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -261,9 +261,9 @@ namespace {
class StreamingCursorImpl : public StorageEngine::StreamingCursor {
public:
StreamingCursorImpl() = delete;
- StreamingCursorImpl(StorageEngine::BackupOptions options)
- : StorageEngine::StreamingCursor(options) {
- _backupBlocks = {{"filename.wt"}};
+ StreamingCursorImpl(StorageEngine::BackupOptions options,
+ std::vector<StorageEngine::BackupBlock> backupBlocks)
+ : StorageEngine::StreamingCursor(options), _backupBlocks(std::move(backupBlocks)) {
_exhaustCursor = false;
};
@@ -291,7 +291,7 @@ private:
StatusWith<std::unique_ptr<StorageEngine::StreamingCursor>> DevNullKVEngine::beginNonBlockingBackup(
OperationContext* opCtx, const StorageEngine::BackupOptions& options) {
- return std::make_unique<StreamingCursorImpl>(options);
+ return std::make_unique<StreamingCursorImpl>(options, _mockBackupBlocks);
}
StatusWith<std::vector<std::string>> DevNullKVEngine::extendBackupCursor(OperationContext* opCtx) {
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h
index 97e414852ea..e3f3f2ae3f3 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.h
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h
@@ -160,9 +160,16 @@ public:
virtual void setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp) {}
+ // This sets the results of the backup cursor for unit tests.
+ void setBackupBlocks_forTest(std::vector<StorageEngine::BackupBlock> newBackupBlocks) {
+ _mockBackupBlocks = newBackupBlocks;
+ }
+
private:
std::shared_ptr<void> _catalogInfo;
int _cachePressureForTest;
+
+ std::vector<StorageEngine::BackupBlock> _mockBackupBlocks = {{"filename.wt"}};
};
} // namespace mongo