From b03fb82e1737b28fbd322e9bf200bb7a3176d9f7 Mon Sep 17 00:00:00 2001 From: Dianna Hohensee Date: Thu, 20 Feb 2020 23:11:08 -0500 Subject: SERVER-46297 make all primary durable timestamp updates go through the journal listener --- src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp | 7 +++++++ src/mongo/db/write_concern.cpp | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp index 173fb05f7b6..64ef2d146ed 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp @@ -247,6 +247,13 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx, // For inMemory storage engines, the data is "as durable as it's going to get". // That is, a restart is equivalent to a complete node failure. if (isEphemeral()) { + // Update the JournalListener before we return. As far as listeners are concerned, all + // writes are as 'durable' as they are ever going to get on an inMemory storage engine. + stdx::unique_lock lk(_journalListenerMutex, stdx::defer_lock); + if (useListener == UseJournalListener::kUpdate) { + auto token = _journalListener->getToken(opCtx, lk); + _journalListener->onDurable(token); + } return; } diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp index 5464e3f2a28..1b493bc129b 100644 --- a/src/mongo/db/write_concern.cpp +++ b/src/mongo/db/write_concern.cpp @@ -287,15 +287,6 @@ Status waitForWriteConcern(OperationContext* opCtx, break; } case WriteConcernOptions::SyncMode::JOURNAL: - if (replCoord->getReplicationMode() != repl::ReplicationCoordinator::Mode::modeNone) { - // Wait for ops to become durable then update replication system's knowledge of - // this. - // This is only needed for inMemory storage engines, which may not update the - // Durable time. - auto appliedOpTimeAndWallTime = replCoord->getMyLastAppliedOpTimeAndWallTime(); - getGlobalServiceContext()->getStorageEngine()->waitForJournalFlush(opCtx); - replCoord->setMyLastDurableOpTimeAndWallTimeForward(appliedOpTimeAndWallTime); - } getGlobalServiceContext()->getStorageEngine()->waitForJournalFlush(opCtx); break; } -- cgit v1.2.1