diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2016-10-13 10:18:19 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2016-10-13 10:18:19 -0400 |
commit | 9228a2b401b4af0adfa53a61053fba3a7df4f75c (patch) | |
tree | b9a66d8073dfa532c87dd04f2e48d90d75e4097e /src/mongo/executor/network_interface_mock.h | |
parent | 8794dd4bdcab131a4ecf0963505e7fb2a34bf5e6 (diff) | |
download | mongo-9228a2b401b4af0adfa53a61053fba3a7df4f75c.tar.gz |
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.
Diffstat (limited to 'src/mongo/executor/network_interface_mock.h')
-rw-r--r-- | src/mongo/executor/network_interface_mock.h | 19 |
1 files changed, 19 insertions, 0 deletions
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<void()> action) override { + return _net->setAlarm(when, action); + } + +private: + NetworkInterfaceMock* _net; +}; + } // namespace executor } // namespace mongo |