From 4797caa17de8e8c34074b2f0db8a1e1fbd480fae Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Thu, 7 Nov 2019 17:43:48 +0000 Subject: SERVER-44370 Have openBackupCursor accept inputs for incremental backup requests (cherry picked from commit 64d293db1d52a192e3ec34c3a7674f6d342c0c42) --- src/mongo/db/pipeline/mongo_process_interface.h | 5 ++++- src/mongo/db/pipeline/mongos_process_interface.h | 5 ++++- src/mongo/db/pipeline/process_interface_standalone.cpp | 9 +++++++-- src/mongo/db/pipeline/process_interface_standalone.h | 5 ++++- src/mongo/db/pipeline/stub_mongo_process_interface.h | 5 ++++- src/mongo/db/storage/backup_cursor_hooks.cpp | 5 ++++- src/mongo/db/storage/backup_cursor_hooks.h | 5 ++++- 7 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/mongo/db/pipeline/mongo_process_interface.h b/src/mongo/db/pipeline/mongo_process_interface.h index 09656242b5f..1b2a091b79b 100644 --- a/src/mongo/db/pipeline/mongo_process_interface.h +++ b/src/mongo/db/pipeline/mongo_process_interface.h @@ -350,7 +350,10 @@ public: /** * The following methods forward to the BackupCursorHooks decorating the ServiceContext. */ - virtual BackupCursorState openBackupCursor(OperationContext* opCtx) = 0; + virtual BackupCursorState openBackupCursor(OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName) = 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 2f11f6b2030..75f0f2ab1ab 100644 --- a/src/mongo/db/pipeline/mongos_process_interface.h +++ b/src/mongo/db/pipeline/mongos_process_interface.h @@ -190,7 +190,10 @@ public: * The following methods only make sense for data-bearing nodes and should never be called on * a mongos. */ - BackupCursorState openBackupCursor(OperationContext* opCtx) final { + BackupCursorState openBackupCursor(OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName) final { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/pipeline/process_interface_standalone.cpp b/src/mongo/db/pipeline/process_interface_standalone.cpp index 0e2bcf09bed..66671287ce4 100644 --- a/src/mongo/db/pipeline/process_interface_standalone.cpp +++ b/src/mongo/db/pipeline/process_interface_standalone.cpp @@ -496,10 +496,15 @@ boost::optional MongoInterfaceStandalone::lookupSingleDocument( return lookedUpDocument; } -BackupCursorState MongoInterfaceStandalone::openBackupCursor(OperationContext* opCtx) { +BackupCursorState MongoInterfaceStandalone::openBackupCursor( + OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName) { auto backupCursorHooks = BackupCursorHooks::get(opCtx->getServiceContext()); if (backupCursorHooks->enabled()) { - return backupCursorHooks->openBackupCursor(opCtx); + return backupCursorHooks->openBackupCursor( + opCtx, incrementalBackup, thisBackupName, srcBackupName); } else { uasserted(50956, "Backup cursors are an enterprise only feature."); } diff --git a/src/mongo/db/pipeline/process_interface_standalone.h b/src/mongo/db/pipeline/process_interface_standalone.h index 305fa8933ee..dbfb7261f1f 100644 --- a/src/mongo/db/pipeline/process_interface_standalone.h +++ b/src/mongo/db/pipeline/process_interface_standalone.h @@ -125,7 +125,10 @@ public: bool allowSpeculativeMajorityRead = false) final; std::vector getIdleCursors(const boost::intrusive_ptr& expCtx, CurrentOpUserMode userMode) const final; - BackupCursorState openBackupCursor(OperationContext* opCtx) final; + BackupCursorState openBackupCursor(OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName) 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 ec937bc8579..b2bf93560dd 100644 --- a/src/mongo/db/pipeline/stub_mongo_process_interface.h +++ b/src/mongo/db/pipeline/stub_mongo_process_interface.h @@ -182,7 +182,10 @@ public: MONGO_UNREACHABLE; } - BackupCursorState openBackupCursor(OperationContext* opCtx) final { + BackupCursorState openBackupCursor(OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName) 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 f624762a914..0c86bec06f1 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.cpp +++ b/src/mongo/db/storage/backup_cursor_hooks.cpp @@ -77,7 +77,10 @@ void BackupCursorHooks::fsyncUnlock(OperationContext* opCtx) { MONGO_UNREACHABLE; } -BackupCursorState BackupCursorHooks::openBackupCursor(OperationContext* opCtx) { +BackupCursorState BackupCursorHooks::openBackupCursor(OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName) { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/storage/backup_cursor_hooks.h b/src/mongo/db/storage/backup_cursor_hooks.h index 6d4b306a296..c78110a3e90 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.h +++ b/src/mongo/db/storage/backup_cursor_hooks.h @@ -61,7 +61,10 @@ public: virtual void fsyncUnlock(OperationContext* opCtx); - virtual BackupCursorState openBackupCursor(OperationContext* opCtx); + virtual BackupCursorState openBackupCursor(OperationContext* opCtx, + bool incrementalBackup, + boost::optional thisBackupName, + boost::optional srcBackupName); virtual void closeBackupCursor(OperationContext* opCtx, const UUID& backupId); -- cgit v1.2.1