summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-01-02 10:38:30 -0500
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-01-03 21:35:05 -0500
commit804617152c5b4f89c8d54c83bdea90cb2c8541b4 (patch)
treeb3ee1981897bf3cce8a3465b86a818f5cdcd05be /src
parent63af6676e353eafa00b6178737085606836e6139 (diff)
downloadmongo-804617152c5b4f89c8d54c83bdea90cb2c8541b4.tar.gz
SERVER-38527 Merge supportsRecoverToStableTimestamp into supportsRecoveryTimestamp
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/repl/bgsync.cpp2
-rw-r--r--src/mongo/db/repl/replication_consistency_markers_impl.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp2
-rw-r--r--src/mongo/db/repl/replication_recovery_test.cpp25
-rw-r--r--src/mongo/db/repl/rollback_test_fixture.h4
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp2
-rw-r--r--src/mongo/db/repl/storage_interface.h9
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp6
-rw-r--r--src/mongo/db/repl/storage_interface_impl.h2
-rw-r--r--src/mongo/db/repl/storage_interface_mock.h4
-rw-r--r--src/mongo/db/storage/kv/kv_engine.h7
-rw-r--r--src/mongo/db/storage/kv/kv_storage_engine.cpp6
-rw-r--r--src/mongo/db/storage/kv/kv_storage_engine.h2
-rw-r--r--src/mongo/db/storage/storage_engine.h21
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp10
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h2
16 files changed, 25 insertions, 81 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 56b548f5a12..e7096360656 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -629,7 +629,7 @@ void BackgroundSync::_runRollback(OperationContext* opCtx,
storageInterface->waitForAllEarlierOplogWritesToBeVisible(opCtx);
auto storageEngine = opCtx->getServiceContext()->getStorageEngine();
- if (!forceRollbackViaRefetch.load() && storageEngine->supportsRecoverToStableTimestamp()) {
+ if (!forceRollbackViaRefetch.load() && storageEngine->supportsRecoveryTimestamp()) {
log() << "Rollback using 'recoverToStableTimestamp' method.";
_runRollbackViaRecoverToCheckpoint(
opCtx, source, &localOplog, storageInterface, getConnection);
diff --git a/src/mongo/db/repl/replication_consistency_markers_impl.cpp b/src/mongo/db/repl/replication_consistency_markers_impl.cpp
index eee665bf67d..bb0c7bd2f39 100644
--- a/src/mongo/db/repl/replication_consistency_markers_impl.cpp
+++ b/src/mongo/db/repl/replication_consistency_markers_impl.cpp
@@ -198,7 +198,7 @@ void ReplicationConsistencyMarkersImpl::setMinValid(OperationContext* opCtx,
// This method is only used with storage engines that do not support recover to stable
// timestamp. As a result, their timestamps do not matter.
- invariant(!opCtx->getServiceContext()->getStorageEngine()->supportsRecoverToStableTimestamp());
+ invariant(!opCtx->getServiceContext()->getStorageEngine()->supportsRecoveryTimestamp());
update.timestamp = Timestamp();
_updateMinValidDocument(opCtx, update);
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index c66445f02d2..8fa72491552 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -770,7 +770,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);
diff --git a/src/mongo/db/repl/replication_recovery_test.cpp b/src/mongo/db/repl/replication_recovery_test.cpp
index d9d2a46f494..039f1d5b1b5 100644
--- a/src/mongo/db/repl/replication_recovery_test.cpp
+++ b/src/mongo/db/repl/replication_recovery_test.cpp
@@ -72,16 +72,6 @@ public:
_recoveryTimestamp = recoveryTimestamp;
}
- bool supportsRecoverToStableTimestamp(ServiceContext* serviceCtx) const override {
- stdx::lock_guard<stdx::mutex> lock(_mutex);
- return _supportsRecoverToStableTimestamp;
- }
-
- void setSupportsRecoverToStableTimestamp(bool supports) {
- stdx::lock_guard<stdx::mutex> lock(_mutex);
- _supportsRecoverToStableTimestamp = supports;
- }
-
bool supportsRecoveryTimestamp(ServiceContext* serviceCtx) const override {
stdx::lock_guard<stdx::mutex> lock(_mutex);
return _supportsRecoveryTimestamp;
@@ -107,7 +97,6 @@ private:
Timestamp _initialDataTimestamp = Timestamp::min();
boost::optional<Timestamp> _recoveryTimestamp = boost::none;
Timestamp _pointInTimeReadTimestamp = {};
- bool _supportsRecoverToStableTimestamp = true;
bool _supportsRecoveryTimestamp = true;
};
@@ -554,14 +543,14 @@ void ReplicationRecoveryTest::testRecoveryAppliesDocumentsWhenAppliedThroughIsBe
}
TEST_F(ReplicationRecoveryTest, RecoveryAppliesDocumentsWhenAppliedThroughIsBehind) {
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(true);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(true);
bool hasStableTimestamp = false;
bool hasStableCheckpoint = false;
testRecoveryAppliesDocumentsWhenAppliedThroughIsBehind(hasStableTimestamp, hasStableCheckpoint);
}
TEST_F(ReplicationRecoveryTest, RecoveryAppliesDocumentsWhenAppliedThroughIsBehindNoRTT) {
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(false);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(false);
bool hasStableTimestamp = false;
bool hasStableCheckpoint = false;
testRecoveryAppliesDocumentsWhenAppliedThroughIsBehind(hasStableTimestamp, hasStableCheckpoint);
@@ -897,7 +886,7 @@ TEST_F(ReplicationRecoveryTest, PrepareTransactionOplogEntryCorrectlyUpdatesConf
const auto appliedThrough = OpTime(Timestamp(1, 1), 1);
getStorageInterfaceRecovery()->setPointInTimeReadTimestamp(Timestamp(1, 0));
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(true);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(true);
getStorageInterfaceRecovery()->setRecoveryTimestamp(appliedThrough.getTimestamp());
getConsistencyMarkers()->setAppliedThrough(opCtx, appliedThrough);
_setUpOplog(opCtx, getStorageInterface(), {1});
@@ -945,7 +934,7 @@ TEST_F(ReplicationRecoveryTest, AbortTransactionOplogEntryCorrectlyUpdatesConfig
auto opCtx = getOperationContext();
const auto appliedThrough = OpTime(Timestamp(1, 1), 1);
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(true);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(true);
getStorageInterfaceRecovery()->setRecoveryTimestamp(appliedThrough.getTimestamp());
getConsistencyMarkers()->setAppliedThrough(opCtx, appliedThrough);
_setUpOplog(opCtx, getStorageInterface(), {1});
@@ -1008,7 +997,7 @@ DEATH_TEST_F(ReplicationRecoveryTest,
auto opCtx = getOperationContext();
const auto appliedThrough = OpTime(Timestamp(1, 1), 1);
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(true);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(true);
getStorageInterfaceRecovery()->setRecoveryTimestamp(appliedThrough.getTimestamp());
getConsistencyMarkers()->setAppliedThrough(opCtx, appliedThrough);
_setUpOplog(opCtx, getStorageInterface(), {1});
@@ -1042,7 +1031,7 @@ TEST_F(ReplicationRecoveryTest, CommitTransactionOplogEntryCorrectlyUpdatesConfi
auto opCtx = getOperationContext();
const auto appliedThrough = OpTime(Timestamp(1, 1), 1);
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(true);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(true);
getStorageInterfaceRecovery()->setRecoveryTimestamp(appliedThrough.getTimestamp());
getConsistencyMarkers()->setAppliedThrough(opCtx, appliedThrough);
_setUpOplog(opCtx, getStorageInterface(), {1});
@@ -1119,7 +1108,7 @@ TEST_F(ReplicationRecoveryTest,
// when updating the transactions table during startup recovery when the table already reflects
// the committed transaction.
const auto appliedThrough = OpTime(Timestamp(2, 2), 1);
- getStorageInterfaceRecovery()->setSupportsRecoverToStableTimestamp(true);
+ getStorageInterfaceRecovery()->setSupportsRecoveryTimestamp(true);
getStorageInterfaceRecovery()->setRecoveryTimestamp(appliedThrough.getTimestamp());
getConsistencyMarkers()->setAppliedThrough(opCtx, appliedThrough);
_setUpOplog(opCtx, getStorageInterface(), {1});
diff --git a/src/mongo/db/repl/rollback_test_fixture.h b/src/mongo/db/repl/rollback_test_fixture.h
index 958f102a5c2..a68590760df 100644
--- a/src/mongo/db/repl/rollback_test_fixture.h
+++ b/src/mongo/db/repl/rollback_test_fixture.h
@@ -135,10 +135,6 @@ public:
}
}
- bool supportsRecoverToStableTimestamp(ServiceContext* serviceCtx) const override {
- return true;
- }
-
bool supportsRecoveryTimestamp(ServiceContext* serviceCtx) const override {
return true;
}
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index cc060b1f82c..f380cbc5db7 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -616,7 +616,7 @@ void checkRbidAndUpdateMinValid(OperationContext* opCtx,
// This method is only used with storage engines that do not support recover to stable
// timestamp. As a result, the timestamp on the 'appliedThrough' update does not matter.
- invariant(!opCtx->getServiceContext()->getStorageEngine()->supportsRecoverToStableTimestamp());
+ invariant(!opCtx->getServiceContext()->getStorageEngine()->supportsRecoveryTimestamp());
replicationProcess->getConsistencyMarkers()->clearAppliedThrough(opCtx, {});
replicationProcess->getConsistencyMarkers()->setMinValid(opCtx, minValid);
diff --git a/src/mongo/db/repl/storage_interface.h b/src/mongo/db/repl/storage_interface.h
index 3e3b47cd098..fc092e4c0d3 100644
--- a/src/mongo/db/repl/storage_interface.h
+++ b/src/mongo/db/repl/storage_interface.h
@@ -371,11 +371,6 @@ public:
virtual StatusWith<Timestamp> recoverToStableTimestamp(OperationContext* opCtx) = 0;
/**
- * Returns whether the storage engine supports "recover to stable timestamp".
- */
- virtual bool supportsRecoverToStableTimestamp(ServiceContext* serviceCtx) const = 0;
-
- /**
* Returns whether the storage engine can provide a recovery timestamp.
*/
virtual bool supportsRecoveryTimestamp(ServiceContext* serviceCtx) const = 0;
@@ -434,7 +429,7 @@ public:
*
* Returns `Timestamp::min()` if no stable recovery timestamp has yet been established.
* Replication recoverable rollback may not succeed before establishment, and restart will
- * require resync. Returns boost::none if `supportsRecoverToStableTimestamp` returns false.
+ * require resync. Returns boost::none if `supportsRecoveryTimestamp` returns false.
*/
virtual boost::optional<Timestamp> getLastStableRecoveryTimestamp(
ServiceContext* serviceCtx) const = 0;
@@ -444,7 +439,7 @@ public:
*
* Returns a timestamp that is guaranteed to be persisted on disk in a checkpoint. Returns
* `Timestamp::min()` if no stable checkpoint has been taken. Returns boost::none if
- * `supportsRecoverToStableTimestamp` returns false or if this is not a persisted data engine.
+ * `supportsRecoveryTimestamp` returns false or if this is not a persisted data engine.
*
* TODO: delete this in v4.4 (SERVER-36194).
*/
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index 6c4c1adbc57..6d6a991bd10 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -1084,10 +1084,6 @@ StatusWith<Timestamp> StorageInterfaceImpl::recoverToStableTimestamp(OperationCo
return opCtx->getServiceContext()->getStorageEngine()->recoverToStableTimestamp(opCtx);
}
-bool StorageInterfaceImpl::supportsRecoverToStableTimestamp(ServiceContext* serviceCtx) const {
- return serviceCtx->getStorageEngine()->supportsRecoverToStableTimestamp();
-}
-
bool StorageInterfaceImpl::supportsRecoveryTimestamp(ServiceContext* serviceCtx) const {
return serviceCtx->getStorageEngine()->supportsRecoveryTimestamp();
}
@@ -1185,7 +1181,7 @@ void StorageInterfaceImpl::oplogDiskLocRegister(OperationContext* opCtx,
boost::optional<Timestamp> StorageInterfaceImpl::getLastStableRecoveryTimestamp(
ServiceContext* serviceCtx) const {
- if (!supportsRecoverToStableTimestamp(serviceCtx)) {
+ if (!supportsRecoveryTimestamp(serviceCtx)) {
return boost::none;
}
diff --git a/src/mongo/db/repl/storage_interface_impl.h b/src/mongo/db/repl/storage_interface_impl.h
index a722b053d48..d0c1a4d754d 100644
--- a/src/mongo/db/repl/storage_interface_impl.h
+++ b/src/mongo/db/repl/storage_interface_impl.h
@@ -165,8 +165,6 @@ public:
StatusWith<Timestamp> recoverToStableTimestamp(OperationContext* opCtx) override;
- bool supportsRecoverToStableTimestamp(ServiceContext* serviceCtx) const override;
-
bool supportsRecoveryTimestamp(ServiceContext* serviceCtx) const override;
boost::optional<Timestamp> getRecoveryTimestamp(ServiceContext* serviceCtx) const override;
diff --git a/src/mongo/db/repl/storage_interface_mock.h b/src/mongo/db/repl/storage_interface_mock.h
index 5189a4303ff..33629624588 100644
--- a/src/mongo/db/repl/storage_interface_mock.h
+++ b/src/mongo/db/repl/storage_interface_mock.h
@@ -301,10 +301,6 @@ public:
return Status{ErrorCodes::IllegalOperation, "recoverToStableTimestamp not implemented."};
}
- bool supportsRecoverToStableTimestamp(ServiceContext* serviceCtx) const override {
- return false;
- }
-
bool supportsRecoveryTimestamp(ServiceContext* serviceCtx) const override {
return false;
}
diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h
index 126a28af5ee..f9312164b2e 100644
--- a/src/mongo/db/storage/kv/kv_engine.h
+++ b/src/mongo/db/storage/kv/kv_engine.h
@@ -342,13 +342,6 @@ public:
virtual void setCachePressureForTest(int pressure) {}
/**
- * See `StorageEngine::supportsRecoverToStableTimestamp`
- */
- virtual bool supportsRecoverToStableTimestamp() const {
- return false;
- }
-
- /**
* See `StorageEngine::supportsRecoveryTimestamp`
*/
virtual bool supportsRecoveryTimestamp() const {
diff --git a/src/mongo/db/storage/kv/kv_storage_engine.cpp b/src/mongo/db/storage/kv/kv_storage_engine.cpp
index 130bf563fe2..cd021812ee2 100644
--- a/src/mongo/db/storage/kv/kv_storage_engine.cpp
+++ b/src/mongo/db/storage/kv/kv_storage_engine.cpp
@@ -705,10 +705,6 @@ void KVStorageEngine::setCachePressureForTest(int pressure) {
return _engine->setCachePressureForTest(pressure);
}
-bool KVStorageEngine::supportsRecoverToStableTimestamp() const {
- return _engine->supportsRecoverToStableTimestamp();
-}
-
bool KVStorageEngine::supportsRecoveryTimestamp() const {
return _engine->supportsRecoveryTimestamp();
}
@@ -756,7 +752,7 @@ bool KVStorageEngine::supportsReadConcernMajority() const {
}
bool KVStorageEngine::supportsPendingDrops() const {
- return enableKVPendingDrops && supportsRecoverToStableTimestamp();
+ return enableKVPendingDrops && supportsRecoveryTimestamp();
}
void KVStorageEngine::clearDropPendingState() {
diff --git a/src/mongo/db/storage/kv/kv_storage_engine.h b/src/mongo/db/storage/kv/kv_storage_engine.h
index a200c10106b..df80e48746f 100644
--- a/src/mongo/db/storage/kv/kv_storage_engine.h
+++ b/src/mongo/db/storage/kv/kv_storage_engine.h
@@ -161,8 +161,6 @@ public:
virtual void setCachePressureForTest(int pressure) override;
- virtual bool supportsRecoverToStableTimestamp() const override;
-
virtual bool supportsRecoveryTimestamp() const override;
virtual StatusWith<Timestamp> recoverToStableTimestamp(OperationContext* opCtx) override;
diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h
index f281efd0290..746f48a8078 100644
--- a/src/mongo/db/storage/storage_engine.h
+++ b/src/mongo/db/storage/storage_engine.h
@@ -327,17 +327,10 @@ public:
virtual void setJournalListener(JournalListener* jl) = 0;
/**
- * Returns whether the storage engine supports "recover to stable timestamp". Returns true
- * if the storage engine supports "recover to stable timestamp" but does not currently have
- * a stable timestamp. In that case StorageEngine::recoverToStableTimestamp() will return
- * a bad status.
- */
- virtual bool supportsRecoverToStableTimestamp() const {
- return false;
- }
-
- /**
- * Returns whether the storage engine can provide a recovery timestamp.
+ * Returns whether the storage engine can provide a timestamp that can be used for recovering
+ * to a stable timestamp. If the storage engine supports "recover to stable timestamp" but does
+ * not currently have a stable timestamp, then StorageEngine::recoverToStableTimestamp() will
+ * return a bad status.
*/
virtual bool supportsRecoveryTimestamp() const {
return false;
@@ -377,7 +370,7 @@ public:
*
* If successful, returns the timestamp that the storage engine recovered to.
*
- * fasserts if StorageEngine::supportsRecoverToStableTimestamp() would return
+ * fasserts if StorageEngine::supportsRecoveryTimestamp() would return
* false. Returns a bad status if there is no stable timestamp to recover to.
*
* It is illegal to call this concurrently with `setStableTimestamp` or
@@ -390,7 +383,7 @@ public:
/**
* Returns the stable timestamp that the storage engine recovered to on startup. If the
* recovery point was not stable, returns "none".
- * fasserts if StorageEngine::supportsRecoverToStableTimestamp() would return false.
+ * fasserts if StorageEngine::supportsRecoveryTimestamp() would return false.
*/
virtual boost::optional<Timestamp> getRecoveryTimestamp() const {
MONGO_UNREACHABLE;
@@ -402,7 +395,7 @@ public:
* durable engines, it is also the guaranteed minimum stable recovery point on server restart
* after crash or shutdown.
*
- * fasserts if StorageEngine::supportsRecoverToStableTimestamp() would return false. Returns
+ * fasserts if StorageEngine::supportsRecoveryTimestamp() would return false. Returns
* boost::none if the recovery time has not yet been established. Replication recoverable
* rollback may not succeed before establishment, and restart will require resync.
*/
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index a3c62668e37..3e471d4a962 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1657,17 +1657,13 @@ void WiredTigerKVEngine::setInitialDataTimestamp(Timestamp initialDataTimestamp)
_initialDataTimestamp.store(initialDataTimestamp.asULL());
}
-bool WiredTigerKVEngine::supportsRecoverToStableTimestamp() const {
+bool WiredTigerKVEngine::supportsRecoveryTimestamp() const {
if (!_keepDataHistory) {
return false;
}
return true;
}
-bool WiredTigerKVEngine::supportsRecoveryTimestamp() const {
- return true;
-}
-
bool WiredTigerKVEngine::_canRecoverToStableTimestamp() const {
static const std::uint64_t allowUnstableCheckpointsSentinel =
static_cast<std::uint64_t>(Timestamp::kAllowUnstableCheckpointsSentinel.asULL());
@@ -1678,7 +1674,7 @@ bool WiredTigerKVEngine::_canRecoverToStableTimestamp() const {
}
StatusWith<Timestamp> WiredTigerKVEngine::recoverToStableTimestamp(OperationContext* opCtx) {
- if (!supportsRecoverToStableTimestamp()) {
+ if (!supportsRecoveryTimestamp()) {
severe() << "WiredTiger is configured to not support recover to a stable timestamp";
fassertFailed(50665);
}
@@ -1765,7 +1761,7 @@ boost::optional<Timestamp> WiredTigerKVEngine::getRecoveryTimestamp() const {
}
boost::optional<Timestamp> WiredTigerKVEngine::getLastStableRecoveryTimestamp() const {
- if (!supportsRecoverToStableTimestamp()) {
+ if (!supportsRecoveryTimestamp()) {
severe() << "WiredTiger is configured to not support recover to a stable timestamp";
fassertFailed(50770);
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index 8e6b2995d8a..30f1ec78d91 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -211,8 +211,6 @@ public:
*/
void setOldestTimestamp(Timestamp newOldestTimestamp, bool force) override;
- bool supportsRecoverToStableTimestamp() const override;
-
bool supportsRecoveryTimestamp() const override;
StatusWith<Timestamp> recoverToStableTimestamp(OperationContext* opCtx) override;