From 5218ed8e510bdc1a6bfc14084f81bcc236b90964 Mon Sep 17 00:00:00 2001 From: Moustafa Maher Khalil Date: Mon, 1 Nov 2021 16:55:39 +0000 Subject: SERVER-61048 Make BackupCursorService use current engine instead of storing a stale one --- src/mongo/db/mongod_main.cpp | 2 +- src/mongo/db/storage/backup_cursor_hooks.cpp | 6 +++--- src/mongo/db/storage/backup_cursor_hooks.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp index 36f6842d691..d8944c895f2 100644 --- a/src/mongo/db/mongod_main.cpp +++ b/src/mongo/db/mongod_main.cpp @@ -517,7 +517,7 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) { invariant(storageEngine); storageEngine->notifyStartupComplete(); - BackupCursorHooks::initialize(serviceContext, storageEngine); + BackupCursorHooks::initialize(serviceContext); startMongoDFTDC(); diff --git a/src/mongo/db/storage/backup_cursor_hooks.cpp b/src/mongo/db/storage/backup_cursor_hooks.cpp index 68fdfd5c3e5..d656d26509a 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.cpp +++ b/src/mongo/db/storage/backup_cursor_hooks.cpp @@ -38,7 +38,7 @@ namespace mongo { namespace { -BackupCursorHooks::InitializerFunction initializer = [](StorageEngine* storageEngine) { +BackupCursorHooks::InitializerFunction initializer = []() { return std::make_unique(); }; @@ -53,8 +53,8 @@ void BackupCursorHooks::registerInitializer(InitializerFunction func) { initializer = func; } -void BackupCursorHooks::initialize(ServiceContext* service, StorageEngine* storageEngine) { - getBackupCursorHooks(service).ptr = initializer(storageEngine); +void BackupCursorHooks::initialize(ServiceContext* service) { + getBackupCursorHooks(service).ptr = initializer(); } BackupCursorHooks* BackupCursorHooks::get(ServiceContext* service) { diff --git a/src/mongo/db/storage/backup_cursor_hooks.h b/src/mongo/db/storage/backup_cursor_hooks.h index e166181aa03..bb7f5b712aa 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.h +++ b/src/mongo/db/storage/backup_cursor_hooks.h @@ -41,11 +41,11 @@ class StorageEngine; class BackupCursorHooks { public: - using InitializerFunction = std::function(StorageEngine*)>; + using InitializerFunction = std::function()>; static void registerInitializer(InitializerFunction func); - static void initialize(ServiceContext* service, StorageEngine* storageEngine); + static void initialize(ServiceContext* service); static BackupCursorHooks* get(ServiceContext* service); -- cgit v1.2.1