summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/catalog_control_test.cpp5
-rw-r--r--src/mongo/db/pipeline/mongo_process_interface.h2
-rw-r--r--src/mongo/db/pipeline/mongos_process_interface.h2
-rw-r--r--src/mongo/db/pipeline/process_interface_standalone.cpp4
-rw-r--r--src/mongo/db/pipeline/process_interface_standalone.h3
-rw-r--r--src/mongo/db/pipeline/stub_mongo_process_interface.h2
-rw-r--r--src/mongo/db/storage/backup_cursor_hooks.cpp2
-rw-r--r--src/mongo/db/storage/backup_cursor_hooks.h9
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp5
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.h5
-rw-r--r--src/mongo/db/storage/kv/kv_engine.h5
-rw-r--r--src/mongo/db/storage/storage_engine.h16
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp7
-rw-r--r--src/mongo/db/storage/storage_engine_impl.h5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp16
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h5
16 files changed, 36 insertions, 57 deletions
diff --git a/src/mongo/db/catalog/catalog_control_test.cpp b/src/mongo/db/catalog/catalog_control_test.cpp
index b7f64904e2a..7b85e350cfa 100644
--- a/src/mongo/db/catalog/catalog_control_test.cpp
+++ b/src/mongo/db/catalog/catalog_control_test.cpp
@@ -91,10 +91,7 @@ public:
"The current storage engine doesn't support backup mode");
}
StatusWith<std::vector<StorageEngine::BackupBlock>> beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) final {
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) final {
return Status(ErrorCodes::CommandNotSupported,
"The current storage engine doesn't support backup mode");
}
diff --git a/src/mongo/db/pipeline/mongo_process_interface.h b/src/mongo/db/pipeline/mongo_process_interface.h
index 303f3d0d757..89f576a5302 100644
--- a/src/mongo/db/pipeline/mongo_process_interface.h
+++ b/src/mongo/db/pipeline/mongo_process_interface.h
@@ -371,7 +371,7 @@ public:
* The following methods forward to the BackupCursorHooks decorating the ServiceContext.
*/
virtual BackupCursorState openBackupCursor(OperationContext* opCtx,
- const BackupOptions& options) = 0;
+ const StorageEngine::BackupOptions& options) = 0;
virtual void closeBackupCursor(OperationContext* opCtx, const UUID& backupId) = 0;
diff --git a/src/mongo/db/pipeline/mongos_process_interface.h b/src/mongo/db/pipeline/mongos_process_interface.h
index e347129f669..5c70c5a8597 100644
--- a/src/mongo/db/pipeline/mongos_process_interface.h
+++ b/src/mongo/db/pipeline/mongos_process_interface.h
@@ -185,7 +185,7 @@ public:
* a mongos.
*/
BackupCursorState openBackupCursor(OperationContext* opCtx,
- const BackupOptions& options) final {
+ const StorageEngine::BackupOptions& options) final {
MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/pipeline/process_interface_standalone.cpp b/src/mongo/db/pipeline/process_interface_standalone.cpp
index 0e5b4475bd7..2747891006b 100644
--- a/src/mongo/db/pipeline/process_interface_standalone.cpp
+++ b/src/mongo/db/pipeline/process_interface_standalone.cpp
@@ -571,8 +571,8 @@ boost::optional<Document> MongoInterfaceStandalone::lookupSingleDocument(
return lookedUpDocument;
}
-BackupCursorState MongoInterfaceStandalone::openBackupCursor(OperationContext* opCtx,
- const BackupOptions& options) {
+BackupCursorState MongoInterfaceStandalone::openBackupCursor(
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) {
auto backupCursorHooks = BackupCursorHooks::get(opCtx->getServiceContext());
if (backupCursorHooks->enabled()) {
return backupCursorHooks->openBackupCursor(opCtx, options);
diff --git a/src/mongo/db/pipeline/process_interface_standalone.h b/src/mongo/db/pipeline/process_interface_standalone.h
index 640d4a6c955..b221bffb40b 100644
--- a/src/mongo/db/pipeline/process_interface_standalone.h
+++ b/src/mongo/db/pipeline/process_interface_standalone.h
@@ -138,7 +138,8 @@ public:
bool allowSpeculativeMajorityRead = false) final;
std::vector<GenericCursor> getIdleCursors(const boost::intrusive_ptr<ExpressionContext>& expCtx,
CurrentOpUserMode userMode) const final;
- BackupCursorState openBackupCursor(OperationContext* opCtx, const BackupOptions& options) final;
+ BackupCursorState openBackupCursor(OperationContext* opCtx,
+ const StorageEngine::BackupOptions& options) final;
void closeBackupCursor(OperationContext* opCtx, const UUID& backupId) final;
BackupCursorExtendState extendBackupCursor(OperationContext* opCtx,
const UUID& backupId,
diff --git a/src/mongo/db/pipeline/stub_mongo_process_interface.h b/src/mongo/db/pipeline/stub_mongo_process_interface.h
index 2f6f83a2a79..bc6cc71f08f 100644
--- a/src/mongo/db/pipeline/stub_mongo_process_interface.h
+++ b/src/mongo/db/pipeline/stub_mongo_process_interface.h
@@ -206,7 +206,7 @@ public:
}
BackupCursorState openBackupCursor(OperationContext* opCtx,
- const BackupOptions& options) final {
+ const StorageEngine::BackupOptions& options) final {
return BackupCursorState{UUID::gen(), boost::none, {}};
}
diff --git a/src/mongo/db/storage/backup_cursor_hooks.cpp b/src/mongo/db/storage/backup_cursor_hooks.cpp
index 977fe245591..8a965ddb40b 100644
--- a/src/mongo/db/storage/backup_cursor_hooks.cpp
+++ b/src/mongo/db/storage/backup_cursor_hooks.cpp
@@ -78,7 +78,7 @@ void BackupCursorHooks::fsyncUnlock(OperationContext* opCtx) {
}
BackupCursorState BackupCursorHooks::openBackupCursor(OperationContext* opCtx,
- const BackupOptions& options) {
+ const StorageEngine::BackupOptions& options) {
MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/storage/backup_cursor_hooks.h b/src/mongo/db/storage/backup_cursor_hooks.h
index ef40a9a23b9..6852d544f25 100644
--- a/src/mongo/db/storage/backup_cursor_hooks.h
+++ b/src/mongo/db/storage/backup_cursor_hooks.h
@@ -39,13 +39,6 @@ class OperationContext;
class ServiceContext;
class StorageEngine;
-struct BackupOptions {
- bool disableIncrementalBackup = false;
- bool incrementalBackup = false;
- boost::optional<std::string> thisBackupName;
- boost::optional<std::string> srcBackupName;
-};
-
class BackupCursorHooks {
public:
using InitializerFunction = std::function<std::unique_ptr<BackupCursorHooks>(StorageEngine*)>;
@@ -69,7 +62,7 @@ public:
virtual void fsyncUnlock(OperationContext* opCtx);
virtual BackupCursorState openBackupCursor(OperationContext* opCtx,
- const BackupOptions& options);
+ const StorageEngine::BackupOptions& options);
virtual void closeBackupCursor(OperationContext* opCtx, const UUID& backupId);
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index 0447c984286..f1982f314d8 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -254,10 +254,7 @@ void DevNullKVEngine::setCachePressureForTest(int pressure) {
}
StatusWith<std::vector<StorageEngine::BackupBlock>> DevNullKVEngine::beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) {
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) {
std::vector<StorageEngine::BackupBlock> blocksToCopy = {{"filename.wt", 0, 0}};
return blocksToCopy;
}
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h
index 815d9089912..67989a4774f 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.h
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h
@@ -140,10 +140,7 @@ public:
virtual void endBackup(OperationContext* opCtx) {}
virtual StatusWith<std::vector<StorageEngine::BackupBlock>> beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) override;
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) override;
virtual void endNonBlockingBackup(OperationContext* opCtx) override {}
diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h
index 38e84329b0f..337a40d13b9 100644
--- a/src/mongo/db/storage/kv/kv_engine.h
+++ b/src/mongo/db/storage/kv/kv_engine.h
@@ -238,10 +238,7 @@ public:
}
virtual StatusWith<std::vector<StorageEngine::BackupBlock>> beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) {
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) {
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 7d1776ec823..5f609793bfa 100644
--- a/src/mongo/db/storage/storage_engine.h
+++ b/src/mongo/db/storage/storage_engine.h
@@ -69,6 +69,14 @@ public:
using OldestActiveTransactionTimestampCallback =
std::function<OldestActiveTransactionTimestampResult(Timestamp stableTimestamp)>;
+ struct BackupOptions {
+ bool disableIncrementalBackup = false;
+ bool incrementalBackup = false;
+ int blockSizeMB = 16;
+ boost::optional<std::string> thisBackupName;
+ boost::optional<std::string> srcBackupName;
+ };
+
struct BackupBlock {
std::string filename;
std::uint64_t offset;
@@ -314,6 +322,9 @@ public:
* storage engine will take a backup called 'thisBackupName' which will contain the changes made
* to data files since the backup named 'srcBackupName'.
*
+ * The storage engine must use an upper bound limit of 'blockSizeMB' when returning changed
+ * file blocks.
+ *
* The first full backup meant for incremental and future incremental backups must pass
* 'incrementalBackup' as true.
* 'thisBackupName' must exist only if 'incrementalBackup' is true.
@@ -321,10 +332,7 @@ public:
* when 'incrementalBackup' is true.
*/
virtual StatusWith<std::vector<BackupBlock>> beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) = 0;
+ OperationContext* opCtx, const BackupOptions& options) = 0;
virtual void endNonBlockingBackup(OperationContext* opCtx) = 0;
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index c4eac0402bf..dbe69146dd3 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -671,11 +671,8 @@ Status StorageEngineImpl::disableIncrementalBackup(OperationContext* opCtx) {
}
StatusWith<std::vector<StorageEngine::BackupBlock>> StorageEngineImpl::beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) {
- return _engine->beginNonBlockingBackup(opCtx, incrementalBackup, thisBackupName, srcBackupName);
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) {
+ return _engine->beginNonBlockingBackup(opCtx, options);
}
void StorageEngineImpl::endNonBlockingBackup(OperationContext* opCtx) {
diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h
index c26563895e9..44c08054f1d 100644
--- a/src/mongo/db/storage/storage_engine_impl.h
+++ b/src/mongo/db/storage/storage_engine_impl.h
@@ -100,10 +100,7 @@ public:
virtual Status disableIncrementalBackup(OperationContext* opCtx) override;
virtual StatusWith<std::vector<BackupBlock>> beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) override;
+ OperationContext* opCtx, const BackupOptions& options) override;
virtual void endNonBlockingBackup(OperationContext* opCtx) override;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 1ea4ae68caa..4d01620b268 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1158,20 +1158,18 @@ Status WiredTigerKVEngine::disableIncrementalBackup(OperationContext* opCtx) {
}
StatusWith<std::vector<StorageEngine::BackupBlock>> WiredTigerKVEngine::beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) {
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) {
uassert(51034, "Cannot open backup cursor with in-memory mode.", !isEphemeral());
std::stringstream ss;
- if (incrementalBackup) {
- invariant(thisBackupName);
+ if (options.incrementalBackup) {
+ invariant(options.thisBackupName);
ss << "incremental=(enabled=true,force_stop=false,";
- ss << "this_id=" << std::quoted(str::escape(*thisBackupName)) << ",";
+ ss << "granularity=" << options.blockSizeMB << "MB,";
+ ss << "this_id=" << std::quoted(str::escape(*options.thisBackupName)) << ",";
- if (srcBackupName) {
- ss << "src_id=" << std::quoted(str::escape(*srcBackupName)) << ",";
+ if (options.srcBackupName) {
+ ss << "src_id=" << std::quoted(str::escape(*options.srcBackupName)) << ",";
}
ss << ")";
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index 8c8c9b355c0..4dccf63f627 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -182,10 +182,7 @@ public:
Status disableIncrementalBackup(OperationContext* opCtx) override;
StatusWith<std::vector<StorageEngine::BackupBlock>> beginNonBlockingBackup(
- OperationContext* opCtx,
- bool incrementalBackup,
- boost::optional<std::string> thisBackupName,
- boost::optional<std::string> srcBackupName) override;
+ OperationContext* opCtx, const StorageEngine::BackupOptions& options) override;
void endNonBlockingBackup(OperationContext* opCtx) override;