diff options
author | Rahul Sundararaman <rahul.sundararaman@mongodb.com> | 2019-12-09 18:32:45 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-09 18:32:45 +0000 |
commit | 4f00d6e3d7e54a2d131b8216d4b4ef9bfd7a7c6b (patch) | |
tree | 97b83f3c954bd475f8eb5d94f592eca57a5018f7 /src/mongo/executor | |
parent | 1f32f6c3952581833482a1c3b0b7ab913b60943f (diff) | |
download | mongo-4f00d6e3d7e54a2d131b8216d4b4ef9bfd7a7c6b.tar.gz |
SERVER-44155 Validate a subset of latches of all levels
Diffstat (limited to 'src/mongo/executor')
-rw-r--r-- | src/mongo/executor/connection_pool.cpp | 3 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool.h | 4 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool_tl.h | 4 | ||||
-rw-r--r-- | src/mongo/executor/egress_tag_closer_manager.h | 4 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_thread_pool.h | 4 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_tl.h | 7 | ||||
-rw-r--r-- | src/mongo/executor/thread_pool_task_executor.h | 4 |
7 files changed, 22 insertions, 8 deletions
diff --git a/src/mongo/executor/connection_pool.cpp b/src/mongo/executor/connection_pool.cpp index a0a4c9f0a7c..42ff763018f 100644 --- a/src/mongo/executor/connection_pool.cpp +++ b/src/mongo/executor/connection_pool.cpp @@ -43,6 +43,7 @@ #include "mongo/executor/remote_command_request.h" #include "mongo/util/assert_util.h" #include "mongo/util/destructor_guard.h" +#include "mongo/util/hierarchical_acquisition.h" #include "mongo/util/log.h" #include "mongo/util/lru_cache.h" #include "mongo/util/scopeguard.h" @@ -189,7 +190,7 @@ protected: size_t target = 0; }; - Mutex _mutex = MONGO_MAKE_LATCH("LimitController::_mutex"); + Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "LimitController::_mutex"); stdx::unordered_map<PoolId, PoolData> _poolData; }; diff --git a/src/mongo/executor/connection_pool.h b/src/mongo/executor/connection_pool.h index f46c3c23dfa..f5f8629a8c2 100644 --- a/src/mongo/executor/connection_pool.h +++ b/src/mongo/executor/connection_pool.h @@ -41,6 +41,7 @@ #include "mongo/transport/transport_layer.h" #include "mongo/util/duration.h" #include "mongo/util/future.h" +#include "mongo/util/hierarchical_acquisition.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/out_of_line_executor.h" #include "mongo/util/time_support.h" @@ -255,7 +256,8 @@ private: std::shared_ptr<ControllerInterface> _controller; // The global mutex for specific pool access and the generation counter - mutable Mutex _mutex = MONGO_MAKE_LATCH("ConnectionPool::_mutex"); + mutable Mutex _mutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(1), "ExecutorConnectionPool::_mutex"); PoolId _nextPoolId = 0; stdx::unordered_map<HostAndPort, std::shared_ptr<SpecificPool>> _pools; diff --git a/src/mongo/executor/connection_pool_tl.h b/src/mongo/executor/connection_pool_tl.h index f5bf54ff081..b765f9ddd15 100644 --- a/src/mongo/executor/connection_pool_tl.h +++ b/src/mongo/executor/connection_pool_tl.h @@ -36,6 +36,7 @@ #include "mongo/executor/network_connection_hook.h" #include "mongo/executor/network_interface.h" #include "mongo/util/future.h" +#include "mongo/util/hierarchical_acquisition.h" namespace mongo { namespace executor { @@ -79,7 +80,8 @@ private: std::unique_ptr<NetworkConnectionHook> _onConnectHook; const ConnectionPool::Options _connPoolOptions; - mutable Mutex _mutex = MONGO_MAKE_LATCH("TLTypeFactory::_mutex"); + mutable Mutex _mutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "TLTypeFactory::_mutex"); AtomicWord<bool> _inShutdown{false}; stdx::unordered_set<Type*> _collars; }; diff --git a/src/mongo/executor/egress_tag_closer_manager.h b/src/mongo/executor/egress_tag_closer_manager.h index 91d996ee3dc..e2243ae1c6c 100644 --- a/src/mongo/executor/egress_tag_closer_manager.h +++ b/src/mongo/executor/egress_tag_closer_manager.h @@ -36,6 +36,7 @@ #include "mongo/platform/mutex.h" #include "mongo/stdx/unordered_set.h" #include "mongo/transport/session.h" +#include "mongo/util/hierarchical_acquisition.h" #include "mongo/util/net/hostandport.h" namespace mongo { @@ -65,7 +66,8 @@ public: const std::function<transport::Session::TagMask(transport::Session::TagMask)>& mutateFunc); private: - Mutex _mutex = MONGO_MAKE_LATCH("EgressTagCloserManager::_mutex"); + Mutex _mutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(2), "EgressTagCloserManager::_mutex"); stdx::unordered_set<EgressTagCloser*> _egressTagClosers; }; diff --git a/src/mongo/executor/network_interface_thread_pool.h b/src/mongo/executor/network_interface_thread_pool.h index 3a295b26a5b..6cf058cac50 100644 --- a/src/mongo/executor/network_interface_thread_pool.h +++ b/src/mongo/executor/network_interface_thread_pool.h @@ -35,6 +35,7 @@ #include "mongo/platform/mutex.h" #include "mongo/stdx/condition_variable.h" #include "mongo/util/concurrency/thread_pool_interface.h" +#include "mongo/util/hierarchical_acquisition.h" namespace mongo { namespace executor { @@ -67,7 +68,8 @@ private: NetworkInterface* const _net; // Protects all of the pool state below - Mutex _mutex = MONGO_MAKE_LATCH("NetworkInterfaceThreadPool::_mutex"); + Mutex _mutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "NetworkInterfaceThreadPool::_mutex"); stdx::condition_variable _joiningCondition; std::vector<Task> _tasks; bool _started = false; diff --git a/src/mongo/executor/network_interface_tl.h b/src/mongo/executor/network_interface_tl.h index ee27fdd410f..80e510a015f 100644 --- a/src/mongo/executor/network_interface_tl.h +++ b/src/mongo/executor/network_interface_tl.h @@ -40,6 +40,7 @@ #include "mongo/stdx/unordered_map.h" #include "mongo/transport/baton.h" #include "mongo/transport/transport_layer.h" +#include "mongo/util/hierarchical_acquisition.h" #include "mongo/util/strong_weak_finish_line.h" namespace mongo { @@ -147,7 +148,8 @@ private: std::unique_ptr<transport::TransportLayer> _ownedTransportLayer; transport::ReactorHandle _reactor; - mutable Mutex _mutex = MONGO_MAKE_LATCH("NetworkInterfaceTL::_mutex"); + mutable Mutex _mutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(3), "NetworkInterfaceTL::_mutex"); ConnectionPool::Options _connPoolOpts; std::unique_ptr<NetworkConnectionHook> _onConnectHook; std::shared_ptr<ConnectionPool> _pool; @@ -165,7 +167,8 @@ private: AtomicWord<State> _state; stdx::thread _ioThread; - Mutex _inProgressMutex = MONGO_MAKE_LATCH("NetworkInterfaceTL::_inProgressMutex"); + Mutex _inProgressMutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "NetworkInterfaceTL::_inProgressMutex"); stdx::unordered_map<TaskExecutor::CallbackHandle, std::weak_ptr<CommandState>> _inProgress; stdx::unordered_map<TaskExecutor::CallbackHandle, std::shared_ptr<AlarmState>> _inProgressAlarms; diff --git a/src/mongo/executor/thread_pool_task_executor.h b/src/mongo/executor/thread_pool_task_executor.h index c543e4fb0c8..1ac9c385a98 100644 --- a/src/mongo/executor/thread_pool_task_executor.h +++ b/src/mongo/executor/thread_pool_task_executor.h @@ -38,6 +38,7 @@ #include "mongo/stdx/thread.h" #include "mongo/transport/baton.h" #include "mongo/util/fail_point.h" +#include "mongo/util/hierarchical_acquisition.h" namespace mongo { @@ -188,7 +189,8 @@ private: std::shared_ptr<ThreadPoolInterface> _pool; // Mutex guarding all remaining fields. - mutable Mutex _mutex = MONGO_MAKE_LATCH("ThreadPoolTaskExecutor::_mutex"); + mutable Mutex _mutex = + MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(1), "ThreadPoolTaskExecutor::_mutex"); // Queue containing all items currently scheduled into the thread pool but not yet completed. WorkQueue _poolInProgressQueue; |