diff options
author | Andrew Morrow <acm@mongodb.com> | 2016-04-23 12:15:02 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2016-06-16 17:54:40 -0400 |
commit | dc73a4b9567e1ebdb6ba6c9a41a919a0c7c6adf0 (patch) | |
tree | 88422fbc7bb522c3765ef8d723385098a06f0413 /src/mongo/db/db.cpp | |
parent | 0884bee06018f5f450b431cf6c5ac5eeeab6827a (diff) | |
download | mongo-dc73a4b9567e1ebdb6ba6c9a41a919a0c7c6adf0.tar.gz |
SERVER-23103 Make service contexts responsible for creating DBDirectClients
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r-- | src/mongo/db/db.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 5b3b79bec1f..76701023439 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -109,6 +109,7 @@ #include "mongo/platform/process_id.h" #include "mongo/s/balancer/balancer.h" #include "mongo/s/sharding_initialization.h" +#include "mongo/scripting/dbdirectclient_factory.h" #include "mongo/scripting/engine.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" @@ -530,8 +531,15 @@ static void _initAndListen(int listenPort) { Client::initThread("initandlisten"); _initWireSpec(); - getGlobalServiceContext()->setFastClockSource(FastClockSourceFactory::create(Milliseconds(10))); - getGlobalServiceContext()->setOpObserver(stdx::make_unique<OpObserver>()); + auto globalServiceContext = getGlobalServiceContext(); + + globalServiceContext->setFastClockSource(FastClockSourceFactory::create(Milliseconds(10))); + globalServiceContext->setOpObserver(stdx::make_unique<OpObserver>()); + + DBDirectClientFactory::get(globalServiceContext) + .registerImplementation([](OperationContext* txn) { + return std::unique_ptr<DBClientBase>(new DBDirectClient(txn)); + }); const repl::ReplSettings& replSettings = repl::getGlobalReplicationCoordinator()->getSettings(); |