diff options
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp index dd7cb413540..e98b0462d07 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp @@ -722,8 +722,22 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigStore( "config"_attr = configToApply); } - const StatusWith<int> myIndex = validateConfigForHeartbeatReconfig( - _externalState.get(), configToApply, getGlobalServiceContext()); + const auto myIndex = [&]() -> StatusWith<int> { + // We always check the config when _selfIndex is not valid, in order to be able to + // recover from transient DNS errors. + if (_selfIndex >= 0 && sameConfigContents(_rsConfig, configToApply)) { + LOGV2_FOR_HEARTBEATS( + 6351200, + 2, + "New heartbeat config is only a version/term change, skipping validation checks", + "oldConfig"_attr = _rsConfig, + "newConfig"_attr = configToApply); + // If the configs are the same, so is our index. + return _selfIndex; + } + return validateConfigForHeartbeatReconfig( + _externalState.get(), configToApply, getGlobalServiceContext()); + }(); if (myIndex.getStatus() == ErrorCodes::NodeNotFound) { stdx::lock_guard<Latch> lk(_mutex); |