summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-03-13 17:25:57 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-03-13 17:25:57 -0400
commit06ec8a65d702e013c8dd70795d29342b1198cd15 (patch)
tree7e06ab61fc6dbf01596f5de48bdc615b0a254ece
parent88053febad75e48bb5ec7120f96edc0c17fb1402 (diff)
downloadmongo-r4.2.5-rc0.tar.gz
SERVER-46858 Start WT in read only mode if the 'recoverToOplogTimestamp' flag is missing for queryable backupr4.2.5-rc0
-rw-r--r--src/mongo/db/storage/wiredtiger/SConscript1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp15
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