diff options
-rw-r--r-- | src/mongo/executor/scoped_task_executor.cpp | 5 | ||||
-rw-r--r-- | src/mongo/executor/scoped_task_executor.h | 1 | ||||
-rw-r--r-- | src/mongo/executor/task_executor.h | 5 | ||||
-rw-r--r-- | src/mongo/executor/thread_pool_task_executor.h | 5 | ||||
-rw-r--r-- | src/mongo/s/sharding_task_executor.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/sharding_task_executor.h | 2 | ||||
-rw-r--r-- | src/mongo/unittest/task_executor_proxy.cpp | 4 | ||||
-rw-r--r-- | src/mongo/unittest/task_executor_proxy.h | 8 |
8 files changed, 30 insertions, 4 deletions
diff --git a/src/mongo/executor/scoped_task_executor.cpp b/src/mongo/executor/scoped_task_executor.cpp index c5b60e81913..82062cf1454 100644 --- a/src/mongo/executor/scoped_task_executor.cpp +++ b/src/mongo/executor/scoped_task_executor.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include "mongo/executor/scoped_task_executor.h" +#include "mongo/util/assert_util.h" namespace mongo { namespace executor { @@ -185,6 +186,10 @@ public: MONGO_UNREACHABLE; } + void dropConnections(const HostAndPort& hostAndPort) override { + MONGO_UNREACHABLE; + } + private: /** * Helper function to get a shared_ptr<ScopedTaskExecutor::Impl> to this object, akin to diff --git a/src/mongo/executor/scoped_task_executor.h b/src/mongo/executor/scoped_task_executor.h index 1f9a736d45e..0cc513b5a52 100644 --- a/src/mongo/executor/scoped_task_executor.h +++ b/src/mongo/executor/scoped_task_executor.h @@ -57,6 +57,7 @@ namespace executor { * - startup() * - appendDiagnosticBSON() * - appendConnectionStats() + * - dropConnections() * * And certain other methods only pass through this class to the underlying executor: * - makeEvent() diff --git a/src/mongo/executor/task_executor.h b/src/mongo/executor/task_executor.h index cfd689e0548..81855a7bade 100644 --- a/src/mongo/executor/task_executor.h +++ b/src/mongo/executor/task_executor.h @@ -421,6 +421,11 @@ public: */ virtual void appendConnectionStats(ConnectionPoolStats* stats) const = 0; + /** + * Drops all connections to the given host on the network interface. + */ + virtual void dropConnections(const HostAndPort& hostAndPort) = 0; + protected: // Retrieves the Callback from a given CallbackHandle static CallbackState* getCallbackFromHandle(const CallbackHandle& cbHandle); diff --git a/src/mongo/executor/thread_pool_task_executor.h b/src/mongo/executor/thread_pool_task_executor.h index a5b7fec5abd..1b02b812b85 100644 --- a/src/mongo/executor/thread_pool_task_executor.h +++ b/src/mongo/executor/thread_pool_task_executor.h @@ -99,10 +99,7 @@ public: void appendConnectionStats(ConnectionPoolStats* stats) const override; - /** - * Drops all connections to the given host on the network interface. - */ - void dropConnections(const HostAndPort& hostAndPort); + void dropConnections(const HostAndPort& hostAndPort) override; /** * Returns true if there are any tasks in any of _poolInProgressQueue, _networkInProgressQueue, diff --git a/src/mongo/s/sharding_task_executor.cpp b/src/mongo/s/sharding_task_executor.cpp index 52d3838fafd..6fcb68704b0 100644 --- a/src/mongo/s/sharding_task_executor.cpp +++ b/src/mongo/s/sharding_task_executor.cpp @@ -258,5 +258,9 @@ void ShardingTaskExecutor::appendConnectionStats(ConnectionPoolStats* stats) con _executor->appendConnectionStats(stats); } +void ShardingTaskExecutor::dropConnections(const HostAndPort& hostAndPort) { + _executor->dropConnections(hostAndPort); +} + } // namespace executor } // namespace mongo diff --git a/src/mongo/s/sharding_task_executor.h b/src/mongo/s/sharding_task_executor.h index ad85cc1a03a..803283b48b5 100644 --- a/src/mongo/s/sharding_task_executor.h +++ b/src/mongo/s/sharding_task_executor.h @@ -85,6 +85,8 @@ public: void appendConnectionStats(ConnectionPoolStats* stats) const override; + void dropConnections(const HostAndPort& hostAndPort) override; + private: std::unique_ptr<ThreadPoolTaskExecutor> _executor; }; diff --git a/src/mongo/unittest/task_executor_proxy.cpp b/src/mongo/unittest/task_executor_proxy.cpp index 4c2804db3b8..4fdffbac8ae 100644 --- a/src/mongo/unittest/task_executor_proxy.cpp +++ b/src/mongo/unittest/task_executor_proxy.cpp @@ -138,5 +138,9 @@ void TaskExecutorProxy::appendConnectionStats(executor::ConnectionPoolStats* sta _executor.load()->appendConnectionStats(stats); } +void TaskExecutorProxy::dropConnections(const HostAndPort& hostAndPort) { + _executor.load()->dropConnections(hostAndPort); +} + } // namespace unittest } // namespace mongo diff --git a/src/mongo/unittest/task_executor_proxy.h b/src/mongo/unittest/task_executor_proxy.h index 05a2a11a2a3..2507a230458 100644 --- a/src/mongo/unittest/task_executor_proxy.h +++ b/src/mongo/unittest/task_executor_proxy.h @@ -36,6 +36,13 @@ namespace unittest { /** * Proxy for the executor::TaskExecutor interface used for testing. + * + * Note that the following calls will affect other proxies that share the underlying executor: + * - startup() + * - shutdown() + * - apperndDiagnosticBSON() + * - appendConnectionStats() + * - dropConnections() */ class TaskExecutorProxy : public executor::TaskExecutor { TaskExecutorProxy(const TaskExecutorProxy&) = delete; @@ -80,6 +87,7 @@ public: void wait(const CallbackHandle& cbHandle, Interruptible* interruptible = Interruptible::notInterruptible()) override; void appendConnectionStats(executor::ConnectionPoolStats* stats) const override; + void dropConnections(const HostAndPort& hostAndPort) override; private: // Not owned by us. |