diff options
author | Yu Jin Kang Park <yujin.kang@mongodb.com> | 2022-06-15 13:19:49 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-06 12:17:47 +0000 |
commit | 574d60b493f71e6433a784dc3a2a8fd3fed171a1 (patch) | |
tree | 0ec8447e2cf81fa33f7729f779afe649ab0f344f /src/mongo | |
parent | 02dfedb849374159219251422ada6035333e2c3b (diff) | |
download | mongo-574d60b493f71e6433a784dc3a2a8fd3fed171a1.tar.gz |
SERVER-55208: Remove nojournal,duroff and evergreen variant
Diffstat (limited to 'src/mongo')
36 files changed, 63 insertions, 280 deletions
diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp index 954761086b3..4c32e81f948 100644 --- a/src/mongo/db/mongod_main.cpp +++ b/src/mongo/db/mongod_main.cpp @@ -475,17 +475,6 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) { exitCleanly(EXIT_BADOPTIONS); } - // Disallow running WiredTiger with --nojournal in a replica set - if (storageGlobalParams.engine == "wiredTiger" && !storageGlobalParams.dur && - replSettings.usingReplSets()) { - LOGV2_ERROR( - 20535, - "Running wiredTiger without journaling in a replica set is not supported. Make sure " - "you are not using --nojournal and that storage.journal.enabled is not set to " - "'false'"); - exitCleanly(EXIT_BADOPTIONS); - } - if (storageGlobalParams.repair && replSettings.usingReplSets()) { LOGV2_ERROR(5019200, "Cannot specify both repair and replSet at the same time (remove --replSet to " diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 48099fb01e5..b528a315b62 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -161,11 +161,6 @@ Status validateMongodOptions(const moe::Environment& params) { return ret; } - if (params.count("nojournal") && params.count("storage.journal.enabled")) { - return Status(ErrorCodes::BadValue, - "Can't specify both --journal and --nojournal options."); - } - #ifdef _WIN32 if (params.count("install") || params.count("reinstall")) { if (params.count("storage.dbPath") && @@ -210,18 +205,6 @@ Status canonicalizeMongodOptions(moe::Environment* params) { return ret; } - if (params->count("nojournal")) { - Status ret = - params->set("storage.journal.enabled", moe::Value(!(*params)["nojournal"].as<bool>())); - if (!ret.isOK()) { - return ret; - } - ret = params->remove("nojournal"); - if (!ret.isOK()) { - return ret; - } - } - // "security.authorization" comes from the config file, so override it if "auth" is // set since those come from the command line. if (params->count("auth")) { @@ -447,14 +430,7 @@ Status storeMongodOptions(const moe::Environment& params) { storageGlobalParams.groupCollections = params["storage.groupCollections"].as<bool>(); } - if (params.count("storage.journal.enabled")) { - storageGlobalParams.dur = params["storage.journal.enabled"].as<bool>(); - } - if (params.count("storage.journal.commitIntervalMs")) { - // don't check if dur is false here as many will just use the default, and will default - // to off on win32. ie no point making life a little more complex by giving an error on - // a dev environment. auto journalCommitIntervalMs = params["storage.journal.commitIntervalMs"].as<int>(); storageGlobalParams.journalCommitIntervalMs.store(journalCommitIntervalMs); if (journalCommitIntervalMs < 1 || @@ -643,12 +619,6 @@ Status storeMongodOptions(const moe::Environment& params) { << "enableMajorityReadConcern=false", serverGlobalParams.enableMajorityReadConcern); - // If we haven't explicitly specified a journal option, default journaling to true for - // the config server role - if (!params.count("storage.journal.enabled")) { - storageGlobalParams.dur = true; - } - if (!params.count("storage.dbPath")) { storageGlobalParams.dbpath = storageGlobalParams.kDefaultConfigDbPath; } @@ -691,13 +661,6 @@ Status storeMongodOptions(const moe::Environment& params) { } #endif - // Check if we are 32 bit and have not explicitly specified any journaling options - if (sizeof(void*) == 4 && !params.count("storage.journal.enabled")) { - LOGV2_WARNING(20880, - "32-bit servers don't have journaling enabled by default. Please use " - "--journal if you want durability"); - } - bool isClusterRoleShard = params.count("shardsvr"); bool isClusterRoleConfig = params.count("configsvr"); if (params.count("sharding.clusterRole")) { diff --git a/src/mongo/db/mongod_options.h b/src/mongo/db/mongod_options.h index be4d70256cb..a218680bda7 100644 --- a/src/mongo/db/mongod_options.h +++ b/src/mongo/db/mongod_options.h @@ -69,8 +69,7 @@ Status validateMongodOptions(const moe::Environment& params); /** * Canonicalize mongod options for the given environment. * - * For example, the options "dur", "nodur", "journal", "nojournal", and - * "storage.journaling.enabled" should all be merged into "storage.journaling.enabled". + * For example, "nounixsocket" maps to "net.unixDomainSocket.enabled". */ Status canonicalizeMongodOptions(moe::Environment* params); diff --git a/src/mongo/db/mongod_options_sharding.idl b/src/mongo/db/mongod_options_sharding.idl index f8da615ed84..88213fe5498 100644 --- a/src/mongo/db/mongod_options_sharding.idl +++ b/src/mongo/db/mongod_options_sharding.idl @@ -40,7 +40,7 @@ configs: description: 'Declare this is a config db of a cluster; default port 27019; default dir /data/configdb' arg_vartype: Switch source: [ cli, ini ] - conflicts: [ shardsvr, nojournal ] + conflicts: [ shardsvr ] shardsvr: description: 'Declare this is a shard db of a cluster; default port 27018' arg_vartype: Switch diff --git a/src/mongo/db/mongod_options_storage.idl b/src/mongo/db/mongod_options_storage.idl index 59d4d0cd8e7..b1c3e041ad4 100644 --- a/src/mongo/db/mongod_options_storage.idl +++ b/src/mongo/db/mongod_options_storage.idl @@ -119,18 +119,6 @@ configs: arg_vartype: Switch source: [ cli, ini ] - 'storage.journal.enabled': - description: 'Enable journaling' - short_name: journal - deprecated_short_name: dur - arg_vartype: Switch - - nojournal: - description: 'Disable journaling (journaling is on by default for 64 bit)' - deprecated_short_name: nodur - arg_vartype: Switch - source: [ cli, ini ] - 'storage.oplogMinRetentionHours': description: 'Minimum number of hours to preserve in the oplog. Default is 0 (turned off). Fractions are allowed (e.g. 1.5 hours)' short_name: oplogMinRetentionHours diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp index d897241134b..5eed8504f83 100644 --- a/src/mongo/db/repl/oplog_applier_impl.cpp +++ b/src/mongo/db/repl/oplog_applier_impl.cpp @@ -262,9 +262,9 @@ void OplogApplierImpl::_run(OplogBuffer* oplogBuffer) { invariant(!_replCoord->getMemberState().arbiter()); std::unique_ptr<ApplyBatchFinalizer> finalizer{ - getGlobalServiceContext()->getStorageEngine()->isDurable() - ? new ApplyBatchFinalizerForJournal(_replCoord) - : new ApplyBatchFinalizer(_replCoord)}; + getGlobalServiceContext()->getStorageEngine()->isEphemeral() + ? new ApplyBatchFinalizer(_replCoord) + : new ApplyBatchFinalizerForJournal(_replCoord)}; while (true) { // Exits on message from OplogBatcher. // Use a new operation context each iteration, as otherwise we may appear to use a single diff --git a/src/mongo/db/repl/replication_consistency_markers_impl.cpp b/src/mongo/db/repl/replication_consistency_markers_impl.cpp index c831d6b31da..dbaddbe09cc 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl.cpp @@ -170,7 +170,7 @@ void ReplicationConsistencyMarkersImpl::clearInitialSyncFlag(OperationContext* o "Clearing the truncate point while primary is unsafe: it is asynchronously updated."); setOplogTruncateAfterPoint(opCtx, Timestamp()); - if (getGlobalServiceContext()->getStorageEngine()->isDurable()) { + if (!getGlobalServiceContext()->getStorageEngine()->isEphemeral()) { JournalFlusher::get(opCtx)->waitForJournalFlush(); replCoord->setMyLastDurableOpTimeAndWallTime(opTimeAndWallTime); } diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 9e44ce2d034..0ea77cb39bc 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -4892,7 +4892,7 @@ ReplicationCoordinatorImpl::_setCurrentRSConfig(WithLock lk, } } - // Warn if using the in-memory (ephemeral) storage engine or running running --nojournal with + // Warn if using the in-memory (ephemeral) storage engine with // writeConcernMajorityJournalDefault=true. StorageEngine* storageEngine = opCtx->getServiceContext()->getStorageEngine(); if (storageEngine && newConfig.getWriteConcernMajorityShouldJournal() && @@ -4925,33 +4925,6 @@ ReplicationCoordinatorImpl::_setCurrentRSConfig(WithLock lk, {logv2::LogTag::kStartupWarnings}, "** available free RAM is exhausted."); LOGV2_OPTIONS(21386, {logv2::LogTag::kStartupWarnings}, ""); - } else if (!storageEngine->isDurable()) { - LOGV2_OPTIONS(21369, {logv2::LogTag::kStartupWarnings}, ""); - LOGV2_OPTIONS( - 21370, - {logv2::LogTag::kStartupWarnings}, - "** WARNING: This replica set node is running without journaling enabled but the "); - LOGV2_OPTIONS( - 21371, - {logv2::LogTag::kStartupWarnings}, - "** writeConcernMajorityJournalDefault option to the replica set config "); - LOGV2_OPTIONS(21372, - {logv2::LogTag::kStartupWarnings}, - "** is set to true. The writeConcernMajorityJournalDefault "); - LOGV2_OPTIONS(21373, - {logv2::LogTag::kStartupWarnings}, - "** option to the replica set config must be set to false "); - LOGV2_OPTIONS(21374, - {logv2::LogTag::kStartupWarnings}, - "** or w:majority write concerns will never complete."); - LOGV2_OPTIONS( - 21375, - {logv2::LogTag::kStartupWarnings}, - "** In addition, this node's memory consumption may increase until all"); - LOGV2_OPTIONS(21376, - {logv2::LogTag::kStartupWarnings}, - "** available free RAM is exhausted."); - LOGV2_OPTIONS(21377, {logv2::LogTag::kStartupWarnings}, ""); } } diff --git a/src/mongo/db/startup_warnings_mongod.cpp b/src/mongo/db/startup_warnings_mongod.cpp index d1973e06866..fcd20f10430 100644 --- a/src/mongo/db/startup_warnings_mongod.cpp +++ b/src/mongo/db/startup_warnings_mongod.cpp @@ -146,12 +146,7 @@ void logMongodStartupWarnings(const StorageGlobalParams& storageParams, 22152, {logv2::LogTag::kStartupWarnings}, "This is a 32 bit MongoDB binary. 32 bit builds are limited to less than 2GB " - "of data (or less with --journal). See http://dochub.mongodb.org/core/32bit"); - if (!storageParams.dur) { - LOGV2_WARNING_OPTIONS(22154, - {logv2::LogTag::kStartupWarnings}, - "Journaling defaults to off for 32 bit and is currently off"); - } + "of data. See http://dochub.mongodb.org/core/32bit"); } #ifdef __linux__ @@ -218,18 +213,15 @@ void logMongodStartupWarnings(const StorageGlobalParams& storageParams, } } - if (storageParams.dur) { - std::fstream f("/proc/sys/vm/overcommit_memory", ios_base::in); - unsigned val; - f >> val; + std::fstream f("/proc/sys/vm/overcommit_memory", ios_base::in); + unsigned val; + f >> val; - if (val == 2) { - LOGV2_OPTIONS( - 22171, - {logv2::LogTag::kStartupWarnings}, - "Journaling works best if /proc/sys/vm/overcommit_memory is set to 0 or 1", - "currentValue"_attr = val); - } + if (val == 2) { + LOGV2_OPTIONS(22171, + {logv2::LogTag::kStartupWarnings}, + "Journaling works best if /proc/sys/vm/overcommit_memory is set to 0 or 1", + "currentValue"_attr = val); } if (boost::filesystem::exists("/proc/sys/vm/zone_reclaim_mode")) { diff --git a/src/mongo/db/storage/control/storage_control.cpp b/src/mongo/db/storage/control/storage_control.cpp index c5a0706f3da..fc5534bec69 100644 --- a/src/mongo/db/storage/control/storage_control.cpp +++ b/src/mongo/db/storage/control/storage_control.cpp @@ -70,17 +70,13 @@ void startStorageControls(ServiceContext* serviceContext, bool forTestOnly) { // Ephemeral engines are not durable -- waitUntilDurable() returns early -- but frequent updates // to replication's JournalListener in the waitUntilDurable() code may help update replication // timestamps more quickly. - // - // (Note: the ephemeral engine returns false for isDurable(), so we must be careful not to - // disable it.) if (journalFlusherPaused) { // This is a restart and the JournalListener was paused. Resume the existing JournalFlusher. JournalFlusher::get(serviceContext)->resume(); journalFlusherPaused = false; } else { std::unique_ptr<JournalFlusher> journalFlusher = std::make_unique<JournalFlusher>( - /*disablePeriodicFlushes*/ forTestOnly || - (!storageEngine->isDurable() && !storageEngine->isEphemeral())); + /*disablePeriodicFlushes*/ forTestOnly); journalFlusher->go(); JournalFlusher::set(serviceContext, std::move(journalFlusher)); } diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h index 1b7941eca4b..f0a2dddfa14 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.h +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h @@ -116,13 +116,6 @@ public: return false; } - /** - * devnull does no journaling, so don't report the engine as durable. - */ - virtual bool isDurable() const { - return false; - } - virtual bool isEphemeral() const { return true; } diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp index 46298a87a78..47797efdf48 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp @@ -115,9 +115,7 @@ public: Status repairIdent(OperationContext* opCtx, StringData ident) override { return Status::OK(); } - bool isDurable() const override { - return false; - } + bool isEphemeral() const override { return false; } diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h index 01bb7560151..bca7f550d94 100644 --- a/src/mongo/db/storage/kv/kv_engine.h +++ b/src/mongo/db/storage/kv/kv_engine.h @@ -241,8 +241,6 @@ public: virtual void checkpoint() {} - virtual bool isDurable() const = 0; - /** * Returns true if the KVEngine is ephemeral -- that is, it is NOT persistent and all data is * lost after shutdown. Otherwise, returns false. diff --git a/src/mongo/db/storage/recovery_unit.h b/src/mongo/db/storage/recovery_unit.h index 04101ad66dc..69c36f320a3 100644 --- a/src/mongo/db/storage/recovery_unit.h +++ b/src/mongo/db/storage/recovery_unit.h @@ -203,7 +203,7 @@ public: /** * Waits until all commits that happened before this call are durable in the journal. Returns * true, unless the storage engine cannot guarantee durability, which should never happen when - * isDurable() returned true. This cannot be called from inside a unit of work, and should + * the engine is non-ephemeral. This cannot be called from inside a unit of work, and should * fail if it is. This method invariants if the caller holds any locks, except for repair. * * Can throw write interruption errors from the JournalListener. diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h index 03be00aa626..1fe8ed0ee39 100644 --- a/src/mongo/db/storage/storage_engine.h +++ b/src/mongo/db/storage/storage_engine.h @@ -207,11 +207,6 @@ public: virtual bool supportsCappedCollections() const = 0; /** - * Returns whether the engine supports a journalling concept or not. - */ - virtual bool isDurable() const = 0; - - /** * Returns true if the engine does not persist data to disk; false otherwise. */ virtual bool isEphemeral() const = 0; diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp index 3465e9addf4..664a90219bc 100644 --- a/src/mongo/db/storage/storage_engine_impl.cpp +++ b/src/mongo/db/storage/storage_engine_impl.cpp @@ -945,10 +945,6 @@ StatusWith<std::deque<std::string>> StorageEngineImpl::extendBackupCursor(Operat return _engine->extendBackupCursor(opCtx); } -bool StorageEngineImpl::isDurable() const { - return _engine->isDurable(); -} - bool StorageEngineImpl::isEphemeral() const { return _engine->isEphemeral(); } diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h index 6d9e308402a..d38021ab2d0 100644 --- a/src/mongo/db/storage/storage_engine_impl.h +++ b/src/mongo/db/storage/storage_engine_impl.h @@ -101,8 +101,6 @@ public: virtual StatusWith<std::deque<std::string>> extendBackupCursor( OperationContext* opCtx) override; - virtual bool isDurable() const override; - virtual bool isEphemeral() const override; virtual Status repairRecordStore(OperationContext* opCtx, diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h index 0591fbca9ad..a7a7078384a 100644 --- a/src/mongo/db/storage/storage_engine_mock.h +++ b/src/mongo/db/storage/storage_engine_mock.h @@ -47,9 +47,7 @@ public: bool supportsCappedCollections() const final { return true; } - bool isDurable() const final { - return false; - } + bool isEphemeral() const final { return true; } diff --git a/src/mongo/db/storage/storage_options.cpp b/src/mongo/db/storage/storage_options.cpp index ca2d9de84dc..3736cd69316 100644 --- a/src/mongo/db/storage/storage_options.cpp +++ b/src/mongo/db/storage/storage_options.cpp @@ -49,9 +49,6 @@ void StorageGlobalParams::reset() { repair = false; restore = false; - // The intention here is to enable the journal by default if we are running on a 64 bit system. - dur = (sizeof(void*) == 8); - noTableScan.store(false); directoryperdb = false; syncdelay = 60.0; diff --git a/src/mongo/db/storage/storage_options.h b/src/mongo/db/storage/storage_options.h index 108ae66629c..c10b71a25aa 100644 --- a/src/mongo/db/storage/storage_options.h +++ b/src/mongo/db/storage/storage_options.h @@ -80,8 +80,6 @@ struct StorageGlobalParams { // entries for collections not restored and more. bool restore; - bool dur; // --dur durability (now --journal) - // Whether the Storage Engine selected should be ephemeral in nature or not. bool ephemeral = false; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp index 6277a27f62e..63eebef295f 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp @@ -125,7 +125,6 @@ public: wiredTigerGlobalOptions.engineConfig, cacheMB, wiredTigerGlobalOptions.getMaxHistoryFileSizeMB(), - params.dur, params.ephemeral, params.repair); kv->setRecordStoreExtraOptions(wiredTigerGlobalOptions.collectionConfig); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 419ac09ffa5..472e1225d5a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -304,7 +304,6 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, const std::string& extraOpenOptions, size_t cacheSizeMB, size_t maxHistoryFileSizeMB, - bool durable, bool ephemeral, bool repair) : _clockSource(cs), @@ -312,14 +311,13 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, _canonicalName(canonicalName), _path(path), _sizeStorerSyncTracker(cs, 100000, Seconds(60)), - _durable(durable), _ephemeral(ephemeral), _inRepairMode(repair), _keepDataHistory(serverGlobalParams.enableMajorityReadConcern) { _pinnedOplogTimestamp.store(Timestamp::max().asULL()); boost::filesystem::path journalPath = path; journalPath /= "journal"; - if (_durable) { + if (!_ephemeral) { if (!boost::filesystem::exists(journalPath)) { try { boost::filesystem::create_directory(journalPath); @@ -356,13 +354,19 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, ss << "cache_cursors=false,"; } - // The setting may have a later setting override it if not using the journal. We make it - // unconditional here because even nojournal may need this setting if it is a transition - // from using the journal. - ss << "log=(enabled=true,remove=true,path=journal,compressor="; - ss << wiredTigerGlobalOptions.journalCompressor << "),"; - ss << "builtin_extension_config=(zstd=(compression_level=" - << wiredTigerGlobalOptions.zstdCompressorLevel << ")),"; + if (_ephemeral) { + // If we've requested an ephemeral instance we store everything into memory instead of + // backing it onto disk. Logging is not supported in this instance, thus we also have to + // disable it. + ss << ",in_memory=true,log=(enabled=false),"; + } else { + // In persistent mode we enable the journal and set the compression settings. + ss << "log=(enabled=true,remove=true,path=journal,compressor="; + ss << wiredTigerGlobalOptions.journalCompressor << "),"; + ss << "builtin_extension_config=(zstd=(compression_level=" + << wiredTigerGlobalOptions.zstdCompressorLevel << ")),"; + } + ss << "file_manager=(close_idle_time=" << gWiredTigerFileHandleCloseIdleTime << ",close_scan_interval=" << gWiredTigerFileHandleCloseScanInterval << ",close_handle_minimum=" << gWiredTigerFileHandleCloseMinimum << "),"; @@ -423,60 +427,10 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, ss << WiredTigerExtensions::get(getGlobalServiceContext())->getOpenExtensionsConfig(); ss << extraOpenOptions; - if (!_durable) { - // If we started without the journal, but previously used the journal then open with the - // WT log enabled to perform any unclean shutdown recovery and then close and reopen in - // the normal path without the journal. - if (boost::filesystem::exists(journalPath)) { - string config = ss.str(); - auto start = Date_t::now(); - LOGV2(22313, - "Detected WT journal files. Running recovery from last checkpoint. journal to " - "nojournal transition config", - "config"_attr = config); - int ret = wiredtiger_open( - path.c_str(), _eventHandler.getWtEventHandler(), config.c_str(), &_conn); - LOGV2(4795911, "Recovery complete", "duration"_attr = Date_t::now() - start); - if (ret == EINVAL) { - fassertFailedNoTrace(28717); - } else if (ret != 0) { - Status s(wtRCToStatus(ret, nullptr)); - msgasserted(28718, s.reason()); - } - start = Date_t::now(); - invariantWTOK(_conn->close(_conn, nullptr), nullptr); - LOGV2(4795910, - "WiredTiger closed. Removing journal files", - "duration"_attr = Date_t::now() - start); - // After successful recovery, remove the journal directory. - try { - start = Date_t::now(); - boost::filesystem::remove_all(journalPath); - } catch (std::exception& e) { - LOGV2_ERROR(22355, - "error removing journal dir {directory} {error}", - "Error removing journal directory", - "directory"_attr = journalPath.generic_string(), - "error"_attr = e.what(), - "duration"_attr = Date_t::now() - start); - throw; - } - LOGV2(4795908, "Journal files removed", "duration"_attr = Date_t::now() - start); - } - // This setting overrides the earlier setting because it is later in the config string. - ss << ",log=(enabled=false),"; - } - if (WiredTigerUtil::willRestoreFromBackup()) { ss << WiredTigerUtil::generateRestoreConfig() << ","; } - // If we've requested an ephemeral instance we store everything into memory instead of backing - // it onto disk. Logging is not supported in this instance, thus we also have to disable it. - if (_ephemeral) { - ss << "in_memory=true,log=(enabled=false),"; - } - string config = ss.str(); LOGV2(22315, "Opening WiredTiger", "config"_attr = config); auto startTime = Date_t::now(); @@ -957,8 +911,8 @@ void WiredTigerKVEngine::flushAllFiles(OperationContext* opCtx, bool callerHolds // operations such as backup, it's imperative that we copy the most up-to-date data files. syncSizeInfo(true); - // If there's no journal, we must checkpoint all of the data. - WiredTigerSessionCache::Fsync fsyncType = _durable + // If there's no journal (ephemeral), we must checkpoint all of the data. + WiredTigerSessionCache::Fsync fsyncType = !_ephemeral ? WiredTigerSessionCache::Fsync::kCheckpointStableTimestamp : WiredTigerSessionCache::Fsync::kCheckpointAll; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index e0db1f3a387..748ec6c4c1d 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -107,7 +107,6 @@ public: const std::string& extraOpenOptions, size_t cacheSizeMB, size_t maxHistoryFileSizeMB, - bool durable, bool ephemeral, bool repair); @@ -122,10 +121,6 @@ public: void checkpoint() override; - bool isDurable() const override { - return _durable; - } - bool isEphemeral() const override { return _ephemeral; } @@ -483,8 +478,6 @@ private: std::unique_ptr<WiredTigerSizeStorer> _sizeStorer; std::string _sizeStorerUri; mutable ElapsedTracker _sizeStorerSyncTracker; - - bool _durable; bool _ephemeral; // whether we are using the in-memory mode of the WT engine const bool _inRepairMode; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp index e505a961112..ff3350eea0d 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp @@ -100,7 +100,6 @@ private: extraStrings, 1, 0, - true, false, _forRepair); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp index 79737d7ab4e..df5258c462f 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp @@ -49,7 +49,6 @@ WiredTigerHarnessHelper::WiredTigerHarnessHelper(Options options, StringData ext _testLoggingSettings(extraStrings.toString()), 1, 0, - true, false, false) { repl::ReplicationCoordinator::set( diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp index 6b5294edf39..ee6609e710b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp @@ -58,7 +58,6 @@ public: "", // .extraOpenOptions 1, // .cacheSizeMB 0, // .maxCacheOverflowFileSizeMB - false, // .durable false, // .ephemeral false // .repair ) { @@ -176,7 +175,7 @@ public: private: const char* wt_uri = "table:prepare_transaction"; - const char* wt_config = "key_format=S,value_format=S"; + const char* wt_config = "key_format=S,value_format=S,log=(enabled=false)"; }; TEST_F(WiredTigerRecoveryUnitTestFixture, SetReadSource) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp index 023a4f0abf7..e1db19aa708 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp @@ -282,13 +282,13 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx, // WT_CONNECTION, i.e: replication is on) requires `forceCheckpoint` to be true and journaling // to be enabled. if (syncType == Fsync::kCheckpointStableTimestamp && getGlobalReplSettings().usingReplSets()) { - invariant(_engine->isDurable()); + invariant(!isEphemeral()); } // When forcing a checkpoint with journaling enabled, don't synchronize with other // waiters, as a log flush is much cheaper than a full checkpoint. if ((syncType == Fsync::kCheckpointStableTimestamp || syncType == Fsync::kCheckpointAll) && - _engine->isDurable()) { + !isEphemeral()) { UniqueWiredTigerSession session = getSession(); WT_SESSION* s = session->getSession(); { @@ -357,7 +357,7 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx, } // Use the journal when available, or a checkpoint otherwise. - if (_engine && _engine->isDurable()) { + if (!isEphemeral()) { invariantWTOK(_waitUntilDurableSession->log_flush(_waitUntilDurableSession, "sync=on"), _waitUntilDurableSession); LOGV2_DEBUG(22419, 4, "flushed journal"); diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp index a0255dc5aa6..1d40287112f 100644 --- a/src/mongo/db/write_concern.cpp +++ b/src/mongo/db/write_concern.cpp @@ -167,7 +167,7 @@ StatusWith<WriteConcernOptions> extractWriteConcern(OperationContext* opCtx, Status validateWriteConcern(OperationContext* opCtx, const WriteConcernOptions& writeConcern) { if (writeConcern.syncMode == WriteConcernOptions::SyncMode::JOURNAL && - !opCtx->getServiceContext()->getStorageEngine()->isDurable()) { + opCtx->getServiceContext()->getStorageEngine()->isEphemeral()) { return Status(ErrorCodes::BadValue, "cannot use 'j' option when a host does not have journaling enabled"); } @@ -291,9 +291,7 @@ Status waitForWriteConcern(OperationContext* opCtx, break; case WriteConcernOptions::SyncMode::FSYNC: { waitForNoOplogHolesIfNeeded(opCtx); - if (!storageEngine->isDurable()) { - storageEngine->flushAllFiles(opCtx, /*callerHoldsReadLock*/ false); - + if (!storageEngine->isEphemeral()) { // This field has had a dummy value since MMAP went away. It is undocumented. // Maintaining it so as not to cause unnecessary user pain across upgrades. result->fsyncFiles = 1; diff --git a/src/mongo/dbtests/framework_options.idl b/src/mongo/dbtests/framework_options.idl index e84811a5f71..94f170f83aa 100644 --- a/src/mongo/dbtests/framework_options.idl +++ b/src/mongo/dbtests/framework_options.idl @@ -62,12 +62,6 @@ configs: description: Verbose arg_vartype: Switch single_name: v - dur: - description: 'Enable journaling (currently the default)' - arg_vartype: Switch - nodur: - description: 'Disable journaling' - arg_vartype: Switch seed: description: 'Random number seed' arg_vartype: UnsignedLongLong diff --git a/src/mongo/embedded/embedded_options.h b/src/mongo/embedded/embedded_options.h index 0c188efcd6d..efd05e93095 100644 --- a/src/mongo/embedded/embedded_options.h +++ b/src/mongo/embedded/embedded_options.h @@ -41,8 +41,8 @@ Status addOptions(optionenvironment::OptionSection* options); /** * Canonicalize options for the given environment. * - * For example, the options "dur", "nodur", "journal", "nojournal", and - * "storage.journaling.enabled" should all be merged into "storage.journaling.enabled". + * For example, "--verbose" string argument and the "-vvvv" argument. + * */ Status canonicalizeOptions(optionenvironment::Environment* params); diff --git a/src/mongo/s/mongos_options.h b/src/mongo/s/mongos_options.h index a827d04550d..538f82bd965 100644 --- a/src/mongo/s/mongos_options.h +++ b/src/mongo/s/mongos_options.h @@ -75,8 +75,8 @@ Status validateMongosOptions(const moe::Environment& params); /** * Canonicalize mongos options for the given environment. * - * For example, the options "dur", "nodur", "journal", "nojournal", and - * "storage.journaling.enabled" should all be merged into "storage.journaling.enabled". + * For example, the options "noscripting" and "security.javascriptEnabled" and should all be merged + * into "security.javascriptEnabled". */ Status canonicalizeMongosOptions(moe::Environment* params); diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 3b763b6ec26..5dd402a89d7 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -231,24 +231,14 @@ var ReplSetTest = function(opts) { */ function _isRunningWithoutJournaling(conn) { var result = asCluster(conn, function() { + // Persistent storage engines (WT) can only run with journal enabled. var serverStatus = assert.commandWorked(conn.adminCommand({serverStatus: 1})); if (serverStatus.storageEngine.hasOwnProperty('persistent')) { - if (!serverStatus.storageEngine.persistent) { - return true; + if (serverStatus.storageEngine.persistent) { + return false; } - } else if (serverStatus.storageEngine.name == 'inMemory') { - return true; } - var cmdLineOpts = assert.commandWorked(conn.adminCommand({getCmdLineOpts: 1})); - var getWithDefault = function(dict, key, dflt) { - if (dict[key] === undefined) - return dflt; - return dict[key]; - }; - return !getWithDefault( - getWithDefault(getWithDefault(cmdLineOpts.parsed, "storage", {}), "journal", {}), - "enabled", - true); + return true; }); return result; } diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index c48527ba68f..c31bc887c69 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -331,7 +331,6 @@ MongoRunner.logicalOptions = { noReplSet: true, forgetPort: true, arbiter: true, - noJournal: true, binVersion: true, waitForConnect: true, bridgeOptions: true, @@ -666,7 +665,6 @@ var _removeSetParameterIfBeforeVersion = function( * useLogFiles {boolean}: use with logFile option. * logFile {string}: path to the log file. If not specified and useLogFiles * is true, automatically creates a log file inside dbpath. - * noJournal {boolean} * keyFile * replSet * oplogSize @@ -716,11 +714,6 @@ MongoRunner.mongodOptions = function(opts = {}) { opts.logpath = opts.logFile; } - if ((jsTestOptions().noJournal || opts.noJournal) && !('journal' in opts) && - !('configsvr' in opts)) { - opts.nojournal = ""; - } - if (jsTestOptions().keyFile && !opts.keyFile) { opts.keyFile = jsTestOptions().keyFile; } diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 08ffea17f3c..465ee647492 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -1090,7 +1090,6 @@ var ShardingTest = function(params) { // Allow specifying mixed-type options like this: // { mongos : [ { bind_ip : "localhost" } ], - // config : [ { nojournal : "" } ], // shards : { rs : true, d : true } } if (Array.isArray(numShards)) { for (var i = 0; i < numShards.length; i++) { @@ -1328,7 +1327,6 @@ var ShardingTest = function(params) { var startOptions = { pathOpts: pathOpts, // Ensure that journaling is always enabled for config servers. - journal: "", configsvr: "", storageEngine: "wiredTiger", }; diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index 81c40af4820..d7b01ba7c5b 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -328,7 +328,6 @@ jsTestOptions = function() { wiredTigerEngineConfigString: TestData.wiredTigerEngineConfigString, wiredTigerCollectionConfigString: TestData.wiredTigerCollectionConfigString, wiredTigerIndexConfigString: TestData.wiredTigerIndexConfigString, - noJournal: TestData.noJournal, auth: TestData.auth, // Note: keyFile is also used as a flag to indicate cluster auth is turned on, set it // to a truthy value if you'd like to do cluster auth, even if it's not keyFile auth. diff --git a/src/mongo/watchdog/watchdog_mongod.cpp b/src/mongo/watchdog/watchdog_mongod.cpp index 617ec245bc6..9b423069b87 100644 --- a/src/mongo/watchdog/watchdog_mongod.cpp +++ b/src/mongo/watchdog/watchdog_mongod.cpp @@ -156,22 +156,19 @@ void startWatchdog(ServiceContext* service) { checks.push_back(std::move(dataCheck)); - // Add a check for the journal if it is not disabled - if (storageGlobalParams.dur) { - auto journalDirectory = boost::filesystem::path(storageGlobalParams.dbpath); - journalDirectory /= "journal"; - - if (boost::filesystem::exists(journalDirectory)) { - auto journalCheck = std::make_unique<DirectoryCheck>(journalDirectory); - - checks.push_back(std::move(journalCheck)); - } else { - LOGV2_WARNING(23835, - "Watchdog is skipping check for journal directory since it does not " - "exist: '{journalDirectory_generic_string}'", - "journalDirectory_generic_string"_attr = - journalDirectory.generic_string()); - } + // Check for the journal. + auto journalDirectory = boost::filesystem::path(storageGlobalParams.dbpath); + journalDirectory /= "journal"; + + if (boost::filesystem::exists(journalDirectory)) { + auto journalCheck = std::make_unique<DirectoryCheck>(journalDirectory); + + checks.push_back(std::move(journalCheck)); + } else { + LOGV2_WARNING(23835, + "Watchdog is skipping check for journal directory since it does not " + "exist: '{journalDirectory_generic_string}'", + "journalDirectory_generic_string"_attr = journalDirectory.generic_string()); } // If the user specified a log path, also monitor that directory. |