diff options
author | William Schultz <william.schultz@mongodb.com> | 2017-08-08 16:31:52 -0400 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2017-08-08 22:39:29 -0400 |
commit | c7661b14867cd058e1a67986b8e05a7020fc0a5e (patch) | |
tree | cc2f34786a5492b038456bfc34fce859dbb028c1 /src/mongo/db/repl | |
parent | b0f8d105349d9d6df874ed7f566a552dbd98a1ab (diff) | |
download | mongo-c7661b14867cd058e1a67986b8e05a7020fc0a5e.tar.gz |
SERVER-29891 Call setStableTimestamp() when commit point or last applied optime changes
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/initial_syncer.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/repl/initial_syncer_test.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 77 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.h | 37 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl_test.cpp | 171 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface.h | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface_impl.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface_impl.h | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface_mock.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface_mock.h | 4 |
10 files changed, 307 insertions, 18 deletions
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp index 1e86e011c2f..2ba93cd4bbe 100644 --- a/src/mongo/db/repl/initial_syncer.cpp +++ b/src/mongo/db/repl/initial_syncer.cpp @@ -394,9 +394,11 @@ void InitialSyncer::setScheduleDbWorkFn_forTest(const CollectionCloner::Schedule void InitialSyncer::_setUp_inlock(OperationContext* opCtx, std::uint32_t initialSyncMaxAttempts) { // 'opCtx' is passed through from startup(). _replicationProcess->getConsistencyMarkers()->setInitialSyncFlag(opCtx); - _storage->setInitialDataTimestamp(opCtx, + + auto storageEngine = opCtx->getServiceContext()->getGlobalStorageEngine(); + _storage->setInitialDataTimestamp(storageEngine, SnapshotName(Timestamp::kAllowUnstableCheckpointsSentinel)); - _storage->setStableTimestamp(opCtx, SnapshotName::min()); + _storage->setStableTimestamp(storageEngine, SnapshotName::min()); LOG(1) << "Creating oplogBuffer."; _oplogBuffer = _dataReplicatorExternalState->makeInitialSyncOplogBuffer(opCtx); @@ -419,7 +421,7 @@ void InitialSyncer::_tearDown_inlock(OperationContext* opCtx, return; } - _storage->setInitialDataTimestamp(opCtx, + _storage->setInitialDataTimestamp(opCtx->getServiceContext()->getGlobalStorageEngine(), SnapshotName(lastApplied.getValue().opTime.getTimestamp())); _replicationProcess->getConsistencyMarkers()->clearInitialSyncFlag(opCtx); _opts.setMyLastOptime(lastApplied.getValue().opTime); diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index 2a402f2ff06..ddce6686acb 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -624,8 +624,9 @@ TEST_F(InitialSyncerTest, StartupSetsInitialDataTimestampAndStableTimestampOnSuc auto opCtx = makeOpCtx(); // Set initial data timestamp forward first. - _storageInterface->setInitialDataTimestamp(opCtx.get(), SnapshotName(Timestamp(5, 5))); - _storageInterface->setStableTimestamp(opCtx.get(), SnapshotName(Timestamp(6, 6))); + auto storageEngine = opCtx.get()->getServiceContext()->getGlobalStorageEngine(); + _storageInterface->setInitialDataTimestamp(storageEngine, SnapshotName(Timestamp(5, 5))); + _storageInterface->setStableTimestamp(storageEngine, SnapshotName(Timestamp(6, 6))); ASSERT_OK(initialSyncer->startup(opCtx.get(), maxAttempts)); ASSERT_TRUE(initialSyncer->isActive()); diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 5ca9f6cabf5..a3fd2fe8ddd 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -1034,6 +1034,12 @@ void ReplicationCoordinatorImpl::_setMyLastAppliedOpTime_inlock(const OpTime& op invariant(isRollbackAllowed || myMemberData->getLastAppliedOpTime() <= opTime); myMemberData->setLastAppliedOpTime(opTime, _replExecutor->now()); _updateLastCommittedOpTime_inlock(); + + // Add the new applied timestamp to the list of stable timestamp candidates and then set the + // last stable timestamp. + _stableTimestampCandidates.insert(opTime.getTimestamp()); + _setStableTimestampForStorage_inlock(); + _opTimeWaiterList.signalAndRemoveIf_inlock( [opTime](Waiter* waiter) { return waiter->opTime <= opTime; }); } @@ -2312,7 +2318,7 @@ Status ReplicationCoordinatorImpl::processReplSetInitiate(OperationContext* opCt // Sets the initial data timestamp on the storage engine so it can assign a timestamp // to data on disk. We do this after writing the "initiating set" oplog entry. auto initialDataTS = SnapshotName(lastAppliedOpTime.getTimestamp().asULL()); - _storage->setInitialDataTimestamp(opCtx, initialDataTS); + _storage->setInitialDataTimestamp(getServiceContext()->getGlobalStorageEngine(), initialDataTS); _finishReplSetInitiate(newConfig, myIndex.getValue()); @@ -2943,6 +2949,72 @@ void ReplicationCoordinatorImpl::_updateLastCommittedOpTime_inlock() { _wakeReadyWaiters_inlock(); } +boost::optional<Timestamp> ReplicationCoordinatorImpl::_calculateStableTimestamp( + const std::set<Timestamp>& candidates, const Timestamp& commitPoint) { + + // Find the greatest timestamp candidate that is less than or equal to the commit point. To do + // this, we search through the candidates in descending order, stopping at the first timestamp + // that is less than or equal to the commit point. Note that std::set maintains its elements in + // sorted order. + auto stableTimestampIter = + std::find_if(candidates.rbegin(), candidates.rend(), [commitPoint](Timestamp ts) { + return ts <= commitPoint; + }); + + // No stable timestamp found. + if (stableTimestampIter == candidates.rend()) { + return boost::none; + } + return *stableTimestampIter; +} + +void ReplicationCoordinatorImpl::_cleanupStableTimestampCandidates(std::set<Timestamp>* candidates, + Timestamp stableTimestamp) { + // Discard timestamp candidates earlier than the current stable timestamp, since we don't need + // them anymore. To do this, we iterate through timestamps in ascending order, searching for the + // first timestamp T such that T >= stableTimestamp. We then discard all timestamps earlier than + // T. + auto deletePoint = std::find_if(candidates->begin(), candidates->end(), [&](Timestamp ts) { + return ts >= stableTimestamp; + }); + + // Delete the entire range of unneeded timestamps. + candidates->erase(candidates->begin(), deletePoint); +} + +boost::optional<Timestamp> ReplicationCoordinatorImpl::calculateStableTimestamp_forTest( + const std::set<Timestamp>& candidates, const Timestamp& commitPoint) { + return _calculateStableTimestamp(candidates, commitPoint); +} +void ReplicationCoordinatorImpl::cleanupStableTimestampCandidates_forTest( + std::set<Timestamp>* candidates, Timestamp stableTimestamp) { + _cleanupStableTimestampCandidates(candidates, stableTimestamp); +} + +std::set<Timestamp> ReplicationCoordinatorImpl::getStableTimestampCandidates_forTest() { + stdx::unique_lock<stdx::mutex> lk(_mutex); + return _stableTimestampCandidates; +} + +void ReplicationCoordinatorImpl::_setStableTimestampForStorage_inlock() { + + // Get the current stable timestamp. + auto commitPoint = _topCoord->getLastCommittedOpTime(); + auto stableTimestamp = + _calculateStableTimestamp(_stableTimestampCandidates, commitPoint.getTimestamp()); + + // If there is a valid stable timestamp, set it for the storage engine, and then remove any + // old, unneeded stable timestamp candidates. + if (stableTimestamp) { + LOG(2) << "Setting replication's stable timestamp to " << stableTimestamp.value(); + + auto storageEngine = getServiceContext()->getGlobalStorageEngine(); + _storage->setStableTimestamp(storageEngine, SnapshotName(stableTimestamp.get())); + + _cleanupStableTimestampCandidates(&_stableTimestampCandidates, stableTimestamp.get()); + } +} + void ReplicationCoordinatorImpl::advanceCommitPoint(const OpTime& committedOpTime) { stdx::unique_lock<stdx::mutex> lk(_mutex); _advanceCommitPoint_inlock(committedOpTime); @@ -2962,6 +3034,9 @@ void ReplicationCoordinatorImpl::_updateCommitPoint_inlock() { auto committedOpTime = _topCoord->getLastCommittedOpTime(); _externalState->notifyOplogMetadataWaiters(committedOpTime); + // Update the stable timestamp. + _setStableTimestampForStorage_inlock(); + auto maxSnapshotForOpTime = SnapshotInfo{committedOpTime, SnapshotName::max()}; if (!_uncommittedSnapshots.empty() && _uncommittedSnapshots.front() <= maxSnapshotForOpTime) { diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index cb30bd1164b..55a5aa80d2e 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -378,6 +378,15 @@ public: Status setLastDurableOptime_forTest(long long cfgVer, long long memberId, const OpTime& opTime); /** + * Simple test wrappers that expose private methods. + */ + boost::optional<Timestamp> calculateStableTimestamp_forTest( + const std::set<Timestamp>& candidates, const Timestamp& commitPoint); + void cleanupStableTimestampCandidates_forTest(std::set<Timestamp>* candidates, + Timestamp stableTimestamp); + std::set<Timestamp> getStableTimestampCandidates_forTest(); + + /** * Non-blocking version of updateTerm. * Returns event handle that we can use to wait for the operation to complete. * When the operation is complete (waitForEvent() returns), 'updateResult' will be set @@ -1015,6 +1024,28 @@ private: void _updateCommittedSnapshot_inlock(SnapshotInfo newCommittedSnapshot); /** + * Calculates the 'stable' replication timestamp given a set of timestamp candidates and the + * current commit point. The stable timestamp is the greatest timestamp in 'candidates' that is + * also less than or equal to 'commitPoint'. + */ + boost::optional<Timestamp> _calculateStableTimestamp(const std::set<Timestamp>& candidates, + const Timestamp& commitPoint); + + /** + * Removes any timestamps from the timestamp set 'candidates' that are less than + * 'stableTimestamp'. + */ + void _cleanupStableTimestampCandidates(std::set<Timestamp>* candidates, + Timestamp stableTimestamp); + + /** + * Calculates and sets the value of the 'stable' replication timestamp for the storage engine. + * See ReplicationCoordinatorImpl::_calculateStableTimestamp for a definition of 'stable', in + * this context. + */ + void _setStableTimestampForStorage_inlock(); + + /** * Drops all snapshots and clears the "committed" snapshot. */ void _dropAllSnapshots_inlock(); @@ -1280,6 +1311,12 @@ private: // When engaged, this must be <= _lastCommittedOpTime and < _uncommittedSnapshots.front(). boost::optional<SnapshotInfo> _currentCommittedSnapshot; // (M) + // A set of timestamps that are used for computing the replication system's current 'stable' + // timestamp. Every time a node's applied optime is updated, it will be added to this set. + // Timestamps that are older than the current stable timestamp should get removed from this set. + // This set should also be cleared if a rollback occurs. + std::set<Timestamp> _stableTimestampCandidates; // (M) + // Used to signal threads that are waiting for new committed snapshots. stdx::condition_variable _currentCommittedSnapshotCond; // (M) diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index fee1eca4e1e..babe8fdbc42 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" +#include <boost/optional/optional_io.hpp> #include <iostream> #include <memory> #include <set> @@ -3539,6 +3540,176 @@ TEST_F(ReplCoordTest, ASSERT_EQUALS(newTime, getReplCoord()->getLastCommittedOpTime()); } +/** + * Tests to ensure that ReplicationCoordinator correctly calculates and updates the stable + * timestamp. + */ +class StableTimestampTest : public ReplCoordTest { +protected: + /** + * Return a string representation of the given set 's'. + */ + std::string timestampSetString(std::set<Timestamp> s) { + std::stringstream ss; + ss << "{ "; + for (Timestamp const& el : s) { + ss << el << " "; + } + ss << "}"; + return ss.str(); + } + +private: + virtual void setUp() { + ReplCoordTest::setUp(); + init(ReplSettings()); + } +}; + +// An equality assertion for two std::set<Timestamp> values. Prints the elements of each set when +// the assertion fails. Only to be used in a 'StableTimestampTest' unit test function. +#define ASSERT_TIMESTAMP_SET_EQ(a, b) \ + ASSERT(a == b) << (timestampSetString(a) + " != " + timestampSetString(b)); + +TEST_F(StableTimestampTest, CalculateStableTimestamp) { + + /** + * Tests the 'ReplicationCoordinatorImpl::_calculateStableTimestamp' method. + */ + + auto repl = getReplCoord(); + Timestamp commitPoint; + boost::optional<Timestamp> expectedStableTimestamp, stableTimestamp; + std::set<Timestamp> stableTimestampCandidates; + + // There is a valid stable timestamp less than the commit point. + commitPoint = {0, 3}; + stableTimestampCandidates = {{0, 0}, {0, 1}, {0, 2}, {0, 4}}; + expectedStableTimestamp = Timestamp(0, 2); + stableTimestamp = + repl->calculateStableTimestamp_forTest(stableTimestampCandidates, commitPoint); + ASSERT_EQ(expectedStableTimestamp, stableTimestamp); + + // There is a valid stable timestamp equal to the commit point. + commitPoint = Timestamp(0, 2); + stableTimestampCandidates = {{0, 0}, {0, 1}, {0, 2}, {0, 3}}; + expectedStableTimestamp = Timestamp(0, 2); + stableTimestamp = + repl->calculateStableTimestamp_forTest(stableTimestampCandidates, commitPoint); + ASSERT_EQ(expectedStableTimestamp, stableTimestamp); + + // There is no valid stable timestamp. + commitPoint = Timestamp(0, 0); + stableTimestampCandidates = {{0, 1}, {0, 2}, {0, 3}}; + expectedStableTimestamp = boost::none; + stableTimestamp = + repl->calculateStableTimestamp_forTest(stableTimestampCandidates, commitPoint); + ASSERT_EQ(expectedStableTimestamp, stableTimestamp); + + // There are no timestamp candidates. + commitPoint = Timestamp(0, 0); + stableTimestampCandidates = {}; + expectedStableTimestamp = boost::none; + stableTimestamp = + repl->calculateStableTimestamp_forTest(stableTimestampCandidates, commitPoint); + ASSERT_EQ(expectedStableTimestamp, stableTimestamp); +} + +TEST_F(StableTimestampTest, CleanupStableTimestampCandidates) { + + /** + * Tests the 'ReplicationCoordinatorImpl::_cleanupStableTimestampCandidates' method. + */ + + auto repl = getReplCoord(); + Timestamp stableTimestamp; + std::set<Timestamp> timestampCandidates, expectedTimestampCandidates; + + // Cleanup should remove all timestamp candidates < the stable timestamp. + stableTimestamp = Timestamp(0, 3); + timestampCandidates = {{0, 1}, {0, 2}, {0, 3}, {0, 4}}; + expectedTimestampCandidates = {{0, 3}, {0, 4}}; + repl->cleanupStableTimestampCandidates_forTest(×tampCandidates, stableTimestamp); + ASSERT_TIMESTAMP_SET_EQ(expectedTimestampCandidates, timestampCandidates); + + // Cleanup should have no effect when stable timestamp is less than all candidates. + stableTimestamp = Timestamp(0, 0); + timestampCandidates = {{0, 1}, {0, 2}, {0, 3}, {0, 4}}; + expectedTimestampCandidates = {{0, 1}, {0, 2}, {0, 3}, {0, 4}}; + repl->cleanupStableTimestampCandidates_forTest(×tampCandidates, stableTimestamp); + ASSERT_TIMESTAMP_SET_EQ(expectedTimestampCandidates, timestampCandidates); + + // Cleanup should leave an empty candidate list unchanged. + stableTimestamp = Timestamp(0, 0); + timestampCandidates = {}; + expectedTimestampCandidates = {}; + repl->cleanupStableTimestampCandidates_forTest(×tampCandidates, stableTimestamp); + ASSERT_TIMESTAMP_SET_EQ(expectedTimestampCandidates, timestampCandidates); +} + + +TEST_F(StableTimestampTest, SetMyLastAppliedSetsStableTimestampForStorage) { + + /** + * Test that 'setMyLastAppliedOpTime' sets the stable timestamp properly for the storage engine + * and that timestamp cleanup occurs. This test is not meant to fully exercise the stable + * timestamp calculation logic. + */ + + auto repl = getReplCoord(); + Timestamp stableTimestamp; + + // There should be no stable timestamp candidates until setMyLastAppliedOpTime is called. + repl->advanceCommitPoint(OpTime({0, 2}, 0)); + ASSERT_EQUALS(SnapshotName::min(), getStorageInterface()->getStableTimestamp()); + + // Check that the stable timestamp is updated when we set the applied optime. + repl->setMyLastAppliedOpTime(OpTime({0, 1}, 0)); + stableTimestamp = Timestamp(getStorageInterface()->getStableTimestamp().asU64()); + ASSERT_EQUALS(Timestamp(0, 1), stableTimestamp); + + // Check that timestamp cleanup occurs. + repl->setMyLastAppliedOpTime(OpTime({0, 2}, 0)); + stableTimestamp = Timestamp(getStorageInterface()->getStableTimestamp().asU64()); + ASSERT_EQUALS(Timestamp(0, 2), stableTimestamp); + + auto timestampCandidates = repl->getStableTimestampCandidates_forTest(); + std::set<Timestamp> expectedTimestampCandidates = {{0, 2}}; + ASSERT_TIMESTAMP_SET_EQ(expectedTimestampCandidates, timestampCandidates); +} + +TEST_F(StableTimestampTest, AdvanceCommitPointSetsStableTimestampForStorage) { + + /** + * Test that 'advanceCommitPoint' sets the stable timestamp for the storage engine and that + * timestamp cleanup occurs. This test is not meant to fully exercise the stable timestamp + * calculation logic. + */ + + auto repl = getReplCoord(); + Timestamp stableTimestamp; + + // Add two stable timestamp candidates. + repl->setMyLastAppliedOpTime(OpTime({0, 1}, 0)); + repl->setMyLastAppliedOpTime(OpTime({0, 2}, 0)); + + // Set a commit point and check the stable timestamp. + repl->advanceCommitPoint(OpTime({0, 1}, 0)); + stableTimestamp = Timestamp(getStorageInterface()->getStableTimestamp().asU64()); + ASSERT_EQUALS(Timestamp(0, 1), stableTimestamp); + + // Check that the stable timestamp is updated when we advance the commit point. + repl->advanceCommitPoint(OpTime({0, 2}, 0)); + stableTimestamp = Timestamp(getStorageInterface()->getStableTimestamp().asU64()); + ASSERT_EQUALS(Timestamp(0, 2), stableTimestamp); + + // Check that timestamp candidate cleanup occurs. + auto timestampCandidates = getReplCoord()->getStableTimestampCandidates_forTest(); + std::set<Timestamp> expectedTimestampCandidates = {{0, 2}}; + ASSERT_TIMESTAMP_SET_EQ(expectedTimestampCandidates, timestampCandidates); +} + + TEST_F(ReplCoordTest, NodeReturnsShutdownInProgressWhenWaitingUntilAnOpTimeDuringShutdown) { assertStartSuccess(BSON("_id" << "mySet" diff --git a/src/mongo/db/repl/storage_interface.h b/src/mongo/db/repl/storage_interface.h index d996b099f2f..93c46d691f8 100644 --- a/src/mongo/db/repl/storage_interface.h +++ b/src/mongo/db/repl/storage_interface.h @@ -280,13 +280,14 @@ public: * Sets the highest timestamp at which the storage engine is allowed to take a checkpoint. * This timestamp can never decrease, and thus should be a timestamp that can never roll back. */ - virtual void setStableTimestamp(OperationContext* opCtx, SnapshotName snapshotName) = 0; + virtual void setStableTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) = 0; /** * Tells the storage engine the timestamp of the data at startup. This is necessary because * timestamps are not persisted in the storage layer. */ - virtual void setInitialDataTimestamp(OperationContext* opCtx, SnapshotName snapshotName) = 0; + virtual void setInitialDataTimestamp(StorageEngine* storageEngine, + SnapshotName snapshotName) = 0; }; } // namespace repl diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp index 832b9707722..3b0059f9c04 100644 --- a/src/mongo/db/repl/storage_interface_impl.cpp +++ b/src/mongo/db/repl/storage_interface_impl.cpp @@ -894,13 +894,14 @@ StatusWith<StorageInterface::CollectionCount> StorageInterfaceImpl::getCollectio return collection->numRecords(opCtx); } -void StorageInterfaceImpl::setStableTimestamp(OperationContext* opCtx, SnapshotName snapshotName) { - opCtx->getServiceContext()->getGlobalStorageEngine()->setStableTimestamp(snapshotName); +void StorageInterfaceImpl::setStableTimestamp(StorageEngine* storageEngine, + SnapshotName snapshotName) { + storageEngine->setStableTimestamp(snapshotName); } -void StorageInterfaceImpl::setInitialDataTimestamp(OperationContext* opCtx, +void StorageInterfaceImpl::setInitialDataTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) { - opCtx->getServiceContext()->getGlobalStorageEngine()->setInitialDataTimestamp(snapshotName); + storageEngine->setInitialDataTimestamp(snapshotName); } Status StorageInterfaceImpl::isAdminDbValid(OperationContext* opCtx) { diff --git a/src/mongo/db/repl/storage_interface_impl.h b/src/mongo/db/repl/storage_interface_impl.h index 56968146f2b..109db947c38 100644 --- a/src/mongo/db/repl/storage_interface_impl.h +++ b/src/mongo/db/repl/storage_interface_impl.h @@ -134,9 +134,9 @@ public: StatusWith<StorageInterface::CollectionCount> getCollectionCount( OperationContext* opCtx, const NamespaceString& nss) override; - void setStableTimestamp(OperationContext* opCtx, SnapshotName snapshotName) override; + void setStableTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) override; - void setInitialDataTimestamp(OperationContext* opCtx, SnapshotName snapshotName) override; + void setInitialDataTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) override; /** * Checks that the "admin" database contains a supported version of the auth data schema. diff --git a/src/mongo/db/repl/storage_interface_mock.cpp b/src/mongo/db/repl/storage_interface_mock.cpp index 2bb4e8c4597..8cb9570ad20 100644 --- a/src/mongo/db/repl/storage_interface_mock.cpp +++ b/src/mongo/db/repl/storage_interface_mock.cpp @@ -68,12 +68,13 @@ Status StorageInterfaceMock::incrementRollbackID(OperationContext* opCtx) { return Status::OK(); } -void StorageInterfaceMock::setStableTimestamp(OperationContext* opCtx, SnapshotName snapshotName) { +void StorageInterfaceMock::setStableTimestamp(StorageEngine* storageEngine, + SnapshotName snapshotName) { stdx::lock_guard<stdx::mutex> lock(_mutex); _stableTimestamp = snapshotName; } -void StorageInterfaceMock::setInitialDataTimestamp(OperationContext* opCtx, +void StorageInterfaceMock::setInitialDataTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) { stdx::lock_guard<stdx::mutex> lock(_mutex); _initialDataTimestamp = snapshotName; diff --git a/src/mongo/db/repl/storage_interface_mock.h b/src/mongo/db/repl/storage_interface_mock.h index 20249b455c6..32eeef077e7 100644 --- a/src/mongo/db/repl/storage_interface_mock.h +++ b/src/mongo/db/repl/storage_interface_mock.h @@ -244,9 +244,9 @@ public: return 0; } - void setStableTimestamp(OperationContext* opCtx, SnapshotName snapshotName) override; + void setStableTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) override; - void setInitialDataTimestamp(OperationContext* opCtx, SnapshotName snapshotName) override; + void setInitialDataTimestamp(StorageEngine* storageEngine, SnapshotName snapshotName) override; SnapshotName getStableTimestamp() const; |