diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-10-22 09:48:49 -0400 |
---|---|---|
committer | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-10-22 09:48:49 -0400 |
commit | 34f2b79e954c0ec26e76b686e3394c180f5232e6 (patch) | |
tree | 9b3362c7d4f5ee86a61432b7a977f841e805a577 /src | |
parent | 9f363b489585124afa1e26412e19f6728763e1ad (diff) | |
download | mongo-34f2b79e954c0ec26e76b686e3394c180f5232e6.tar.gz |
SERVER-37662: Add backupCursor state to serverStatus.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/storage/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/storage/backup_cursor_hooks.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/backup_cursor_hooks.h | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_init.cpp | 10 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript index 366a429e58d..ee0692c8e3c 100644 --- a/src/mongo/db/storage/SConscript +++ b/src/mongo/db/storage/SConscript @@ -228,6 +228,7 @@ env.Library( ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/db/commands/server_status', + 'backup_cursor_hooks' ] ) diff --git a/src/mongo/db/storage/backup_cursor_hooks.cpp b/src/mongo/db/storage/backup_cursor_hooks.cpp index d4c4a863fb2..1cd88ed1552 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.cpp +++ b/src/mongo/db/storage/backup_cursor_hooks.cpp @@ -84,4 +84,8 @@ BackupCursorState BackupCursorHooks::openBackupCursor(OperationContext* opCtx) { void BackupCursorHooks::closeBackupCursor(OperationContext* opCtx, std::uint64_t cursorId) { MONGO_UNREACHABLE; } + +bool BackupCursorHooks::isBackupCursorOpen() const { + return false; +} } // namespace mongo diff --git a/src/mongo/db/storage/backup_cursor_hooks.h b/src/mongo/db/storage/backup_cursor_hooks.h index 7344e5d391e..5bf079e2e82 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.h +++ b/src/mongo/db/storage/backup_cursor_hooks.h @@ -64,6 +64,8 @@ public: virtual BackupCursorState openBackupCursor(OperationContext* opCtx); virtual void closeBackupCursor(OperationContext* opCtx, std::uint64_t cursorId); + + virtual bool isBackupCursorOpen() const; }; } // namespace mongo diff --git a/src/mongo/db/storage/storage_init.cpp b/src/mongo/db/storage/storage_init.cpp index 782965e206c..2b43868557b 100644 --- a/src/mongo/db/storage/storage_init.cpp +++ b/src/mongo/db/storage/storage_init.cpp @@ -34,6 +34,7 @@ #include "mongo/db/commands/server_status.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" +#include "mongo/db/storage/backup_cursor_hooks.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/db/storage/storage_options.h" @@ -54,7 +55,10 @@ public: virtual BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const { - auto engine = opCtx->getClient()->getServiceContext()->getStorageEngine(); + auto svcCtx = opCtx->getClient()->getServiceContext(); + auto engine = svcCtx->getStorageEngine(); + auto backupCursorHooks = BackupCursorHooks::get(svcCtx); + return BSON("name" << storageGlobalParams.engine << "supportsCommittedReads" << engine->supportsReadConcernMajority() << "supportsSnapshotReadConcern" @@ -62,7 +66,9 @@ public: << "readOnly" << storageGlobalParams.readOnly << "persistent" - << !engine->isEphemeral()); + << !engine->isEphemeral() + << "backupCursorOpen" + << backupCursorHooks->isBackupCursorOpen()); } } storageSSS; |