diff options
-rw-r--r-- | src/mongo/db/storage/wiredtiger/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/SConscript b/src/mongo/db/storage/wiredtiger/SConscript index e48935e0345..779665c63a3 100644 --- a/src/mongo/db/storage/wiredtiger/SConscript +++ b/src/mongo/db/storage/wiredtiger/SConscript @@ -84,6 +84,7 @@ if wiredtiger: ], LIBDEPS_PRIVATE= [ 'oplog_stone_parameters', + '$BUILD_DIR/mongo/db/mongod_options', '$BUILD_DIR/mongo/db/snapshot_window_options', '$BUILD_DIR/mongo/db/storage/downgraded_unique_indexes', '$BUILD_DIR/mongo/db/storage/storage_repair_observer', diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index ef085de203c..73a69526842 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -62,6 +62,7 @@ #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/global_settings.h" #include "mongo/db/index/index_descriptor.h" +#include "mongo/db/mongod_options_storage_gen.h" #include "mongo/db/repl/repl_settings.h" #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/server_options.h" @@ -615,6 +616,13 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, _inRepairMode(repair), _readOnly(readOnly), _keepDataHistory(serverGlobalParams.enableMajorityReadConcern) { + // For queryable backup mode, if the 'recoverToOplogTimestamp' startup parameter is missing, + // then set the durable flag to false. This is the desired behavior to maintain backwards + // compatibility for versions of ops manager released prior to MongoDB 4.2.5. + if (_readOnly && recoverToOplogTimestamp.empty()) { + _durable = false; + } + boost::filesystem::path journalPath = path; journalPath /= "journal"; if (_durable) { @@ -669,6 +677,13 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, ss << WiredTigerExtensions::get(getGlobalServiceContext())->getOpenExtensionsConfig(); ss << extraOpenOptions; + // For queryable backup mode, if the 'recoverToOplogTimestamp' startup parameter is missing, + // then start WiredTiger is read only mode. This is the desired behavior to maintain backwards + // compatibility for versions of ops manager released prior to MongoDB 4.2.5. + if (_readOnly && recoverToOplogTimestamp.empty()) { + ss << ",readonly=true,"; + } + 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 |