diff options
author | William Schultz <william.schultz@mongodb.com> | 2017-11-21 15:52:48 -0500 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2017-11-21 15:52:48 -0500 |
commit | 30de2f7c46a9aa0914fe91cba2075b244e9b516b (patch) | |
tree | a34e54136e5acc0da1eae63e9651a2d04b023702 /src/mongo/db/repl/initial_syncer_test.cpp | |
parent | 43efeb64565f7e3d0d55b5a647fe11e92aa3dc67 (diff) | |
download | mongo-30de2f7c46a9aa0914fe91cba2075b244e9b516b.tar.gz |
SERVER-30577 Don't update the stable timestamp if database is in an inconsistent state
Diffstat (limited to 'src/mongo/db/repl/initial_syncer_test.cpp')
-rw-r--r-- | src/mongo/db/repl/initial_syncer_test.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index 7cb8d53cbde..630629ff7a5 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -121,7 +121,10 @@ public: * clear/reset state */ void reset() { - _setMyLastOptime = [this](const OpTime& opTime) { _myLastOpTime = opTime; }; + _setMyLastOptime = [this](const OpTime& opTime, + ReplicationCoordinator::DataConsistency consistency) { + _myLastOpTime = opTime; + }; _myLastOpTime = OpTime(); _syncSourceSelector = stdx::make_unique<SyncSourceSelectorMock>(); } @@ -357,8 +360,11 @@ protected: InitialSyncerOptions options; options.initialSyncRetryWait = Milliseconds(1); options.getMyLastOptime = [this]() { return _myLastOpTime; }; - options.setMyLastOptime = [this](const OpTime& opTime) { _setMyLastOptime(opTime); }; - options.resetOptimes = [this]() { _setMyLastOptime(OpTime()); }; + options.setMyLastOptime = [this](const OpTime& opTime, + ReplicationCoordinator::DataConsistency consistency) { + _setMyLastOptime(opTime, consistency); + }; + options.resetOptimes = [this]() { _myLastOpTime = OpTime(); }; options.getSlaveDelay = [this]() { return Seconds(0); }; options.syncSourceSelector = this; @@ -627,7 +633,8 @@ void InitialSyncerTest::processSuccessfulFCVFetcherResponse(std::vector<BSONObj> TEST_F(InitialSyncerTest, InvalidConstruction) { InitialSyncerOptions options; options.getMyLastOptime = []() { return OpTime(); }; - options.setMyLastOptime = [](const OpTime&) {}; + options.setMyLastOptime = [](const OpTime&, + ReplicationCoordinator::DataConsistency consistency) {}; options.resetOptimes = []() {}; options.getSlaveDelay = []() { return Seconds(0); }; options.syncSourceSelector = this; @@ -858,9 +865,10 @@ TEST_F(InitialSyncerTest, InitialSyncerResetsOptimesOnNewAttempt) { _syncSourceSelector->setChooseNewSyncSourceResult_forTest(HostAndPort()); - // Set the last optime to an arbitrary nonzero value. + // Set the last optime to an arbitrary nonzero value. The value of the 'consistency' argument + // doesn't matter. auto origOptime = OpTime(Timestamp(1000, 1), 1); - _setMyLastOptime(origOptime); + _setMyLastOptime(origOptime, ReplicationCoordinator::DataConsistency::Inconsistent); // Start initial sync. const std::uint32_t initialSyncMaxAttempts = 1U; |