diff options
| author | Samy Lanka <samy.lanka@mongodb.com> | 2024-08-07 16:19:08 -0400 |
|---|---|---|
| committer | MongoDB Bot <mongo-bot@mongodb.com> | 2024-08-07 21:01:58 +0000 |
| commit | a2a46542e8d79a8b4937ed51e84dc918caf26783 (patch) | |
| tree | e1c578afeed9c27e91e37b893d29c1035f44ffdf | |
| parent | dcb5fc2ff16b999512279e50ce0bad46e00d53f1 (diff) | |
Revert "SERVER-86904 Don't use force=true when setting oldestTimestamp during oplog application phase of initial sync (#19233)" (#25855)r7.0.13-rc1r7.0.13
GitOrigin-RevId: 7d06f0a750b0cfdaf4aab7ced47db746ed4ce271
| -rw-r--r-- | src/mongo/db/repl/initial_syncer.cpp | 4 | ||||
| -rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 2 | ||||
| -rw-r--r-- | src/mongo/db/repl/replication_recovery.cpp | 4 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine.h | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine_impl.cpp | 3 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine_impl.h | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine_mock.h | 2 | ||||
| -rw-r--r-- | src/mongo/dbtests/repltests.cpp | 5 |
8 files changed, 11 insertions, 13 deletions
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp index d6af3e633df..1b94ad2d6a3 100644 --- a/src/mongo/db/repl/initial_syncer.cpp +++ b/src/mongo/db/repl/initial_syncer.cpp @@ -661,9 +661,7 @@ void InitialSyncer::_startInitialSyncAttemptCallback( // since that would also set the all_durable point to zero. We specifically don't set // the stable timestamp here because that will trigger taking a first stable checkpoint even // though the initialDataTimestamp is still set to kAllowUnstableCheckpointsSentinel. - // We need to use force in case we are resetting the oldest timestamp backwards after a - // failed initial sync attempt. - storageEngine->setOldestTimestamp(kTimestampOne, true /*force*/); + storageEngine->setOldestTimestamp(kTimestampOne); } LOGV2_DEBUG(21168, diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 3f415b1ed6b..2a5126b1be7 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -310,7 +310,7 @@ InitialSyncerInterface::Options createInitialSyncerOptions( // WiredTiger to pin this data in memory. Advancing the oldest timestamp in step with the // last applied optime here will permit WiredTiger to evict this data as it sees fit. replCoord->getServiceContext()->getStorageEngine()->setOldestTimestamp( - opTimeAndWallTime.opTime.getTimestamp(), false /*force*/); + opTimeAndWallTime.opTime.getTimestamp()); }; options.resetOptimes = [replCoord]() { replCoord->resetMyLastOpTimes(); diff --git a/src/mongo/db/repl/replication_recovery.cpp b/src/mongo/db/repl/replication_recovery.cpp index a218ca4e444..a7ab3c9649e 100644 --- a/src/mongo/db/repl/replication_recovery.cpp +++ b/src/mongo/db/repl/replication_recovery.cpp @@ -589,7 +589,7 @@ void ReplicationRecoveryImpl::_recoverFromUnstableCheckpoint(OperationContext* o // unfortunately, conflicts with the usage above. DurableHistoryRegistry::get(opCtx->getServiceContext())->clearPins(opCtx); opCtx->getServiceContext()->getStorageEngine()->setOldestTimestamp( - appliedThrough.getTimestamp(), true /*force*/); + appliedThrough.getTimestamp()); if (startupRecoveryForRestore) { // When we're recovering for a restore, we may be recovering a large number of oplog @@ -750,7 +750,7 @@ Timestamp ReplicationRecoveryImpl::_applyOplogOperations(OperationContext* opCtx invariant(!applyThroughOpTime.isNull()); _consistencyMarkers->setAppliedThrough(opCtx, applyThroughOpTime); replCoord->getServiceContext()->getStorageEngine()->setOldestTimestamp( - applyThroughOpTime.getTimestamp(), true /*force*/); + applyThroughOpTime.getTimestamp()); } } stats.complete(applyThroughOpTime); diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h index 502b02559dc..00eac79661a 100644 --- a/src/mongo/db/storage/storage_engine.h +++ b/src/mongo/db/storage/storage_engine.h @@ -585,7 +585,7 @@ public: * Sets the oldest timestamp for which the storage engine must maintain snapshot history * through. Additionally, all future writes must be newer or equal to this value. */ - virtual void setOldestTimestamp(Timestamp timestamp, bool force) = 0; + virtual void setOldestTimestamp(Timestamp timestamp) = 0; /** * Gets the oldest timestamp for which the storage engine must maintain snapshot history diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp index e498287f3e1..4310c7c21bf 100644 --- a/src/mongo/db/storage/storage_engine_impl.cpp +++ b/src/mongo/db/storage/storage_engine_impl.cpp @@ -1119,7 +1119,8 @@ void StorageEngineImpl::setOldestTimestampFromStable() { _engine->setOldestTimestampFromStable(); } -void StorageEngineImpl::setOldestTimestamp(Timestamp newOldestTimestamp, bool force) { +void StorageEngineImpl::setOldestTimestamp(Timestamp newOldestTimestamp) { + const bool force = true; _engine->setOldestTimestamp(newOldestTimestamp, force); } diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h index 5750ba795a3..e6902baaa52 100644 --- a/src/mongo/db/storage/storage_engine_impl.h +++ b/src/mongo/db/storage/storage_engine_impl.h @@ -129,7 +129,7 @@ public: virtual void setOldestTimestampFromStable() override; - virtual void setOldestTimestamp(Timestamp newOldestTimestamp, bool force) override; + virtual void setOldestTimestamp(Timestamp newOldestTimestamp) override; virtual Timestamp getOldestTimestamp() const override; diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h index 505402603fe..6acf741df20 100644 --- a/src/mongo/db/storage/storage_engine_mock.h +++ b/src/mongo/db/storage/storage_engine_mock.h @@ -144,7 +144,7 @@ public: return Timestamp(); } void setOldestTimestampFromStable() final {} - void setOldestTimestamp(Timestamp timestamp, bool force) final {} + void setOldestTimestamp(Timestamp timestamp) final {} Timestamp getOldestTimestamp() const final { return {}; }; diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index 1c360a0be9e..da190b04f01 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -137,8 +137,7 @@ public: ASSERT(c->getIndexCatalog()->haveIdIndex(&_opCtx)); wuow.commit(); - _opCtx.getServiceContext()->getStorageEngine()->setOldestTimestamp(Timestamp(1, 1), - false /*force*/); + _opCtx.getServiceContext()->getStorageEngine()->setOldestTimestamp(Timestamp(1, 1)); // Start with a fresh oplog. deleteAll(cllNS()); @@ -230,7 +229,7 @@ protected: if (ops.size() > 0) { if (auto tsElem = ops.front()["ts"]) { _opCtx.getServiceContext()->getStorageEngine()->setOldestTimestamp( - tsElem.timestamp(), true /*force*/); + tsElem.timestamp()); } } } |
