summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2018-07-26 19:57:20 -0400
committerDaniel Gottlieb <daniel.gottlieb@mongodb.com>2018-07-26 20:03:26 -0400
commit9d5a4298d2dd876d0762b27221332f0d9cc1871e (patch)
tree61fbc34b447597faaf286063d3b3f5984900bd9d /src/mongo
parentef2f722627f09aba4f25ad46a557da7f416ce8da (diff)
downloadmongo-9d5a4298d2dd876d0762b27221332f0d9cc1871e.tar.gz
SERVER-36283: Have initial sync completion advance oplog visibility to the initial sync time.
(cherry picked from commit 9568dc3d2fb7244d75744c70c3ac98a8719ca9ab)
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/initial_syncer.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp
index aeb4659fddc..045f1bcd82c 100644
--- a/src/mongo/db/repl/initial_syncer.cpp
+++ b/src/mongo/db/repl/initial_syncer.cpp
@@ -407,10 +407,13 @@ void InitialSyncer::_tearDown_inlock(OperationContext* opCtx,
return;
}
- // This is necessary to ensure that the oplog contains at least one visible document prior to
- // setting an externally visible lastApplied. That way if any other node attempts to read from
- // this node's oplog, it won't appear empty.
- _storage->waitForAllEarlierOplogWritesToBeVisible(opCtx);
+ // A node coming out of initial sync must guarantee at least one oplog document is visible
+ // such that others can sync from this node. Oplog visibility is not rigorously advanced
+ // during initial sync. Correct the visibility to match the initial sync time before
+ // transitioning to steady state replication.
+ const bool orderedCommit = true;
+ _storage->oplogDiskLocRegister(
+ opCtx, lastApplied.getValue().opTime.getTimestamp(), orderedCommit);
_replicationProcess->getConsistencyMarkers()->clearInitialSyncFlag(opCtx);