diff options
author | William Schultz <william.schultz@mongodb.com> | 2020-07-13 11:37:31 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-13 16:05:41 +0000 |
commit | 09d1ea41fb25867e7cb2510b06933c3aa6757306 (patch) | |
tree | d0d691262f962bb20d9b716b947e4ce75b960c6c | |
parent | 188c858a12705164b7ae5f1ad418821bedd94bb4 (diff) | |
download | mongo-09d1ea41fb25867e7cb2510b06933c3aa6757306.tar.gz |
SERVER-49472 Add 'holdStableTimestampAtSpecificTimestamp' failpoint back to runnable code path
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface_impl.cpp | 15 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index ed9a5753956..5537f73eb1d 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -112,7 +112,6 @@ namespace mongo { namespace repl { MONGO_FAIL_POINT_DEFINE(stepdownHangBeforePerformingPostMemberStateUpdateActions); -MONGO_FAIL_POINT_DEFINE(holdStableTimestampAtSpecificTimestamp); MONGO_FAIL_POINT_DEFINE(stepdownHangBeforeRSTLEnqueue); // Fail setMaintenanceMode with ErrorCodes::NotSecondary to simulate a concurrent election. MONGO_FAIL_POINT_DEFINE(setMaintenanceModeFailsWithNotSecondary); @@ -4859,11 +4858,6 @@ boost::optional<OpTimeAndWallTime> ReplicationCoordinatorImpl::_chooseStableOpTi maximumStableOpTime.opTime.getTimestamp()); } - holdStableTimestampAtSpecificTimestamp.execute([&](const BSONObj& dataObj) { - const auto holdStableTimestamp = dataObj["timestamp"].timestamp(); - maximumStableTimestamp = std::min(maximumStableTimestamp, holdStableTimestamp); - }); - maximumStableOpTime = {OpTime(maximumStableTimestamp, maximumStableOpTime.opTime.getTerm()), maximumStableOpTime.wallTime}; diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp index 47c0a5a7190..07e1b21ea33 100644 --- a/src/mongo/db/repl/storage_interface_impl.cpp +++ b/src/mongo/db/repl/storage_interface_impl.cpp @@ -85,6 +85,8 @@ namespace mongo { namespace repl { +MONGO_FAIL_POINT_DEFINE(holdStableTimestampAtSpecificTimestamp); + const char StorageInterfaceImpl::kDefaultRollbackIdNamespace[] = "local.system.rollback.id"; const char StorageInterfaceImpl::kRollbackIdFieldName[] = "rollbackId"; const char StorageInterfaceImpl::kRollbackIdDocumentId[] = "rollbackId"; @@ -1228,7 +1230,18 @@ StatusWith<OptionalCollectionUUID> StorageInterfaceImpl::getCollectionUUID( } void StorageInterfaceImpl::setStableTimestamp(ServiceContext* serviceCtx, Timestamp snapshotName) { - serviceCtx->getStorageEngine()->setStableTimestamp(snapshotName); + auto newStableTimestamp = snapshotName; + // Hold the stable timestamp back if this failpoint is enabled. + holdStableTimestampAtSpecificTimestamp.execute([&](const BSONObj& dataObj) { + const auto holdStableTimestamp = dataObj["timestamp"].timestamp(); + if (newStableTimestamp > holdStableTimestamp) { + newStableTimestamp = holdStableTimestamp; + LOGV2(4784410, + "holdStableTimestampAtSpecificTimestamp holding the stable timestamp", + "holdStableTimestamp"_attr = holdStableTimestamp); + } + }); + serviceCtx->getStorageEngine()->setStableTimestamp(newStableTimestamp); } void StorageInterfaceImpl::setInitialDataTimestamp(ServiceContext* serviceCtx, |