diff options
author | Matthew Russotto <matthew.russotto@mongodb.com> | 2020-01-14 22:58:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-14 22:58:39 +0000 |
commit | a783d0069915849552117c3f3b485010aef7ab44 (patch) | |
tree | 2beb59e8594d323a28607dc4e778be75d88f05a1 /src/mongo/db/repl | |
parent | 319757ebb72611fb91044a2a81d1b77a6f3729c1 (diff) | |
download | mongo-a783d0069915849552117c3f3b485010aef7ab44.tar.gz |
SERVER-45115 Eliminate circular resource dependency between ReplicationCoordinatorImpl and InitialSyncer.
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 0df5af41967..28578e2f2d0 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -2640,15 +2640,16 @@ Status ReplicationCoordinatorImpl::processReplSetSyncFrom(OperationContext* opCt const HostAndPort& target, BSONObjBuilder* resultObj) { Status result(ErrorCodes::InternalError, "didn't set status in prepareSyncFromResponse"); - auto doResync = false; + std::shared_ptr<InitialSyncer> initialSyncerCopy; { stdx::lock_guard<Latch> lk(_mutex); _topCoord->prepareSyncFromResponse(target, resultObj, &result); - // If we are in the middle of an initial sync, do a resync. - doResync = result.isOK() && _initialSyncer && _initialSyncer->isActive(); + // _initialSyncer must not be called with repl mutex held. + initialSyncerCopy = _initialSyncer; } - if (doResync) { + // If we are in the middle of an initial sync, do a resync. + if (result.isOK() && initialSyncerCopy && initialSyncerCopy->isActive()) { return resyncData(opCtx, false); } |