diff options
author | Reo Kimura <reo.kimura@mongodb.com> | 2020-07-22 03:03:43 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-17 01:16:21 +0000 |
commit | ab0703b3c6ad1607fa224c5be2b893ddbdad365e (patch) | |
tree | 7368863c9e82869c5e91096de3017a10c26294c8 /src/mongo/db | |
parent | 96ced1dddcb87b0bc7bafc40094d9014c04edd98 (diff) | |
download | mongo-ab0703b3c6ad1607fa224c5be2b893ddbdad365e.tar.gz |
SERVER-49072 Make ServiceExecutors into Decorations
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/commands/server_status_servers.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/mongod_main.cpp | 29 | ||||
-rw-r--r-- | src/mongo/db/service_context.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/service_context.h | 13 |
4 files changed, 4 insertions, 50 deletions
diff --git a/src/mongo/db/commands/server_status_servers.cpp b/src/mongo/db/commands/server_status_servers.cpp index 85a57202370..cc39b6da7d8 100644 --- a/src/mongo/db/commands/server_status_servers.cpp +++ b/src/mongo/db/commands/server_status_servers.cpp @@ -33,6 +33,7 @@ #include "mongo/db/commands/server_status.h" #include "mongo/transport/message_compressor_registry.h" #include "mongo/transport/service_entry_point.h" +#include "mongo/transport/service_executor_synchronous.h" #include "mongo/util/net/hostname_canonicalization.h" #include "mongo/util/net/socket_utils.h" #include "mongo/util/net/ssl_manager.h" @@ -77,12 +78,13 @@ public: return true; } + // TODO: need to track connections in server stats (see SERVER-49073) BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const override { BSONObjBuilder b; networkCounter.append(b); appendMessageCompressionStats(&b); - auto executor = opCtx->getServiceContext()->getServiceExecutor(); + auto executor = transport::ServiceExecutorSynchronous::get(opCtx->getServiceContext()); if (executor) { BSONObjBuilder section(b.subobjStart("serviceExecutorTaskStats")); executor->appendStats(§ion); diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp index 05c9ed67511..b355becdf2a 100644 --- a/src/mongo/db/mongod_main.cpp +++ b/src/mongo/db/mongod_main.cpp @@ -736,16 +736,7 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) { // operation context anymore startupOpCtx.reset(); - auto start = serviceContext->getServiceExecutor()->start(); - if (!start.isOK()) { - LOGV2_ERROR(20570, - "Error starting service executor: {error}", - "Error starting service executor", - "error"_attr = start); - return EXIT_NET_ERROR; - } - - start = serviceContext->getServiceEntryPoint()->start(); + auto start = serviceContext->getServiceEntryPoint()->start(); if (!start.isOK()) { LOGV2_ERROR(20571, "Error starting service entry point: {error}", @@ -1295,11 +1286,6 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) { CatalogCacheLoader::get(serviceContext).shutDown(); } -#if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer) - // When running under address sanitizer, we get false positive leaks due to disorder around - // the lifecycle of a connection and request. When we are running under ASAN, we try a lot - // harder to dry up the server from active connections before going on to really shut down. - // Shutdown the Service Entry Point and its sessions and give it a grace period to complete. if (auto sep = serviceContext->getServiceEntryPoint()) { LOGV2_OPTIONS(4784923, {LogComponent::kCommand}, "Shutting down the ServiceEntryPoint"); @@ -1310,19 +1296,6 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) { } } - // Shutdown and wait for the service executor to exit - if (auto svcExec = serviceContext->getServiceExecutor()) { - LOGV2_OPTIONS(4784924, {LogComponent::kExecutor}, "Shutting down the service executor"); - Status status = svcExec->shutdown(Seconds(10)); - if (!status.isOK()) { - LOGV2_OPTIONS(20564, - {LogComponent::kNetwork}, - "Service executor did not shutdown within the time limit", - "error"_attr = status); - } - } -#endif - LOGV2(4784925, "Shutting down free monitoring"); stopFreeMonitoring(); diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp index c8a6a6f60bd..8796d7fdae6 100644 --- a/src/mongo/db/service_context.cpp +++ b/src/mongo/db/service_context.cpp @@ -193,10 +193,6 @@ ServiceEntryPoint* ServiceContext::getServiceEntryPoint() const { return _serviceEntryPoint.get(); } -transport::ServiceExecutor* ServiceContext::getServiceExecutor() const { - return _serviceExecutor.get(); -} - void ServiceContext::setStorageEngine(std::unique_ptr<StorageEngine> engine) { invariant(engine); invariant(!_storageEngine); @@ -227,10 +223,6 @@ void ServiceContext::setTransportLayer(std::unique_ptr<transport::TransportLayer _transportLayer = std::move(tl); } -void ServiceContext::setServiceExecutor(std::unique_ptr<transport::ServiceExecutor> exec) { - _serviceExecutor = std::move(exec); -} - void ServiceContext::ClientDeleter::operator()(Client* client) const { ServiceContext* const service = client->getServiceContext(); { diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h index 4b4156a78bf..a3ee1c646b2 100644 --- a/src/mongo/db/service_context.h +++ b/src/mongo/db/service_context.h @@ -490,14 +490,6 @@ public: ServiceEntryPoint* getServiceEntryPoint() const; /** - * Get the service executor for the service context. - * - * See ServiceStateMachine for how this is used. Some configurations may not have a service - * executor registered and this will return a nullptr. - */ - transport::ServiceExecutor* getServiceExecutor() const; - - /** * Waits for the ServiceContext to be fully initialized and for all TransportLayers to have been * added/started. * @@ -582,11 +574,6 @@ public: void setTransportLayer(std::unique_ptr<transport::TransportLayer> tl); /** - * Binds the service executor to the service context - */ - void setServiceExecutor(std::unique_ptr<transport::ServiceExecutor> exec); - - /** * Creates a delayed execution baton with basic functionality */ BatonHandle makeBaton(OperationContext* opCtx) const; |