diff options
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 870f9d54e45..3a0cb62de62 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -134,7 +134,7 @@ void BackgroundSync::startup(OperationContext* opCtx) { } void BackgroundSync::shutdown(OperationContext* opCtx) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _state = ProducerState::Stopped; @@ -158,7 +158,7 @@ void BackgroundSync::join(OperationContext* opCtx) { } bool BackgroundSync::inShutdown() const { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); return _inShutdown_inlock(); } @@ -241,7 +241,7 @@ void BackgroundSync::_produce() { HostAndPort source; SyncSourceResolverResponse syncSourceResp; { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); if (_lastOpTimeFetched.isNull()) { // then we're initial syncing and we're still waiting for this to be set lock.unlock(); @@ -264,7 +264,7 @@ void BackgroundSync::_produce() { auto opCtx = cc().makeOperationContext(); minValidSaved = _replicationProcess->getConsistencyMarkers()->getMinValid(opCtx.get()); } - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (_state != ProducerState::Running) { return; } @@ -294,7 +294,7 @@ void BackgroundSync::_produce() { fassert(40349, status); _syncSourceResolver->join(); { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _syncSourceResolver.reset(); } @@ -340,7 +340,7 @@ void BackgroundSync::_produce() { return; } else if (syncSourceResp.isOK() && !syncSourceResp.getSyncSource().empty()) { { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _syncSourceHost = syncSourceResp.getSyncSource(); source = _syncSourceHost; } @@ -378,7 +378,7 @@ void BackgroundSync::_produce() { } { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (_state != ProducerState::Running) { return; } @@ -426,7 +426,7 @@ void BackgroundSync::_produce() { }, onOplogFetcherShutdownCallbackFn, bgSyncOplogFetcherBatchSize); - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (_state != ProducerState::Running) { return; } @@ -502,7 +502,7 @@ Status BackgroundSync::_enqueueDocuments(Fetcher::Documents::const_iterator begi // are done to prevent going into shutdown. This avoids a race where shutdown() clears the // buffer between the time we check _inShutdown and the point where we finish writing to the // buffer. - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); if (_state != ProducerState::Running) { return Status::OK(); } @@ -554,7 +554,7 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, OpTime lastOpTimeFetched; { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); lastOpTimeFetched = _lastOpTimeFetched; } @@ -631,7 +631,7 @@ void BackgroundSync::_runRollbackViaRecoverToCheckpoint( rollbackRemoteOplogQueryBatchSize.load()); { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (_state != ProducerState::Running) { return; } @@ -668,18 +668,18 @@ void BackgroundSync::_fallBackOnRollbackViaRefetch( } HostAndPort BackgroundSync::getSyncTarget() const { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); return _syncSourceHost; } void BackgroundSync::clearSyncTarget() { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); log() << "Resetting sync source to empty, which was " << _syncSourceHost; _syncSourceHost = HostAndPort(); } void BackgroundSync::stop(bool resetLastFetchedOptime) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _state = ProducerState::Stopped; log() << "Stopping replication producer"; @@ -709,7 +709,7 @@ void BackgroundSync::start(OperationContext* opCtx) { do { lastAppliedOpTime = _readLastAppliedOpTime(opCtx); - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); // Double check the state after acquiring the mutex. if (_state != ProducerState::Starting) { return; @@ -779,12 +779,12 @@ bool BackgroundSync::shouldStopFetching() const { } BackgroundSync::ProducerState BackgroundSync::getState() const { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); return _state; } void BackgroundSync::startProducerIfStopped() { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); // Let producer run if it's already running. if (_state == ProducerState::Stopped) { _state = ProducerState::Starting; |