diff options
author | Xuerui Fa <xuerui.fa@mongodb.com> | 2020-05-11 18:24:26 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-12 18:59:56 +0000 |
commit | fdb04688e13a9a8df9abf28b0c9bd95387aabb04 (patch) | |
tree | 60d3df34c8e76fb98aa1c1f5f0cbe5d1e0cd9d0e | |
parent | 4317089d3206e16a623bd38f68e950f6b276f65c (diff) | |
download | mongo-fdb04688e13a9a8df9abf28b0c9bd95387aabb04.tar.gz |
SERVER-48115: Initialize pingStats before _handleHeartbeatResponse()
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp index 4c7b35ca083..9a6a5841a30 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp @@ -153,8 +153,13 @@ void ReplicationCoordinatorImpl::handleHeartbeatResponse_forTest(BSONObj respons _replExecutor.get(), handle, request, status); { - // Pretend we sent a request so that _untrackHeartbeatHandle_inlock succeeds. stdx::unique_lock<Latch> lk(_mutex); + + // Simulate preparing a heartbeat request so that the target's ping stats are initialized. + _topCoord->prepareHeartbeatRequestV1( + _replExecutor->now(), _rsConfig.getReplSetName(), request.target); + + // Pretend we sent a request so that _untrackHeartbeatHandle_inlock succeeds. _trackHeartbeatHandle_inlock(handle); } |