summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2021-07-15 18:47:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-11 14:41:25 +0000
commit51463ed9e3fca4667c72d82be539c061e7bed63e (patch)
tree79355cb53be9bfd34e3353d181913620143796f3
parent6aa8816af3ed8a323426d912bf74775062632104 (diff)
downloadmongo-51463ed9e3fca4667c72d82be539c061e7bed63e.tar.gz
SERVER-58594 ReplicationCoordinatorImpl::handleHeartbeatResponse_forTest doesn't use _mutex when reading _rsConfig
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
index 451aaf94c95..3294467da68 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
@@ -150,14 +150,12 @@ void ReplicationCoordinatorImpl::handleHeartbeatResponse_forTest(BSONObj respons
Milliseconds ping) {
CallbackHandle handle;
RemoteCommandRequest request;
- request.target = _rsConfig.getMemberAt(targetIndex).getHostAndPort();
- executor::TaskExecutor::ResponseStatus status(response, ping);
- executor::TaskExecutor::RemoteCommandCallbackArgs cbData(
- _replExecutor.get(), handle, request, status);
{
stdx::unique_lock<Latch> lk(_mutex);
+ request.target = _rsConfig.getMemberAt(targetIndex).getHostAndPort();
+
// Simulate preparing a heartbeat request so that the target's ping stats are initialized.
_topCoord->prepareHeartbeatRequestV1(
_replExecutor->now(), _rsConfig.getReplSetName(), request.target);
@@ -166,6 +164,10 @@ void ReplicationCoordinatorImpl::handleHeartbeatResponse_forTest(BSONObj respons
_trackHeartbeatHandle_inlock(handle, HeartbeatState::kSent, request.target);
}
+ executor::TaskExecutor::ResponseStatus status(response, ping);
+ executor::TaskExecutor::RemoteCommandCallbackArgs cbData(
+ _replExecutor.get(), handle, request, status);
+
_handleHeartbeatResponse(cbData);
}