diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2021-01-21 18:59:53 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-01-26 18:22:44 +0000 |
commit | 114d6b9916fd030bdffc98c78eb07b5dcb522c71 (patch) | |
tree | c0e69cddd9a3c09e8017811d31d7324c791dd202 | |
parent | dc1c3a791f63dfb909ed520aadab66a4b1ce66e9 (diff) | |
download | mongo-114d6b9916fd030bdffc98c78eb07b5dcb522c71.tar.gz |
SERVER-53586 Limit the size of TenantMigrationDonorService::Instance's task executor thread pool
-rw-r--r-- | src/mongo/db/repl/repl_server_parameters.idl | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/tenant_migration_donor_service.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/tenant_migration_donor_service.h | 10 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/mongo/db/repl/repl_server_parameters.idl b/src/mongo/db/repl/repl_server_parameters.idl index 9796aea515c..0fcbefb7a60 100644 --- a/src/mongo/db/repl/repl_server_parameters.idl +++ b/src/mongo/db/repl/repl_server_parameters.idl @@ -423,12 +423,12 @@ server_parameters: validator: gte: 1 - maxTenantMigrationDonorThreadPoolSize: + maxTenantMigrationDonorServiceThreadPoolSize: description: >- - The maximum number of threads in the tenant migration donor's thread pool. + The maximum number of threads in the tenant migration donor service's thread pool. set_at: startup cpp_vartype: int - cpp_varname: maxTenantMigrationDonorThreadPoolSize + cpp_varname: maxTenantMigrationDonorServiceThreadPoolSize default: 8 validator: gte: 1 diff --git a/src/mongo/db/repl/tenant_migration_donor_service.cpp b/src/mongo/db/repl/tenant_migration_donor_service.cpp index a2291a4eae2..e1085e3757e 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.cpp +++ b/src/mongo/db/repl/tenant_migration_donor_service.cpp @@ -131,7 +131,7 @@ TenantMigrationDonorService::Instance::Instance(ServiceContext* serviceContext, _instanceName(kServiceName + "-" + _stateDoc.getTenantId()), _recipientUri( uassertStatusOK(MongoURI::parse(_stateDoc.getRecipientConnectionString().toString()))) { - ThreadPool::Options threadPoolOptions(_recipientCmdThreadPoolLimit); + ThreadPool::Options threadPoolOptions(getRecipientCmdThreadPoolLimits()); threadPoolOptions.threadNamePrefix = _instanceName + "-"; threadPoolOptions.poolName = _instanceName + "ThreadPool"; threadPoolOptions.onCreateThread = [this](const std::string& threadName) { diff --git a/src/mongo/db/repl/tenant_migration_donor_service.h b/src/mongo/db/repl/tenant_migration_donor_service.h index 83260453ec9..6bbc131c525 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.h +++ b/src/mongo/db/repl/tenant_migration_donor_service.h @@ -59,7 +59,7 @@ public: ThreadPool::Limits getThreadPoolLimits() const override { ThreadPool::Limits limits; - limits.maxThreads = repl::maxTenantMigrationDonorThreadPoolSize; + limits.maxThreads = repl::maxTenantMigrationDonorServiceThreadPoolSize; return limits; } @@ -209,8 +209,12 @@ public: // Task executor used for executing commands against the recipient using SSL connection // created using the migration-specific certificate. std::shared_ptr<executor::TaskExecutor> _recipientCmdExecutor; - // TODO (SERVER-50438): Limit the size of TenantMigrationDonorService thread pool. - const ThreadPool::Limits _recipientCmdThreadPoolLimit{}; + + ThreadPool::Limits getRecipientCmdThreadPoolLimits() const { + ThreadPool::Limits recipientCmdThreadPoolLimits; + recipientCmdThreadPoolLimits.maxThreads = 1; + return recipientCmdThreadPoolLimits; + } boost::optional<Status> _abortReason; |