From 9228a2b401b4af0adfa53a61053fba3a7df4f75c Mon Sep 17 00:00:00 2001 From: Andy Schwerin Date: Thu, 13 Oct 2016 10:18:19 -0400 Subject: SERVER-26305 Use interruptible condition variables in ReplicationCoordinatorImpl instead of KillOpListener While this change also improves the readability of _awaitReplication_inlock and stepDown, it resovles SERVER-26305 by breaking a deadlock cycle caused by the fact that KillOpListener methods get run under a mutex in ServiceContext. --- src/mongo/executor/network_interface_mock.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mongo/executor/network_interface_mock.h') diff --git a/src/mongo/executor/network_interface_mock.h b/src/mongo/executor/network_interface_mock.h index f75330e7acf..0ba054f11fe 100644 --- a/src/mongo/executor/network_interface_mock.h +++ b/src/mongo/executor/network_interface_mock.h @@ -41,6 +41,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/stdx/unordered_set.h" +#include "mongo/util/clock_source.h" #include "mongo/util/time_support.h" namespace mongo { @@ -519,5 +520,23 @@ private: bool _callExitNetwork = true; }; +class NetworkInterfaceMockClockSource : public ClockSource { +public: + explicit NetworkInterfaceMockClockSource(NetworkInterfaceMock* net); + + Milliseconds getPrecision() override { + return Milliseconds{1}; + } + Date_t now() override { + return _net->now(); + } + Status setAlarm(Date_t when, stdx::function action) override { + return _net->setAlarm(when, action); + } + +private: + NetworkInterfaceMock* _net; +}; + } // namespace executor } // namespace mongo -- cgit v1.2.1