summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/commands/SConscript2
-rw-r--r--src/mongo/db/storage/encryption_hooks.cpp21
2 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 1dce82f94de..03dd3919180 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -196,6 +196,7 @@ env.Library(
"geo_near_cmd.cpp",
"getmore_cmd.cpp",
"index_filter_commands.cpp",
+ "kill_op.cpp",
"killcursors_cmd.cpp",
"lock_info.cpp",
"list_collections.cpp",
@@ -266,7 +267,6 @@ env.Library(
"get_last_error.cpp",
"group_cmd.cpp",
"haystack.cpp",
- "kill_op.cpp",
"mr.cpp",
"oplog_application_checks.cpp",
"oplog_note.cpp",
diff --git a/src/mongo/db/storage/encryption_hooks.cpp b/src/mongo/db/storage/encryption_hooks.cpp
index 8a81d20dd2d..bb5c60a29b8 100644
--- a/src/mongo/db/storage/encryption_hooks.cpp
+++ b/src/mongo/db/storage/encryption_hooks.cpp
@@ -41,13 +41,16 @@
namespace mongo {
/* Make a EncryptionHooks pointer a decoration on the global ServiceContext */
-MONGO_INITIALIZER(SetEncryptionHooks)
-(InitializerContext* context) {
- auto encryptionHooks = stdx::make_unique<EncryptionHooks>();
- EncryptionHooks::set(getGlobalServiceContext(), std::move(encryptionHooks));
-
- return Status::OK();
-}
+GlobalInitializerRegisterer encryptionHooksInitializer(
+ "SetEncryptionHooks",
+ [](InitializerContext* context) {
+ EncryptionHooks::set(context->serviceContext(), stdx::make_unique<EncryptionHooks>());
+ return Status::OK();
+ },
+ [](DeinitializerContext* context) {
+ EncryptionHooks::set(context->serviceContext(), nullptr);
+ return Status::OK();
+ });
namespace {
const auto getEncryptionHooks =
@@ -55,9 +58,7 @@ const auto getEncryptionHooks =
} // namespace
void EncryptionHooks::set(ServiceContext* service, std::unique_ptr<EncryptionHooks> custHooks) {
- auto& hooks = getEncryptionHooks(service);
- invariant(custHooks);
- hooks = std::move(custHooks);
+ getEncryptionHooks(service) = std::move(custHooks);
}
EncryptionHooks* EncryptionHooks::get(ServiceContext* service) {