summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
authorJason Chan <jason.chan@10gen.com>2019-06-25 10:10:29 -0400
committerJason Chan <jason.chan@10gen.com>2019-07-02 14:37:12 -0400
commit324f6029326bc01d3adcd17a2467c49887147660 (patch)
treedd14ebd7766ee77adf7eb2974d04b52849290383 /src/mongo/db/db.cpp
parentf93894b2307f7eec7cdc0b53d3ac58f971837328 (diff)
downloadmongo-324f6029326bc01d3adcd17a2467c49887147660.tar.gz
SERVER-40009 Honor the initial sync flag when in startup without FCV document
(cherry picked from commit c0c64c95637f8f0700ac40e89dc39c30ec6f5f41)
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index fe38d29d61d..e6dd1dc014d 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -422,11 +422,20 @@ ExitCode _initAndListen(int listenPort) {
exitCleanly(EXIT_NEED_DOWNGRADE);
}
+ auto replProcess = repl::ReplicationProcess::get(serviceContext);
+ invariant(replProcess);
+ const bool initialSyncFlag =
+ replProcess->getConsistencyMarkers()->getInitialSyncFlag(startupOpCtx.get());
+
// Assert that the in-memory featureCompatibilityVersion parameter has been explicitly set. If
// we are part of a replica set and are started up with no data files, we do not set the
// featureCompatibilityVersion until a primary is chosen. For this case, we expect the in-memory
- // featureCompatibilityVersion parameter to still be uninitialized until after startup.
- if (canCallFCVSetIfCleanStartup && (!replSettings.usingReplSets() || nonLocalDatabases)) {
+ // featureCompatibilityVersion parameter to still be uninitialized until after startup. If the
+ // initial sync flag is set and we are part of a replica set, we expect the version to be
+ // initialized as part of initial sync after startup.
+ const bool initializeFCVAtInitialSync = replSettings.usingReplSets() && initialSyncFlag;
+ if (canCallFCVSetIfCleanStartup && (!replSettings.usingReplSets() || nonLocalDatabases) &&
+ !initializeFCVAtInitialSync) {
invariant(serverGlobalParams.featureCompatibility.isVersionInitialized());
}