diff options
| author | samantharitter <samantha.ritter@10gen.com> | 2017-06-12 18:01:38 -0400 |
|---|---|---|
| committer | samantharitter <samantha.ritter@10gen.com> | 2017-06-13 10:17:55 -0400 |
| commit | 42aa8d1a2953373b0618129ac5f9e6e355cd17d0 (patch) | |
| tree | b6ff3a8fcd146a766b5586262c2f306841ecdde5 /src/mongo/s/server.cpp | |
| parent | e9e578b937bc3d7bfa15478c59b974a165c615c5 (diff) | |
| download | mongo-42aa8d1a2953373b0618129ac5f9e6e355cd17d0.tar.gz | |
SERVER-29472 Install PeriodicRunnerASIO on mongod and mongos
Diffstat (limited to 'src/mongo/s/server.cpp')
| -rw-r--r-- | src/mongo/s/server.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index e663ea15a26..0e898b1f022 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -101,6 +101,8 @@ #include "mongo/util/net/ssl_manager.h" #include "mongo/util/ntservice.h" #include "mongo/util/options_parser/startup_options.h" +#include "mongo/util/periodic_runner.h" +#include "mongo/util/periodic_runner_factory.h" #include "mongo/util/processinfo.h" #include "mongo/util/quick_exit.h" #include "mongo/util/signal_handlers.h" @@ -145,9 +147,16 @@ static void cleanupTask() { opCtx = uniqueTxn.get(); } - if (serviceContext) + if (serviceContext) { serviceContext->setKillAllOperations(); + // Shut down the background periodic task runner. + auto runner = serviceContext->getPeriodicRunner(); + if (runner) { + runner->shutdown(); + } + } + // Validator shutdown must be called after setKillAllOperations is called. Otherwise, this // can deadlock. if (auto validator = LogicalTimeValidator::get(serviceContext)) { @@ -334,6 +343,11 @@ static ExitCode runMongosServer() { PeriodicTask::startRunningPeriodicTasks(); + // Set up the periodic runner for background job execution + auto runner = makePeriodicRunner(); + runner->startup(); + getGlobalServiceContext()->setPeriodicRunner(std::move(runner)); + auto start = getGlobalServiceContext()->addAndStartTransportLayer(std::move(transportLayer)); if (!start.isOK()) { return EXIT_NET_ERROR; |
