diff options
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp index 65a57b54c27..95a6b14e1ef 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp @@ -54,7 +54,7 @@ void WiredTigerOplogManager::start(OperationContext* opCtx, invariant(!_isRunning); // Prime the oplog read timestamp. auto sessionCache = WiredTigerRecoveryUnit::get(opCtx)->getSessionCache(); - _setOplogReadTimestamp(_fetchAllCommittedValue(sessionCache->conn())); + setOplogReadTimestamp(Timestamp(_fetchAllCommittedValue(sessionCache->conn()))); std::unique_ptr<SeekableRecordCursor> reverseOplogCursor = oplogRecordStore->getCursor(opCtx, false /* false = reverse cursor */); @@ -189,10 +189,8 @@ void WiredTigerOplogManager::_oplogJournalThreadLoop(WiredTigerSessionCache* ses sessionCache->waitUntilDurable(/*forceCheckpoint=*/false, false); lk.lock(); - // Publish the new timestamp value. - _setOplogReadTimestamp(newTimestamp); - _opsBecameVisibleCV.notify_all(); + _setOplogReadTimestamp(lk, newTimestamp); lk.unlock(); // Wake up any await_data cursors and tell them more data might be visible now. @@ -212,11 +210,13 @@ std::uint64_t WiredTigerOplogManager::getOplogReadTimestamp() const { } void WiredTigerOplogManager::setOplogReadTimestamp(Timestamp ts) { - _oplogReadTimestamp.store(ts.asULL()); + stdx::lock_guard<stdx::mutex> lk(_oplogVisibilityStateMutex); + _setOplogReadTimestamp(lk, ts.asULL()); } -void WiredTigerOplogManager::_setOplogReadTimestamp(uint64_t newTimestamp) { +void WiredTigerOplogManager::_setOplogReadTimestamp(WithLock, uint64_t newTimestamp) { _oplogReadTimestamp.store(newTimestamp); + _opsBecameVisibleCV.notify_all(); LOG(2) << "setting new oplogReadTimestamp: " << newTimestamp; } |