summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2020-02-20 23:11:08 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-22 03:42:06 +0000
commitb03fb82e1737b28fbd322e9bf200bb7a3176d9f7 (patch)
treeace2ae23d58a330f6285949e0a5d380c95460c7c
parent23b2864a29554c9a27121303b774e80a42200130 (diff)
downloadmongo-b03fb82e1737b28fbd322e9bf200bb7a3176d9f7.tar.gz
SERVER-46297 make all primary durable timestamp updates go through the journal listener
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp7
-rw-r--r--src/mongo/db/write_concern.cpp9
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<Latch> 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;
}