From ae47641690c8ff75bd0b729d28d705eacdb84c9d Mon Sep 17 00:00:00 2001 From: Gregory Noma Date: Fri, 16 Oct 2020 15:03:42 -0400 Subject: SERVER-45992 Skip nojournal warning when starting up with inMemory storage engine and writeConcernMajorityJournalDefault=true (cherry picked from commit 8d91cd9f7887b3b2c44243b6230e676f32fb37a2) --- src/mongo/db/repl/replication_coordinator_impl.cpp | 83 +++++++++++----------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 81c763654eb..9aeb0a14ba9 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -3026,47 +3026,50 @@ ReplicationCoordinatorImpl::_setCurrentRSConfig_inlock(OperationContext* opCtx, log() << "** in a future version." << startupWarningsLog; } - // Warn if running --nojournal and writeConcernMajorityJournalDefault = true + // Warn if using the in-memory (ephemeral) storage engine or running running --nojournal with + // writeConcernMajorityJournalDefault=true. StorageEngine* storageEngine = opCtx->getServiceContext()->getStorageEngine(); - if (storageEngine && !storageEngine->isDurable() && - (newConfig.getWriteConcernMajorityShouldJournal() && - (!oldConfig.isInitialized() || !oldConfig.getWriteConcernMajorityShouldJournal()))) { - log() << startupWarningsLog; - log() << "** WARNING: This replica set node is running without journaling enabled but the " - << startupWarningsLog; - log() << "** writeConcernMajorityJournalDefault option to the replica set config " - << startupWarningsLog; - log() << "** is set to true. The writeConcernMajorityJournalDefault " - << startupWarningsLog; - log() << "** option to the replica set config must be set to false " - << startupWarningsLog; - log() << "** or w:majority write concerns will never complete." - << startupWarningsLog; - log() << "** In addition, this node's memory consumption may increase until all" - << startupWarningsLog; - log() << "** available free RAM is exhausted." << startupWarningsLog; - log() << startupWarningsLog; - } - - // Warn if using the in-memory (ephemeral) storage engine with - // writeConcernMajorityJournalDefault = true - if (storageEngine && storageEngine->isEphemeral() && - (newConfig.getWriteConcernMajorityShouldJournal() && - (!oldConfig.isInitialized() || !oldConfig.getWriteConcernMajorityShouldJournal()))) { - log() << startupWarningsLog; - log() << "** WARNING: This replica set node is using in-memory (ephemeral) storage with the" - << startupWarningsLog; - log() << "** writeConcernMajorityJournalDefault option to the replica set config " - << startupWarningsLog; - log() << "** set to true. The writeConcernMajorityJournalDefault option to the " - << startupWarningsLog; - log() << "** replica set config must be set to false " << startupWarningsLog; - log() << "** or w:majority write concerns will never complete." - << startupWarningsLog; - log() << "** In addition, this node's memory consumption may increase until all" - << startupWarningsLog; - log() << "** available free RAM is exhausted." << startupWarningsLog; - log() << startupWarningsLog; + if (storageEngine && newConfig.getWriteConcernMajorityShouldJournal() && + (!oldConfig.isInitialized() || !oldConfig.getWriteConcernMajorityShouldJournal())) { + if (storageEngine->isEphemeral()) { + log() << startupWarningsLog; + log() << "** WARNING: This replica set node is using in-memory (ephemeral) storage " + "with the" + << startupWarningsLog; + log() << "** writeConcernMajorityJournalDefault option to the replica set " + "config " + << startupWarningsLog; + log() + << "** set to true. The writeConcernMajorityJournalDefault option to the " + << startupWarningsLog; + log() << "** replica set config must be set to false " << startupWarningsLog; + log() << "** or w:majority write concerns will never complete." + << startupWarningsLog; + log() + << "** In addition, this node's memory consumption may increase until all" + << startupWarningsLog; + log() << "** available free RAM is exhausted." << startupWarningsLog; + log() << startupWarningsLog; + } else if (!storageEngine->isDurable()) { + log() << startupWarningsLog; + log() << "** WARNING: This replica set node is running without journaling enabled but " + "the " + << startupWarningsLog; + log() << "** writeConcernMajorityJournalDefault option to the replica set " + "config " + << startupWarningsLog; + log() << "** is set to true. The writeConcernMajorityJournalDefault " + << startupWarningsLog; + log() << "** option to the replica set config must be set to false " + << startupWarningsLog; + log() << "** or w:majority write concerns will never complete." + << startupWarningsLog; + log() + << "** In addition, this node's memory consumption may increase until all" + << startupWarningsLog; + log() << "** available free RAM is exhausted." << startupWarningsLog; + log() << startupWarningsLog; + } } log() << "New replica set config in use: " << _rsConfig.toBSON() << rsLog; -- cgit v1.2.1