summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@mongodb.com>2019-09-24 19:19:51 +0000
committerevergreen <evergreen@mongodb.com>2019-09-24 19:19:51 +0000
commitd4c9bb6282f1b3371cb01c35a0be0b6cbc540906 (patch)
treed690d701b02422bafa7539aca78933339a87b240
parented9d2602949314e87562219b354a2d9f0737fd52 (diff)
downloadmongo-d4c9bb6282f1b3371cb01c35a0be0b6cbc540906.tar.gz
SERVER-41792 Make recoverFromOplogAsStandalone always replay entries from the checkpoint the node was started from
-rw-r--r--jstests/noPassthrough/standalone_replication_recovery.js13
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp2
2 files changed, 13 insertions, 2 deletions
diff --git a/jstests/noPassthrough/standalone_replication_recovery.js b/jstests/noPassthrough/standalone_replication_recovery.js
index 1def927772c..9efb1212be5 100644
--- a/jstests/noPassthrough/standalone_replication_recovery.js
+++ b/jstests/noPassthrough/standalone_replication_recovery.js
@@ -84,7 +84,8 @@
reconnect(node);
assertDocsInColl(node, []);
- jsTestLog("Test that on restart with the flag set we play recovery.");
+ jsTestLog(
+ "Test that on restart with the 'recoverFromOplogAsStandalone' flag set we play recovery.");
node = rst.restart(node, {
noReplSet: true,
setParameter: {recoverFromOplogAsStandalone: true, logComponentVerbosity: logLevel}
@@ -99,6 +100,16 @@
assert.commandFailed(node.adminCommand({setParameter: 1, recoverFromOplogAsStandalone: true}));
assert.commandFailed(node.adminCommand({setParameter: 1, recoverFromOplogAsStandalone: false}));
+ jsTestLog(
+ "Test that on restart with the 'recoverFromOplogAsStandalone' flag set we play recovery even if we also set 'enableMajorityReadConcern=false'.");
+ node = rst.restart(node, {
+ noReplSet: true,
+ enableMajorityReadConcern: false,
+ setParameter: {recoverFromOplogAsStandalone: true, logComponentVerbosity: logLevel}
+ });
+ reconnect(node);
+ assertDocsInColl(node, [3, 4, 5]);
+
jsTestLog("Test that on restart after standalone recovery we do not see replicated writes.");
node = rst.restart(node, {
noReplSet: true,
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 6f5487d9392..f978bb425c4 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -782,7 +782,7 @@ void ReplicationCoordinatorImpl::_startDataReplication(OperationContext* opCtx,
void ReplicationCoordinatorImpl::startup(OperationContext* opCtx) {
if (!isReplEnabled()) {
if (ReplSettings::shouldRecoverFromOplogAsStandalone()) {
- if (!_storage->supportsRecoverToStableTimestamp(opCtx->getServiceContext())) {
+ if (!_storage->supportsRecoveryTimestamp(opCtx->getServiceContext())) {
severe() << "Cannot use 'recoverFromOplogAsStandalone' with a storage engine that "
"does not support recover to stable timestamp.";
fassertFailedNoTrace(50805);