diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-07-24 10:42:48 -0400 |
---|---|---|
committer | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-07-24 10:42:48 -0400 |
commit | 68be3d2abf4df873bd1355f7bfd6e086a6d0b173 (patch) | |
tree | 68273db10b3985f3348555fd5e2a9eaf1f6b44ac /src/mongo/db/commands/fsync.cpp | |
parent | fbd991a76e141a2744b18f3f9954f345136bba6b (diff) | |
download | mongo-68be3d2abf4df873bd1355f7bfd6e086a6d0b173.tar.gz |
SERVER-36200: Add backup cursor service foundation. Have fsync command use it.
Diffstat (limited to 'src/mongo/db/commands/fsync.cpp')
-rw-r--r-- | src/mongo/db/commands/fsync.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 0187003684e..e60df34de9a 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -48,6 +48,7 @@ #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/db.h" #include "mongo/db/service_context.h" +#include "mongo/db/storage/backup_cursor_service.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/stdx/condition_variable.h" #include "mongo/util/assert_util.h" @@ -343,9 +344,11 @@ void FSyncLockThread::run() { fsyncCmd.acquireFsyncLockSyncCV.notify_one(); return; } + + auto backupCursorService = BackupCursorService::get(opCtx.getServiceContext()); try { - writeConflictRetry(&opCtx, "beginBackup", "global", [&storageEngine, &opCtx] { - uassertStatusOK(storageEngine->beginBackup(&opCtx)); + writeConflictRetry(&opCtx, "beginBackup", "global", [&opCtx, backupCursorService] { + backupCursorService->fsyncLock(&opCtx); }); } catch (const DBException& e) { error() << "storage engine unable to begin backup : " << e.toString(); @@ -361,7 +364,7 @@ void FSyncLockThread::run() { fsyncCmd.releaseFsyncLockSyncCV.wait(lk); } - storageEngine->endBackup(&opCtx); + backupCursorService->fsyncUnlock(&opCtx); } catch (const std::exception& e) { severe() << "FSyncLockThread exception: " << e.what(); |