summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Wahlin <james@mongodb.com>2017-06-08 09:47:08 -0400
committerJames Wahlin <james@mongodb.com>2017-06-08 09:47:08 -0400
commit60a4010587ed169a6f7e2709c150db2173e66514 (patch)
tree09e35226b544fbfe7fc0f39835df97b85f639a50 /src
parent12e54a966bde02389224b78db6500978ca68a54e (diff)
downloadmongo-60a4010587ed169a6f7e2709c150db2173e66514.tar.gz
Revert "SERVER-29305 `dbdirectclient::call` uses OpContext"
This reverts commit 36351fdb8642bed4fd977e8234b6ff16cf5e7da2.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/SConscript1
-rw-r--r--src/mongo/db/SConscript5
-rw-r--r--src/mongo/db/db.cpp3
-rw-r--r--src/mongo/db/dbdirectclient.cpp13
-rw-r--r--src/mongo/db/service_context.h2
-rw-r--r--src/mongo/db/service_context_d.cpp14
-rw-r--r--src/mongo/db/service_context_noop.cpp1
7 files changed, 15 insertions, 24 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 742c2712d6e..1687378dda5 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -279,6 +279,7 @@ mongod = env.Program(
source=[
"db/db.cpp",
"db/mongod_options_init.cpp",
+ "db/service_entry_point_mongod.cpp",
] + env.WindowsResourceFile("db/db.rc"),
LIBDEPS=[
'db/assemble_response',
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 620ba75bf7f..0daaca784dd 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -547,6 +547,7 @@ env.Library(
'$BUILD_DIR/mongo/client/clientdriver',
'curop',
'lasterror',
+ 'assemble_response',
],
)
@@ -566,13 +567,9 @@ env.Library(
target="service_context_d",
source=[
"service_context_d.cpp",
- "service_entry_point_mongod.cpp",
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/transport/service_entry_point',
- '$BUILD_DIR/mongo/transport/transport_layer_common',
- 'assemble_response',
'concurrency/lock_manager',
'curop',
'storage/storage_engine_lock_file',
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 980310ec1ef..94cd4bbe97c 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -488,6 +488,9 @@ ExitCode _initAndListen(int listenPort) {
options.port = listenPort;
options.ipList = serverGlobalParams.bind_ip;
+ globalServiceContext->setServiceEntryPoint(
+ stdx::make_unique<ServiceEntryPointMongod>(globalServiceContext));
+
// Create, start, and attach the TL
auto transportLayer = stdx::make_unique<transport::TransportLayerLegacy>(
options, globalServiceContext->getServiceEntryPoint());
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp
index 46a7d30b0f9..60a001f534e 100644
--- a/src/mongo/db/dbdirectclient.cpp
+++ b/src/mongo/db/dbdirectclient.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/dbdirectclient.h"
+#include "mongo/db/assemble_response.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/curop.h"
@@ -39,7 +40,6 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/wire_version.h"
#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/transport/service_entry_point.h"
#include "mongo/util/log.h"
namespace mongo {
@@ -119,19 +119,12 @@ QueryOptions DBDirectClient::_lookupAvailableOptions() {
return QueryOptions(DBClientBase::_lookupAvailableOptions() & ~QueryOption_Exhaust);
}
-namespace {
-DbResponse loopbackBuildResponse(OperationContext* const opCtx, Message& toSend) {
- return opCtx->getServiceContext()->getServiceEntryPoint()->handleRequest(
- opCtx, toSend, HostAndPort{});
-}
-} // namespace
-
bool DBDirectClient::call(Message& toSend, Message& response, bool assertOk, string* actualServer) {
DirectClientScope directClientScope(_opCtx);
LastError::get(_opCtx->getClient()).startRequest();
CurOp curOp(_opCtx);
- auto dbResponse = loopbackBuildResponse(_opCtx, toSend);
+ auto dbResponse = assembleResponse(_opCtx, toSend, kHostAndPortForDirectClient);
invariant(!dbResponse.response.empty());
response = std::move(dbResponse.response);
@@ -143,7 +136,7 @@ void DBDirectClient::say(Message& toSend, bool isRetry, string* actualServer) {
LastError::get(_opCtx->getClient()).startRequest();
CurOp curOp(_opCtx);
- auto dbResponse = loopbackBuildResponse(_opCtx, toSend);
+ auto dbResponse = assembleResponse(_opCtx, toSend, kHostAndPortForDirectClient);
invariant(dbResponse.response.empty());
}
diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h
index c4f41bd5651..566ed7fb650 100644
--- a/src/mongo/db/service_context.h
+++ b/src/mongo/db/service_context.h
@@ -389,7 +389,7 @@ public:
void setPreciseClockSource(std::unique_ptr<ClockSource> newSource);
/**
- * Binds the service entry point implementation to the service context.
+ * Binds the service entry point implementation to the service context
*/
void setServiceEntryPoint(std::unique_ptr<ServiceEntryPoint> sep);
diff --git a/src/mongo/db/service_context_d.cpp b/src/mongo/db/service_context_d.cpp
index f3e40ee053b..f1dd329781b 100644
--- a/src/mongo/db/service_context_d.cpp
+++ b/src/mongo/db/service_context_d.cpp
@@ -40,7 +40,6 @@
#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/service_context.h"
-#include "mongo/db/service_entry_point_mongod.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/db/storage/storage_engine_lock_file.h"
#include "mongo/db/storage/storage_engine_metadata.h"
@@ -57,17 +56,14 @@
namespace mongo {
namespace {
-auto makeMongoDServiceContext() {
- auto service = stdx::make_unique<ServiceContextMongoD>();
- service->setServiceEntryPoint(stdx::make_unique<ServiceEntryPointMongod>(service.get()));
+
+MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) {
+ setGlobalServiceContext(stdx::make_unique<ServiceContextMongoD>());
+ auto service = getGlobalServiceContext();
+
service->setTickSource(stdx::make_unique<SystemTickSource>());
service->setFastClockSource(stdx::make_unique<SystemClockSource>());
service->setPreciseClockSource(stdx::make_unique<SystemClockSource>());
- return service;
-}
-
-MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) {
- setGlobalServiceContext(makeMongoDServiceContext());
return Status::OK();
}
} // namespace
diff --git a/src/mongo/db/service_context_noop.cpp b/src/mongo/db/service_context_noop.cpp
index 993d7fccfeb..42fd30f3f3c 100644
--- a/src/mongo/db/service_context_noop.cpp
+++ b/src/mongo/db/service_context_noop.cpp
@@ -35,6 +35,7 @@
#include "mongo/stdx/memory.h"
namespace mongo {
+
StorageEngine* ServiceContextNoop::getGlobalStorageEngine() {
return NULL;
}