summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2020-07-13 14:47:45 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-13 20:03:58 +0000
commit692b37ddb002a4f1ea1e07a145e1f3ff1e6c9e6e (patch)
treea953dea63e0b64486dc4a9adab7a5526bec19198 /src/mongo/db
parent2ac185e56e4aa8f78f7649d5284a81c9fff40b26 (diff)
downloadmongo-692b37ddb002a4f1ea1e07a145e1f3ff1e6c9e6e.tar.gz
Revert "SERVER-48518 Fix rollback via refetch anomaly"
This reverts commit 74ab0cdac56e1cc62fc96d3ca3be3ddfa54f2bcb.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp16
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp1
-rw-r--r--src/mongo/db/storage/storage_engine_impl.h1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h2
5 files changed, 8 insertions, 16 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 041c7cce065..76649706d7f 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -5120,22 +5120,6 @@ void ReplicationCoordinatorImpl::finishRecoveryIfEligible(OperationContext* opCt
return;
}
- // Rolling back with eMRC false, we set initialDataTimestamp to max(local oplog top, source's
- // oplog top), then rollback via refetch. Data is inconsistent until lastApplied >=
- // initialDataTimestamp.
- auto initialTs = opCtx->getServiceContext()->getStorageEngine()->getInitialDataTimestamp();
- if (lastApplied.getTimestamp() < initialTs) {
- invariant(!serverGlobalParams.enableMajorityReadConcern);
- LOGV2_DEBUG(4851800,
- 2,
- "We cannot transition to SECONDARY state because our 'lastApplied' optime is "
- "less than the initial data timestamp and enableMajorityReadConcern = false",
- "minValid"_attr = minValid,
- "lastApplied"_attr = lastApplied,
- "initialDataTimestamp"_attr = initialTs);
- return;
- }
-
// Execute the transition to SECONDARY.
auto status = setFollowerMode(MemberState::RS_SECONDARY);
if (!status.isOK()) {
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index 1e3977ee532..bcded20bb6d 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -778,6 +778,7 @@ void StorageEngineImpl::setStableTimestamp(Timestamp stableTimestamp, bool force
}
void StorageEngineImpl::setInitialDataTimestamp(Timestamp initialDataTimestamp) {
+ _initialDataTimestamp = initialDataTimestamp;
_engine->setInitialDataTimestamp(initialDataTimestamp);
}
diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h
index 7f658ba910b..6ef1a605992 100644
--- a/src/mongo/db/storage/storage_engine_impl.h
+++ b/src/mongo/db/storage/storage_engine_impl.h
@@ -398,6 +398,7 @@ private:
const bool _supportsDocLocking;
const bool _supportsCappedCollections;
+ Timestamp _initialDataTimestamp = Timestamp::kAllowUnstableCheckpointsSentinel;
std::unique_ptr<RecordStore> _catalogRecordStore;
std::unique_ptr<DurableCatalogImpl> _catalog;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 7d98f3c7205..3fa21ec4f8d 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -2400,6 +2400,10 @@ Timestamp WiredTigerKVEngine::getCheckpointTimestamp() const {
return Timestamp(_getCheckpointTimestamp());
}
+Timestamp WiredTigerKVEngine::getInitialDataTimestamp() const {
+ return Timestamp(_initialDataTimestamp.load());
+}
+
std::uint64_t WiredTigerKVEngine::_getCheckpointTimestamp() const {
char buf[(2 * 8 /*bytes in hex*/) + 1 /*nul terminator*/];
invariantWTOK(_conn->query_timestamp(_conn, buf, "get=last_checkpoint"));
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index 09152ec80fe..df0dccc4373 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -323,6 +323,8 @@ public:
Timestamp getOldestTimestamp() const override;
Timestamp getCheckpointTimestamp() const override;
+ Timestamp getInitialDataTimestamp() const;
+
/**
* Returns the data file path associated with an ident on disk. Returns boost::none if the data
* file can not be found. This will attempt to locate a file even if the storage engine's own