diff options
author | jannaerin <golden.janna@gmail.com> | 2020-05-29 13:38:04 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-02 14:57:48 +0000 |
commit | bd8e9b72e85cea81376c212ae73ee0094e22158f (patch) | |
tree | c2e5fc1c9d93e815ba2a80b64ca86d7e1cc693b3 | |
parent | cf4ac31b51ab7619294bc6576301703777cb5efb (diff) | |
download | mongo-bd8e9b72e85cea81376c212ae73ee0094e22158f.tar.gz |
SERVER-48498 Release RSM's mutex before notifying replica set change listener
(cherry picked from commit 912d0ead151bc3a5cac261f07c8453a35a73ad10)
-rw-r--r-- | src/mongo/client/streamable_replica_set_monitor.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/client/streamable_replica_set_monitor.cpp b/src/mongo/client/streamable_replica_set_monitor.cpp index 9f44c38f5df..175ce789bac 100644 --- a/src/mongo/client/streamable_replica_set_monitor.cpp +++ b/src/mongo/client/streamable_replica_set_monitor.cpp @@ -576,7 +576,7 @@ void StreamableReplicaSetMonitor::_setConfirmedNotifierState( void StreamableReplicaSetMonitor::onTopologyDescriptionChangedEvent( TopologyDescriptionPtr previousDescription, TopologyDescriptionPtr newDescription) { - stdx::lock_guard lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); if (_isDropped.load()) return; @@ -593,6 +593,7 @@ void StreamableReplicaSetMonitor::onTopologyDescriptionChangedEvent( if (maybePrimary) { _setConfirmedNotifierState(lock, *maybePrimary); + lock.unlock(); ReplicaSetMonitorManager::get()->getNotifier().onConfirmedSet( _confirmedNotifierState->connectionString, _confirmedNotifierState->primaryAddress, @@ -600,6 +601,7 @@ void StreamableReplicaSetMonitor::onTopologyDescriptionChangedEvent( } else { if (_confirmedNotifierState) { const auto& connectionString = _confirmedNotifierState->connectionString; + lock.unlock(); ReplicaSetMonitorManager::get()->getNotifier().onPossibleSet(connectionString); } else { // No confirmed hosts yet, just send list of hosts that are routable base on type. @@ -616,6 +618,8 @@ void StreamableReplicaSetMonitor::onTopologyDescriptionChangedEvent( const auto connectionString = ConnectionString::forReplicaSet( getName(), _extractHosts(primaryAndSecondaries)); + + lock.unlock(); ReplicaSetMonitorManager::get()->getNotifier().onPossibleSet(connectionString); } } |