summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2019-06-27 16:02:28 -0400
committerRandolph Tan <randolph@10gen.com>2019-07-16 13:44:09 -0400
commit2dfbaadb85f32869c75f87117d9f6e98b4e948ea (patch)
tree131ffaee362373775aadef9105db99337c5d7fa6 /src/mongo/db/db.cpp
parentdb2cfda750494cf1c2d0a235df945e335075b8e2 (diff)
downloadmongo-2dfbaadb85f32869c75f87117d9f6e98b4e948ea.tar.gz
SERVER-40785 Create WaitForMajorityService to allow waiting for write concern asynchronously
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 652355ee908..37082607dba 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -123,6 +123,7 @@
#include "mongo/db/s/shard_server_op_observer.h"
#include "mongo/db/s/sharding_initialization_mongod.h"
#include "mongo/db/s/sharding_state_recovery.h"
+#include "mongo/db/s/wait_for_majority_service.h"
#include "mongo/db/server_options.h"
#include "mongo/db/service_context.h"
#include "mongo/db/service_entry_point_mongod.h"
@@ -505,6 +506,8 @@ ExitCode _initAndListen(int listenPort) {
<< startupWarningsLog;
}
+ WaitForMajorityService::get(serviceContext).setUp(serviceContext);
+
// This function may take the global lock.
auto shardingInitialized = ShardingInitializationMongoD::get(startupOpCtx.get())
->initializeShardingAwarenessIfNeeded(startupOpCtx.get());
@@ -904,6 +907,8 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) {
}
}
+ WaitForMajorityService::get(serviceContext).shutDown();
+
// Terminate the balancer thread so it doesn't leak memory.
if (auto balancer = Balancer::get(serviceContext)) {
balancer->interruptBalancer();