summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2021-03-30 11:35:21 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-13 16:01:43 +0000
commit673ec7c2e11cbdeb41b440351e7634b5f39fa745 (patch)
treeca9704465c2651aa8079f74bb815cffd48d049f3
parent8f37e1305d45230ae04a683f7b9dff56bd2e98ed (diff)
downloadmongo-673ec7c2e11cbdeb41b440351e7634b5f39fa745.tar.gz
SERVER-55602 Relax non-read-only invariant in WiredTigerKVEngine::makeTemporaryRecordStore when recoverToOplogTimestamp is specified
(cherry picked from commit 983c288a4c4e16c762e2f5b66643389e0b65c0af)
-rw-r--r--jstests/replsets/standalone_recover_to_oplog_timestamp.js6
-rw-r--r--src/mongo/db/storage/wiredtiger/SConscript1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp3
3 files changed, 7 insertions, 3 deletions
diff --git a/jstests/replsets/standalone_recover_to_oplog_timestamp.js b/jstests/replsets/standalone_recover_to_oplog_timestamp.js
index b675eb72add..d12e9521605 100644
--- a/jstests/replsets/standalone_recover_to_oplog_timestamp.js
+++ b/jstests/replsets/standalone_recover_to_oplog_timestamp.js
@@ -14,7 +14,7 @@
"use strict";
const dbName = "test";
-const collName = "foo";
+const collName = jsTestName();
const rst = new ReplSetTest({nodes: 1});
rst.startSet();
@@ -32,7 +32,9 @@ assert.commandWorked(primaryDB.adminCommand({
"data": {"timestamp": recoveryTimestamp}
}));
-const docs = [{_id: 1}];
+assert.commandWorked(primaryDB.getCollection(collName).createIndex({a: 1}));
+
+const docs = [{_id: 1, a: 1}];
const operationTime =
assert.commandWorked(primaryDB.runCommand({insert: collName, documents: docs})).operationTime;
diff --git a/src/mongo/db/storage/wiredtiger/SConscript b/src/mongo/db/storage/wiredtiger/SConscript
index 9cfdeca7fd7..3c0a9a77466 100644
--- a/src/mongo/db/storage/wiredtiger/SConscript
+++ b/src/mongo/db/storage/wiredtiger/SConscript
@@ -87,6 +87,7 @@ if wiredtiger:
'$BUILD_DIR/mongo/db/db_raii',
'$BUILD_DIR/mongo/db/catalog/database_holder',
'$BUILD_DIR/mongo/db/commands/server_status',
+ '$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 15018af86c5..154e42bec60 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -64,6 +64,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"
@@ -1619,7 +1620,7 @@ std::unique_ptr<SortedDataInterface> WiredTigerKVEngine::getGroupedSortedDataInt
std::unique_ptr<RecordStore> WiredTigerKVEngine::makeTemporaryRecordStore(OperationContext* opCtx,
StringData ident) {
- invariant(!_readOnly);
+ invariant(!_readOnly || !recoverToOplogTimestamp.empty());
_ensureIdentPath(ident);
WiredTigerSession wtSession(_conn);