From fdb56a92bfea1af0344044856df04af4d464a3b4 Mon Sep 17 00:00:00 2001 From: Maria van Keulen Date: Thu, 6 Jun 2019 17:33:12 -0400 Subject: SERVER-40737 Use epoch as default OpTimeAndWallTime wallTime value (cherry picked from commit cc24f2022c761b32eecb18f6f5c841c3a43fe7c1) --- .../repl/abstract_oplog_fetcher_test_fixture.cpp | 2 +- .../repl/check_quorum_for_config_change_test.cpp | 4 +- src/mongo/db/repl/initial_syncer.cpp | 4 +- src/mongo/db/repl/initial_syncer_test.cpp | 8 +- src/mongo/db/repl/member_data.h | 4 +- src/mongo/db/repl/oplog_applier_test.cpp | 6 +- src/mongo/db/repl/oplog_fetcher_test.cpp | 34 +- src/mongo/db/repl/optime.h | 2 +- src/mongo/db/repl/repl_set_heartbeat_response.cpp | 4 +- .../db/repl/repl_set_heartbeat_response_test.cpp | 46 +- .../replication_coordinator_external_state_mock.h | 2 +- src/mongo/db/repl/replication_coordinator_impl.cpp | 16 +- src/mongo/db/repl/replication_coordinator_impl.h | 4 +- .../replication_coordinator_impl_elect_v1_test.cpp | 190 +++--- ...lication_coordinator_impl_heartbeat_v1_test.cpp | 18 +- .../replication_coordinator_impl_reconfig_test.cpp | 76 ++- .../db/repl/replication_coordinator_impl_test.cpp | 671 ++++++++++----------- src/mongo/db/repl/replication_coordinator_mock.cpp | 4 +- .../repl/replication_coordinator_test_fixture.cpp | 18 +- .../db/repl/replication_coordinator_test_fixture.h | 21 +- src/mongo/db/repl/reporter_test.cpp | 4 +- src/mongo/db/repl/sync_tail.cpp | 4 +- src/mongo/db/repl/topology_coordinator.cpp | 17 +- src/mongo/db/repl/topology_coordinator_v1_test.cpp | 50 +- src/mongo/db/repl/update_position_args.cpp | 4 +- src/mongo/dbtests/storage_timestamp_tests.cpp | 2 +- .../rpc/metadata/oplog_query_metadata_test.cpp | 2 +- src/mongo/rpc/metadata/repl_set_metadata_test.cpp | 2 +- src/mongo/s/catalog/sharding_catalog_test.cpp | 8 +- 29 files changed, 581 insertions(+), 646 deletions(-) diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp index 9a1b139505a..f3d44242ffb 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp @@ -111,7 +111,7 @@ void AbstractOplogFetcherTest::setUp() { launchExecutorThread(); lastFetched = {{123, 0}, 1}; - lastFetchedWall = Date_t::min() + Seconds(lastFetched.getSecs()); + lastFetchedWall = Date_t() + Seconds(lastFetched.getSecs()); } executor::RemoteCommandRequest AbstractOplogFetcherTest::processNetworkResponse( diff --git a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp index 36807a63c2e..8d5fe816589 100644 --- a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp +++ b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp @@ -239,7 +239,7 @@ executor::RemoteCommandResponse makeHeartbeatResponse(const ReplSetConfig& rsCon hbResp.setConfigVersion(configVersion); // The smallest valid optime in PV1. OpTime opTime(Timestamp(), 0); - Date_t wallTime = Date_t::min(); + Date_t wallTime = Date_t(); hbResp.setAppliedOpTimeAndWallTime({opTime, wallTime}); hbResp.setDurableOpTimeAndWallTime({opTime, wallTime}); auto bob = BSONObjBuilder(hbResp.toBSON()); @@ -470,7 +470,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToSetIdMismatch) { << request.target.toString(); if (request.target == incompatibleHost) { OpTime opTime{Timestamp{10, 10}, 10}; - Date_t wallTime = Date_t::min(); + Date_t wallTime = Date_t(); rpc::ReplSetMetadata metadata(opTime.getTerm(), {opTime, wallTime}, opTime, diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp index 93f478d7235..bf5f20021f9 100644 --- a/src/mongo/db/repl/initial_syncer.cpp +++ b/src/mongo/db/repl/initial_syncer.cpp @@ -500,7 +500,7 @@ void InitialSyncer::_startInitialSyncAttemptCallback( LOG(2) << "Resetting all optimes before starting this initial sync attempt."; _opts.resetOptimes(); - _lastApplied = {OpTime(), Date_t::min()}; + _lastApplied = {OpTime(), Date_t()}; _lastFetched = {}; LOG(2) << "Resetting feature compatibility version to last-stable. If the sync source is in " @@ -1072,7 +1072,7 @@ void InitialSyncer::_databasesClonerCallback(const Status& databaseClonerFinishS void InitialSyncer::_lastOplogEntryFetcherCallbackForStopTimestamp( const StatusWith& result, std::shared_ptr onCompletionGuard) { - OpTimeAndWallTime resultOpTimeAndWallTime = {OpTime(), Date_t::min()}; + OpTimeAndWallTime resultOpTimeAndWallTime = {OpTime(), Date_t()}; { stdx::lock_guard lock(_mutex); auto status = _checkForShutdownAndConvertStatus_inlock( diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index 27eff74563a..9bc286759ff 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -132,7 +132,7 @@ public: _myLastWallTime = opTimeAndWallTime.wallTime; }; _myLastOpTime = OpTime(); - _myLastWallTime = Date_t::min(); + _myLastWallTime = Date_t(); _syncSourceSelector = stdx::make_unique(); } @@ -518,7 +518,7 @@ RemoteCommandResponse makeCursorResponse(CursorId cursorId, bool isFirstBatch = true, int rbid = 1) { OpTime futureOpTime(Timestamp(1000, 1000), 1000); - Date_t futureWallTime = Date_t::min() + Seconds(futureOpTime.getSecs()); + Date_t futureWallTime = Date_t() + Seconds(futureOpTime.getSecs()); rpc::OplogQueryMetadata oqMetadata({futureOpTime, futureWallTime}, futureOpTime, rbid, 0, 0); BSONObjBuilder bob; @@ -578,7 +578,7 @@ OplogEntry makeOplogEntry(int t, boost::none, // o2 {}, // sessionInfo boost::none, // upsert - Date_t::min() + Seconds(t), // wall clock time + Date_t() + Seconds(t), // wall clock time boost::none, // statement id boost::none, // optime of previous write within same transaction boost::none, // pre-image optime @@ -884,7 +884,7 @@ TEST_F(InitialSyncerTest, InitialSyncerResetsOptimesOnNewAttempt) { // Make sure the initial sync attempt reset optimes. ASSERT_EQUALS(OpTime(), _options.getMyLastOptime()); - ASSERT_EQUALS(Date_t::min(), initialSyncer->getWallClockTime_forTest()); + ASSERT_EQUALS(Date_t(), initialSyncer->getWallClockTime_forTest()); } TEST_F(InitialSyncerTest, diff --git a/src/mongo/db/repl/member_data.h b/src/mongo/db/repl/member_data.h index d8887317f83..c3201e0bf75 100644 --- a/src/mongo/db/repl/member_data.h +++ b/src/mongo/db/repl/member_data.h @@ -266,11 +266,11 @@ private: // Last known OpTime that the replica has applied and journaled to. OpTime _lastDurableOpTime; - Date_t _lastDurableWallTime = Date_t::min(); + Date_t _lastDurableWallTime = Date_t(); // Last known OpTime that the replica has applied, whether journaled or unjournaled. OpTime _lastAppliedOpTime; - Date_t _lastAppliedWallTime = Date_t::min(); + Date_t _lastAppliedWallTime = Date_t(); // TODO(russotto): Since memberData is kept in config order, _configIndex // and _isSelf may not be necessary. diff --git a/src/mongo/db/repl/oplog_applier_test.cpp b/src/mongo/db/repl/oplog_applier_test.cpp index 35155afabb0..352359bae58 100644 --- a/src/mongo/db/repl/oplog_applier_test.cpp +++ b/src/mongo/db/repl/oplog_applier_test.cpp @@ -117,7 +117,7 @@ OplogEntry makeInsertOplogEntry(int t, const NamespaceString& nss) { boost::none, // o2 {}, // sessionInfo boost::none, // upsert - Date_t::min() + Seconds(t), // wall clock time + Date_t() + Seconds(t), // wall clock time boost::none, // statement id boost::none, // optime of previous write within same transaction boost::none, // pre-image optime @@ -145,7 +145,7 @@ OplogEntry makeApplyOpsOplogEntry(int t, bool prepare) { boost::none, // o2 {}, // sessionInfo boost::none, // upsert - Date_t::min() + Seconds(t), // wall clock time + Date_t() + Seconds(t), // wall clock time boost::none, // statement id boost::none, // optime of previous write within same transaction boost::none, // pre-image optime @@ -177,7 +177,7 @@ OplogEntry makeCommitTransactionOplogEntry(int t, StringData dbName, bool prepar boost::none, // o2 {}, // sessionInfo boost::none, // upsert - Date_t::min() + Seconds(t), // wall clock time + Date_t() + Seconds(t), // wall clock time boost::none, // statement id boost::none, // optime of previous write within same transaction boost::none, // pre-image optime diff --git a/src/mongo/db/repl/oplog_fetcher_test.cpp b/src/mongo/db/repl/oplog_fetcher_test.cpp index 1550d0882ed..80232733873 100644 --- a/src/mongo/db/repl/oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/oplog_fetcher_test.cpp @@ -111,7 +111,7 @@ void OplogFetcherTest::setUp() { remoteNewerOpTime = {{124, 1}, 2}; staleOpTime = {{1, 1}, 0}; - staleWallTime = Date_t::min() + Seconds(staleOpTime.getSecs()); + staleWallTime = Date_t() + Seconds(staleOpTime.getSecs()); rbid = 2; dataReplicatorExternalState = stdx::make_unique(); @@ -298,8 +298,7 @@ DEATH_TEST_F(OplogFetcherTest, } TEST_F(OplogFetcherTest, ValidMetadataWithInResponseShouldBeForwardedToProcessMetadataFn) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, remoteNewerOpTime, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -318,8 +317,7 @@ TEST_F(OplogFetcherTest, ValidMetadataWithInResponseShouldBeForwardedToProcessMe } TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceRollsBack) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata( {staleOpTime, staleWallTime}, remoteNewerOpTime, rbid + 1, 2, 2); BSONObjBuilder bob; @@ -338,8 +336,7 @@ TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceRollsBack) } TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceIsBehind) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, staleOpTime, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -357,8 +354,7 @@ TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceIsBehind) } TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceIsNotAhead) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, lastFetched, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -377,8 +373,7 @@ TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceIsNotAhead TEST_F(OplogFetcherTest, MetadataAndBatchAreNotProcessedWhenSyncSourceIsBehindWithoutRequiringFresherSyncSource) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, staleOpTime, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -399,8 +394,7 @@ TEST_F(OplogFetcherTest, MetadataAndBatchAreProcessedWhenSyncSourceIsCurrentButM // This tests the case where the sync source metadata is behind us but we get a document which // is equal to us. Since that means the metadata is stale and can be ignored, we should accept // this sync source. - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, staleOpTime, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -416,8 +410,7 @@ TEST_F(OplogFetcherTest, MetadataAndBatchAreProcessedWhenSyncSourceIsCurrentButM TEST_F(OplogFetcherTest, MetadataAndBatchAreProcessedWhenSyncSourceIsNotAheadWithoutRequiringFresherSyncSource) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, lastFetched, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -448,8 +441,7 @@ TEST_F(OplogFetcherTest, } TEST_F(OplogFetcherTest, MetadataIsNotProcessedOnBatchThatTriggersRollback) { - rpc::ReplSetMetadata replMetadata( - 1, {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + rpc::ReplSetMetadata replMetadata(1, {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); rpc::OplogQueryMetadata oqMetadata({staleOpTime, staleWallTime}, remoteNewerOpTime, rbid, 2, 2); BSONObjBuilder bob; ASSERT_OK(replMetadata.writeToMetadata(&bob)); @@ -770,10 +762,10 @@ TEST_F(OplogFetcherTest, FailedSyncSourceCheckWithoutMetadataStopsTheOplogFetche TEST_F(OplogFetcherTest, FailedSyncSourceCheckWithBothMetadatasStopsTheOplogFetcher) { rpc::ReplSetMetadata replMetadata( - lastFetched.getTerm(), {OpTime(), Date_t::min()}, OpTime(), 1, OID::gen(), -1, -1); + lastFetched.getTerm(), {OpTime(), Date_t()}, OpTime(), 1, OID::gen(), -1, -1); OpTime committedOpTime = {{Seconds(10000), 0}, 1}; rpc::OplogQueryMetadata oqMetadata( - {committedOpTime, Date_t::min() + Seconds(committedOpTime.getSecs())}, + {committedOpTime, Date_t() + Seconds(committedOpTime.getSecs())}, {{Seconds(20000), 0}, 1}, rbid, 2, @@ -792,14 +784,14 @@ TEST_F(OplogFetcherTest, OpTime committedOpTime = {{Seconds(10000), 0}, 1}; rpc::ReplSetMetadata replMetadata( lastFetched.getTerm(), - {committedOpTime, Date_t::min() + Seconds(committedOpTime.getSecs())}, + {committedOpTime, Date_t() + Seconds(committedOpTime.getSecs())}, {{Seconds(20000), 0}, 1}, 1, OID::gen(), 2, 2); rpc::OplogQueryMetadata oqMetadata( - {committedOpTime, Date_t::min() + Seconds(committedOpTime.getSecs())}, + {committedOpTime, Date_t() + Seconds(committedOpTime.getSecs())}, {{Seconds(20000), 0}, 1}, rbid, 2, diff --git a/src/mongo/db/repl/optime.h b/src/mongo/db/repl/optime.h index 8edb4ccde96..ed7c5df7e93 100644 --- a/src/mongo/db/repl/optime.h +++ b/src/mongo/db/repl/optime.h @@ -162,7 +162,7 @@ private: struct OpTimeAndWallTime { OpTime opTime; - Date_t wallTime = Date_t::min(); + Date_t wallTime = Date_t(); inline bool operator==(const OpTimeAndWallTime& rhs) const { return opTime == rhs.opTime && wallTime == rhs.wallTime; } diff --git a/src/mongo/db/repl/repl_set_heartbeat_response.cpp b/src/mongo/db/repl/repl_set_heartbeat_response.cpp index 2c1f5f88734..4b16c88e389 100644 --- a/src/mongo/db/repl/repl_set_heartbeat_response.cpp +++ b/src/mongo/db/repl/repl_set_heartbeat_response.cpp @@ -155,7 +155,7 @@ Status ReplSetHeartbeatResponse::initialize(const BSONObj& doc, } BSONElement durableWallTimeElement; - _durableWallTime = Date_t::min(); + _durableWallTime = Date_t(); status = bsonExtractTypedField( doc, kDurableWallTimeFieldName, BSONType::Date, &durableWallTimeElement); if (!status.isOK() && (status != ErrorCodes::NoSuchKey || requireWallTime)) { @@ -176,7 +176,7 @@ Status ReplSetHeartbeatResponse::initialize(const BSONObj& doc, } BSONElement appliedWallTimeElement; - _appliedWallTime = Date_t::min(); + _appliedWallTime = Date_t(); status = bsonExtractTypedField( doc, kAppliedWallTimeFieldName, BSONType::Date, &appliedWallTimeElement); if (!status.isOK() && (status != ErrorCodes::NoSuchKey || requireWallTime)) { diff --git a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp index 72c7d31190a..f3f0f1ce8bb 100644 --- a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp +++ b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp @@ -49,9 +49,9 @@ TEST(ReplSetHeartbeatResponse, DefaultConstructThenSlowlyBuildToFullObj) { ReplSetHeartbeatResponse hbResponse; ReplSetHeartbeatResponse hbResponseObjRoundTripChecker; OpTime durableOpTime = OpTime(Timestamp(10), 0); - Date_t durableWallTime = Date_t::min() + Seconds(durableOpTime.getSecs()); + Date_t durableWallTime = Date_t() + Seconds(durableOpTime.getSecs()); OpTime appliedOpTime = OpTime(Timestamp(50), 0); - Date_t appliedWallTime = Date_t::min() + Seconds(appliedOpTime.getSecs()); + Date_t appliedWallTime = Date_t() + Seconds(appliedOpTime.getSecs()); ASSERT_EQUALS(false, hbResponse.hasState()); ASSERT_EQUALS(false, hbResponse.hasElectionTime()); ASSERT_EQUALS(false, hbResponse.hasDurableOpTime()); @@ -168,7 +168,7 @@ TEST(ReplSetHeartbeatResponse, InitializeWrongAppliedOpTimeType) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << "hello"); Status result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -177,7 +177,7 @@ TEST(ReplSetHeartbeatResponse, InitializeWrongAppliedOpTimeType) { initializerObj = BSON("ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime().getTimestamp()); result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -190,7 +190,7 @@ TEST(ReplSetHeartbeatResponse, InitializeNoAppliedWallTime) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON()); Status result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -202,11 +202,11 @@ TEST(ReplSetHeartbeatResponse, InitializeMemberStateWrongType) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "state" << "hello"); Status result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -221,11 +221,11 @@ TEST(ReplSetHeartbeatResponse, InitializeMemberStateTooLow) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "state" << -1); Status result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -240,11 +240,11 @@ TEST(ReplSetHeartbeatResponse, InitializeMemberStateTooHigh) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "state" << 11); Status result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -259,11 +259,11 @@ TEST(ReplSetHeartbeatResponse, InitializeVersionWrongType) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "v" << "hello"); Status result = hbResponse.initialize(initializerObj, 0, /*requireWallTime*/ true); @@ -278,11 +278,11 @@ TEST(ReplSetHeartbeatResponse, InitializeReplSetNameWrongType) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "v" << 2 // needs a version to get this far in initialize() << "set" @@ -299,11 +299,11 @@ TEST(ReplSetHeartbeatResponse, InitializeSyncingToWrongType) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "v" << 2 // needs a version to get this far in initialize() << "syncingTo" @@ -320,11 +320,11 @@ TEST(ReplSetHeartbeatResponse, InitializeConfigWrongType) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "v" << 2 // needs a version to get this far in initialize() << "config" @@ -341,11 +341,11 @@ TEST(ReplSetHeartbeatResponse, InitializeBadConfig) { ReplSetHeartbeatResponse hbResponse; BSONObj initializerObj = BSON( "ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "v" << 2 // needs a version to get this far in initialize() << "config" @@ -372,11 +372,11 @@ TEST(ReplSetHeartbeatResponse, InvalidResponseOpTimeMissesConfigVersion) { Status result = hbResp.initialize(BSON("ok" << 1.0 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100)), + << Date_t() + Seconds(100)), 0, /*requireWallTime*/ true); ASSERT_EQUALS(ErrorCodes::NoSuchKey, result.code()); diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h index eeda5419db9..ed2efa301c5 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h @@ -124,7 +124,7 @@ public: * Sets the return value for subsequent calls to loadLastOpTimeApplied. */ void setLastOpTimeAndWallTime(const StatusWith& lastApplied, - Date_t lastAppliedWall = Date_t::min()); + Date_t lastAppliedWall = Date_t()); /** * Sets the return value for subsequent calls to storeLocalConfigDocument(). diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 2f5d0f9e27a..74112da3178 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -591,7 +591,7 @@ void ReplicationCoordinatorImpl::_finishLoadLocalConfig( // Do not check optime, if this node is an arbiter. bool isArbiter = myIndex.getValue() != -1 && localConfig.getMemberAt(myIndex.getValue()).isArbiter(); - OpTimeAndWallTime lastOpTimeAndWallTime = {OpTime(), Date_t::min()}; + OpTimeAndWallTime lastOpTimeAndWallTime = {OpTime(), Date_t()}; if (!isArbiter) { if (!lastOpTimeAndWallTimeStatus.isOK()) { warning() << "Failed to load timestamp and/or wall clock time of most recently applied " @@ -1176,8 +1176,8 @@ void ReplicationCoordinatorImpl::_resetMyLastOpTimes(WithLock lk) { // Reset to uninitialized OpTime bool isRollbackAllowed = true; _setMyLastAppliedOpTimeAndWallTime( - lk, {OpTime(), Date_t::min()}, isRollbackAllowed, DataConsistency::Inconsistent); - _setMyLastDurableOpTimeAndWallTime(lk, {OpTime(), Date_t::min()}, isRollbackAllowed); + lk, {OpTime(), Date_t()}, isRollbackAllowed, DataConsistency::Inconsistent); + _setMyLastDurableOpTimeAndWallTime(lk, {OpTime(), Date_t()}, isRollbackAllowed); _stableOpTimeCandidates.clear(); } @@ -1550,12 +1550,12 @@ Status ReplicationCoordinatorImpl::setLastDurableOptime_forTest(long long cfgVer stdx::lock_guard lock(_mutex); invariant(getReplicationMode() == modeReplSet); - if (wallTime == Date_t::min()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } const UpdatePositionArgs::UpdateInfo update( - OpTime(), Date_t::min(), opTime, wallTime, cfgVer, memberId); + OpTime(), Date_t(), opTime, wallTime, cfgVer, memberId); long long configVersion; const auto status = _setLastOptime(lock, update, &configVersion); _updateLastCommittedOpTimeAndWallTime(lock); @@ -1569,12 +1569,12 @@ Status ReplicationCoordinatorImpl::setLastAppliedOptime_forTest(long long cfgVer stdx::lock_guard lock(_mutex); invariant(getReplicationMode() == modeReplSet); - if (wallTime == Date_t::min()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } const UpdatePositionArgs::UpdateInfo update( - opTime, wallTime, OpTime(), Date_t::min(), cfgVer, memberId); + opTime, wallTime, OpTime(), Date_t(), cfgVer, memberId); long long configVersion; const auto status = _setLastOptime(lock, update, &configVersion); _updateLastCommittedOpTimeAndWallTime(lock); @@ -3387,7 +3387,7 @@ void ReplicationCoordinatorImpl::blacklistSyncSource(const HostAndPort& host, Da void ReplicationCoordinatorImpl::resetLastOpTimesFromOplog(OperationContext* opCtx, DataConsistency consistency) { auto lastOpTimeAndWallTimeStatus = _externalState->loadLastOpTimeAndWallTime(opCtx); - OpTimeAndWallTime lastOpTimeAndWallTime = {OpTime(), Date_t::min()}; + OpTimeAndWallTime lastOpTimeAndWallTime = {OpTime(), Date_t()}; if (!lastOpTimeAndWallTimeStatus.getStatus().isOK()) { warning() << "Failed to load timestamp and/or wall clock time of most recently applied " "operation; " diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index b7a3e429b83..8bb0ca7488c 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -379,11 +379,11 @@ public: Status setLastAppliedOptime_forTest(long long cfgVer, long long memberId, const OpTime& opTime, - Date_t wallTime = Date_t::min()); + Date_t wallTime = Date_t()); Status setLastDurableOptime_forTest(long long cfgVer, long long memberId, const OpTime& opTime, - Date_t wallTime = Date_t::min()); + Date_t wallTime = Date_t()); /** * Simple test wrappers that expose private methods. diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp index 3c088e5d2cb..ea9bf647937 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp @@ -136,8 +136,8 @@ TEST_F(ReplCoordTest, ElectionSucceedsWhenNodeIsTheOnlyElectableNode) { ASSERT(getReplCoord()->getMemberState().secondary()) << getReplCoord()->getMemberState().toString(); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(10)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(10)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(10)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(10)); auto electionTimeoutWhen = getReplCoord()->getElectionTimeout_forTest(); ASSERT_NOT_EQUALS(Date_t(), electionTimeoutWhen); @@ -200,8 +200,8 @@ TEST_F(ReplCoordTest, StartElectionDoesNotStartAnElectionWhenNodeIsRecovering) { ASSERT(getReplCoord()->getMemberState().recovering()) << getReplCoord()->getMemberState().toString(); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(10)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(10)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(10)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(10)); simulateEnoughHeartbeatsForAllNodesUp(); auto electionTimeoutWhen = getReplCoord()->getElectionTimeout_forTest(); @@ -221,8 +221,8 @@ TEST_F(ReplCoordTest, ElectionSucceedsWhenNodeIsTheOnlyNode) { << 1), HostAndPort("node1", 12345)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(10)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(10)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(10)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(10)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); getReplCoord()->waitForElectionFinish_forTest(); ASSERT(getReplCoord()->getMemberState().primary()) @@ -259,8 +259,8 @@ TEST_F(ReplCoordTest, ElectionSucceedsWhenAllNodesVoteYea) { << 1); assertStartSuccess(configObj, HostAndPort("node1", 12345)); OperationContextNoop opCtx; - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); startCapturingLogMessages(); simulateSuccessfulV1Election(); @@ -300,8 +300,8 @@ TEST_F(ReplCoordTest, ElectionSucceedsWhenMaxSevenNodesVoteYea) { << 1); assertStartSuccess(configObj, HostAndPort("node1", 12345)); OperationContextNoop opCtx; - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); startCapturingLogMessages(); simulateSuccessfulV1Election(); @@ -337,8 +337,8 @@ TEST_F(ReplCoordTest, ElectionFailsWhenInsufficientVotesAreReceivedDuringDryRun) OperationContextNoop opCtx; OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -398,8 +398,8 @@ TEST_F(ReplCoordTest, ElectionFailsWhenDryRunResponseContainsANewerTerm) { OperationContextNoop opCtx; OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -466,8 +466,8 @@ TEST_F(ReplCoordTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) { << 1), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); getGlobalFailPointRegistry() ->getFailPoint("blockHeartbeatReconfigFinish") @@ -495,10 +495,8 @@ TEST_F(ReplCoordTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) { hbResp2.setConfigVersion(3); hbResp2.setSetName("mySet"); hbResp2.setState(MemberState::RS_SECONDARY); - hbResp2.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp2.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp2.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp2.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); net->runUntil(net->now() + Seconds(10)); // run until we've sent a heartbeat request const NetworkInterfaceMock::NetworkOperationIterator noi2 = net->getNextReadyRequest(); net->scheduleResponse(noi2, net->now(), makeResponseStatus(hbResp2.toBSON())); @@ -531,9 +529,9 @@ TEST_F(ReplCoordTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) { hbResp.setState(MemberState::RS_SECONDARY); hbResp.setConfigVersion(rsConfig.getConfigVersion()); hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + {OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + {OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); BSONObjBuilder respObj; net->scheduleResponse(noi, net->now(), makeResponseStatus(hbResp.toBSON())); } else { @@ -594,8 +592,8 @@ TEST_F(ReplCoordTest, ElectionFailsWhenInsufficientVotesAreReceivedDuringRequest OperationContextNoop opCtx; OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -644,8 +642,8 @@ TEST_F(ReplCoordTest, TransitionToRollbackFailsWhenElectionInProgress) { ReplSetConfig config = assertMakeRSConfig(configObj); OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -684,8 +682,8 @@ TEST_F(ReplCoordTest, ElectionFailsWhenVoteRequestResponseContainsANewerTerm) { OperationContextNoop opCtx; OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -740,8 +738,8 @@ TEST_F(ReplCoordTest, ElectionFailsWhenTermChangesDuringDryRun) { OperationContextNoop opCtx; OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -780,8 +778,8 @@ TEST_F(ReplCoordTest, ElectionFailsWhenTermChangesDuringActualElection) { OperationContextNoop opCtx; OpTime time1(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(time1.getSecs())); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(time1.getSecs())); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(time1.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateEnoughHeartbeatsForAllNodesUp(); @@ -955,9 +953,9 @@ private: hbResp.setConfigVersion(config.getConfigVersion()); hbResp.setTerm(replCoord->getTerm()); hbResp.setAppliedOpTimeAndWallTime( - {otherNodesOpTime, Date_t::min() + Seconds(otherNodesOpTime.getSecs())}); + {otherNodesOpTime, Date_t() + Seconds(otherNodesOpTime.getSecs())}); hbResp.setDurableOpTimeAndWallTime( - {otherNodesOpTime, Date_t::min() + Seconds(otherNodesOpTime.getSecs())}); + {otherNodesOpTime, Date_t() + Seconds(otherNodesOpTime.getSecs())}); auto response = makeResponseStatus(hbResp.toBSON()); net->scheduleResponse(noi, net->now(), response); } @@ -989,10 +987,8 @@ TEST_F(TakeoverTest, DoesntScheduleCatchupTakeoverIfCatchupDisabledButTakeoverDe OperationContextNoop opCtx; OpTime currentOptime(Timestamp(200, 1), 0); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); ASSERT_EQUALS(ErrorCodes::StaleTerm, replCoord->updateTerm(&opCtx, 1)); @@ -1034,10 +1030,8 @@ TEST_F(TakeoverTest, SchedulesCatchupTakeoverIfNodeIsFresherThanCurrentPrimary) // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled yet. @@ -1087,10 +1081,8 @@ TEST_F(TakeoverTest, SchedulesCatchupTakeoverIfBothTakeoversAnOption) { // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled. @@ -1143,10 +1135,8 @@ TEST_F(TakeoverTest, PrefersPriorityToCatchupTakeoverIfNodeHasHighestPriority) { // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled. @@ -1195,10 +1185,8 @@ TEST_F(TakeoverTest, CatchupTakeoverNotScheduledTwice) { // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled. @@ -1262,10 +1250,8 @@ TEST_F(TakeoverTest, CatchupAndPriorityTakeoverNotScheduledAtSameTime) { // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled. @@ -1322,10 +1308,8 @@ TEST_F(TakeoverTest, CatchupTakeoverCallbackCanceledIfElectionTimeoutRuns) { // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled. @@ -1397,10 +1381,8 @@ TEST_F(TakeoverTest, CatchupTakeoverCanceledIfTransitionToRollback) { // and some other node became the new primary. Once you hear about a primary election // in term 1, your term will be increased. replCoord->updateTerm_forTest(1, nullptr); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Make sure we're secondary and that no catchup takeover has been scheduled. @@ -1462,10 +1444,8 @@ TEST_F(TakeoverTest, SuccessfulCatchupTakeover) { OpTime currentOptime(Timestamp(100, 5000), 0); OpTime behindOptime(Timestamp(100, 4000), 0); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); // Update the term so that the current term is ahead of the term of // the last applied op time. This means that the primary is still in @@ -1535,10 +1515,8 @@ TEST_F(TakeoverTest, CatchupTakeoverDryRunFailsPrimarySaysNo) { OpTime currentOptime(Timestamp(100, 5000), 0); OpTime behindOptime(Timestamp(100, 4000), 0); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); // Update the term so that the current term is ahead of the term of // the last applied op time. This means that the primary is still in @@ -1639,10 +1617,8 @@ TEST_F(TakeoverTest, PrimaryCatchesUpBeforeCatchupTakeover) { OperationContextNoop opCtx; OpTime currentOptime(Timestamp(200, 1), 0); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Update the term so that the current term is ahead of the term of @@ -1706,10 +1682,8 @@ TEST_F(TakeoverTest, PrimaryCatchesUpBeforeHighPriorityNodeCatchupTakeover) { OperationContextNoop opCtx; OpTime currentOptime(Timestamp(200, 1), 0); - replCoordSetMyLastAppliedOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); - replCoordSetMyLastDurableOpTime(currentOptime, - Date_t::min() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); + replCoordSetMyLastDurableOpTime(currentOptime, Date_t() + Seconds(currentOptime.getSecs())); OpTime behindOptime(Timestamp(100, 1), 0); // Update the term so that the current term is ahead of the term of @@ -1790,8 +1764,8 @@ TEST_F(TakeoverTest, SchedulesPriorityTakeoverIfNodeHasHigherPriorityThanCurrent OperationContextNoop opCtx; OpTime myOptime(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(myOptime, Date_t::min() + Seconds(myOptime.getSecs())); - replCoordSetMyLastDurableOpTime(myOptime, Date_t::min() + Seconds(myOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(myOptime, Date_t() + Seconds(myOptime.getSecs())); + replCoordSetMyLastDurableOpTime(myOptime, Date_t() + Seconds(myOptime.getSecs())); // Make sure we're secondary and that no priority takeover has been scheduled. ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); @@ -1837,8 +1811,8 @@ TEST_F(TakeoverTest, SuccessfulPriorityTakeover) { OperationContextNoop opCtx; OpTime myOptime(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(myOptime, Date_t::min() + Seconds(myOptime.getSecs())); - replCoordSetMyLastDurableOpTime(myOptime, Date_t::min() + Seconds(myOptime.getSecs())); + replCoordSetMyLastAppliedOpTime(myOptime, Date_t() + Seconds(myOptime.getSecs())); + replCoordSetMyLastDurableOpTime(myOptime, Date_t() + Seconds(myOptime.getSecs())); // Make sure we're secondary and that no priority takeover has been scheduled. ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); @@ -1896,8 +1870,8 @@ TEST_F(TakeoverTest, DontCallForPriorityTakeoverWhenLaggedSameSecond) { OpTime behindOpTime(Timestamp(100, 3999), 0); OpTime closeEnoughOpTime(Timestamp(100, 4000), 0); - replCoordSetMyLastAppliedOpTime(behindOpTime, Date_t::min() + Seconds(behindOpTime.getSecs())); - replCoordSetMyLastDurableOpTime(behindOpTime, Date_t::min() + Seconds(behindOpTime.getSecs())); + replCoordSetMyLastAppliedOpTime(behindOpTime, Date_t() + Seconds(behindOpTime.getSecs())); + replCoordSetMyLastDurableOpTime(behindOpTime, Date_t() + Seconds(behindOpTime.getSecs())); // Make sure we're secondary and that no priority takeover has been scheduled. ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); @@ -1937,9 +1911,9 @@ TEST_F(TakeoverTest, DontCallForPriorityTakeoverWhenLaggedSameSecond) { // Now make us caught up enough to call for priority takeover to succeed. replCoordSetMyLastAppliedOpTime(closeEnoughOpTime, - Date_t::min() + Seconds(closeEnoughOpTime.getSecs())); + Date_t() + Seconds(closeEnoughOpTime.getSecs())); replCoordSetMyLastDurableOpTime(closeEnoughOpTime, - Date_t::min() + Seconds(closeEnoughOpTime.getSecs())); + Date_t() + Seconds(closeEnoughOpTime.getSecs())); LastVote lastVoteExpected = LastVote(replCoord->getTerm() + 1, 0); performSuccessfulTakeover(priorityTakeoverTime, @@ -1974,8 +1948,8 @@ TEST_F(TakeoverTest, DontCallForPriorityTakeoverWhenLaggedDifferentSecond) { OpTime currentOpTime(Timestamp(100, 1), 0); OpTime behindOpTime(Timestamp(97, 1), 0); OpTime closeEnoughOpTime(Timestamp(98, 1), 0); - replCoordSetMyLastAppliedOpTime(behindOpTime, Date_t::min() + Seconds(behindOpTime.getSecs())); - replCoordSetMyLastDurableOpTime(behindOpTime, Date_t::min() + Seconds(behindOpTime.getSecs())); + replCoordSetMyLastAppliedOpTime(behindOpTime, Date_t() + Seconds(behindOpTime.getSecs())); + replCoordSetMyLastDurableOpTime(behindOpTime, Date_t() + Seconds(behindOpTime.getSecs())); // Make sure we're secondary and that no priority takeover has been scheduled. ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); @@ -2016,9 +1990,9 @@ TEST_F(TakeoverTest, DontCallForPriorityTakeoverWhenLaggedDifferentSecond) { // Now make us caught up enough to call for priority takeover to succeed. replCoordSetMyLastAppliedOpTime(closeEnoughOpTime, - Date_t::min() + Seconds(closeEnoughOpTime.getSecs())); + Date_t() + Seconds(closeEnoughOpTime.getSecs())); replCoordSetMyLastDurableOpTime(closeEnoughOpTime, - Date_t::min() + Seconds(closeEnoughOpTime.getSecs())); + Date_t() + Seconds(closeEnoughOpTime.getSecs())); LastVote lastVoteExpected = LastVote(replCoord->getTerm() + 1, 0); performSuccessfulTakeover(priorityTakeoverTime, @@ -2045,8 +2019,8 @@ TEST_F(ReplCoordTest, NodeCancelsElectionUponReceivingANewConfigDuringDryRun) { << BSON("heartbeatIntervalMillis" << 100)), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateEnoughHeartbeatsForAllNodesUp(); // Advance to dry run vote request phase. @@ -2110,8 +2084,8 @@ TEST_F(ReplCoordTest, NodeCancelsElectionUponReceivingANewConfigDuringVotePhase) << BSON("heartbeatIntervalMillis" << 100)), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateEnoughHeartbeatsForAllNodesUp(); simulateSuccessfulDryRun(); ASSERT(TopologyCoordinator::Role::kCandidate == getTopoCoord().getRole()); @@ -2154,8 +2128,8 @@ protected: hbResp.setSetName(rsConfig.getReplSetName()); hbResp.setState(MemberState::RS_SECONDARY); hbResp.setConfigVersion(rsConfig.getConfigVersion()); - hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t::min() + Seconds(opTime.getSecs())}); - hbResp.setDurableOpTimeAndWallTime({opTime, Date_t::min() + Seconds(opTime.getSecs())}); + hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t() + Seconds(opTime.getSecs())}); + hbResp.setDurableOpTimeAndWallTime({opTime, Date_t() + Seconds(opTime.getSecs())}); return makeResponseStatus(hbResp.toBSON()); } @@ -2224,8 +2198,8 @@ protected: assertStartSuccess(configObj, HostAndPort("node1", 12345)); ReplSetConfig config = assertMakeRSConfig(configObj); - replCoordSetMyLastAppliedOpTime(opTime, Date_t::min() + Seconds(opTime.getSecs())); - replCoordSetMyLastDurableOpTime(opTime, Date_t::min() + Seconds(opTime.getSecs())); + replCoordSetMyLastAppliedOpTime(opTime, Date_t() + Seconds(opTime.getSecs())); + replCoordSetMyLastDurableOpTime(opTime, Date_t() + Seconds(opTime.getSecs())); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); simulateSuccessfulV1Voting(); @@ -2288,7 +2262,7 @@ protected: // Simulate the work done by bgsync and applier threads. setMyLastAppliedOpTime() will signal // the optime waiter. - void advanceMyLastAppliedOpTime(OpTime opTime, Date_t wallTime = Date_t::min()) { + void advanceMyLastAppliedOpTime(OpTime opTime, Date_t wallTime = Date_t()) { replCoordSetMyLastAppliedOpTime(opTime, wallTime); getNet()->enterNetwork(); getNet()->runReadyNetworkOperations(); @@ -2334,7 +2308,7 @@ TEST_F(PrimaryCatchUpTest, CatchupSucceeds) { net->scheduleResponse(noi, net->now(), makeHeartbeatResponse(time2)); }); ASSERT(getReplCoord()->getApplierState() == ApplierState::Running); - advanceMyLastAppliedOpTime(time2, Date_t::min() + Seconds(time2.getSecs())); + advanceMyLastAppliedOpTime(time2, Date_t() + Seconds(time2.getSecs())); ASSERT(getReplCoord()->getApplierState() == ApplierState::Draining); stopCapturingLogMessages(); ASSERT_EQUALS(1, countLogLinesContaining("Caught up to the latest known optime successfully")); @@ -2480,7 +2454,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryStepsDownDuringDrainMode) { }); ReplicationCoordinatorImpl* replCoord = getReplCoord(); ASSERT(getReplCoord()->getApplierState() == ApplierState::Running); - advanceMyLastAppliedOpTime(time2, Date_t::min() + Seconds(time2.getSecs())); + advanceMyLastAppliedOpTime(time2, Date_t() + Seconds(time2.getSecs())); ASSERT(replCoord->getApplierState() == ApplierState::Draining); stopCapturingLogMessages(); ASSERT_EQUALS(1, countLogLinesContaining("Caught up to the latest")); @@ -2542,7 +2516,7 @@ TEST_F(PrimaryCatchUpTest, FreshestNodeBecomesAvailableLater) { ASSERT_EQ(1, countLogLinesContaining("Heartbeats updated catchup target optime")); // 3) Advancing its applied optime to time 2 isn't enough. - advanceMyLastAppliedOpTime(time2, Date_t::min() + Seconds(time2.getSecs())); + advanceMyLastAppliedOpTime(time2, Date_t() + Seconds(time2.getSecs())); ASSERT(getReplCoord()->getApplierState() == ApplierState::Running); // 4) After a while, the other node at time 4 becomes available. Time 4 becomes the new target. @@ -2562,12 +2536,12 @@ TEST_F(PrimaryCatchUpTest, FreshestNodeBecomesAvailableLater) { ASSERT_EQ(1, countLogLinesContaining("Heartbeats updated catchup target optime")); // 5) Advancing to time 3 isn't enough now. - advanceMyLastAppliedOpTime(time3, Date_t::min() + Seconds(time3.getSecs())); + advanceMyLastAppliedOpTime(time3, Date_t() + Seconds(time3.getSecs())); ASSERT(getReplCoord()->getApplierState() == ApplierState::Running); // 6) The node catches up time 4 eventually. startCapturingLogMessages(); - advanceMyLastAppliedOpTime(time4, Date_t::min() + Seconds(time4.getSecs())); + advanceMyLastAppliedOpTime(time4, Date_t() + Seconds(time4.getSecs())); ASSERT(getReplCoord()->getApplierState() == ApplierState::Draining); stopCapturingLogMessages(); ASSERT_EQ(1, countLogLinesContaining("Caught up to the latest")); diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp index 361cb5f4883..53eedf88523 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp @@ -126,8 +126,8 @@ TEST_F(ReplCoordHBV1Test, hbResp.setConfig(rsConfig); // The smallest valid optime in PV1. OpTime opTime(Timestamp(), 0); - hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t::min()}); - hbResp.setDurableOpTimeAndWallTime({opTime, Date_t::min()}); + hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t()}); + hbResp.setDurableOpTimeAndWallTime({opTime, Date_t()}); BSONObjBuilder responseBuilder; responseBuilder << "ok" << 1; hbResp.addToBSON(&responseBuilder); @@ -200,8 +200,8 @@ TEST_F(ReplCoordHBV1Test, hbResp.setConfig(rsConfig); // The smallest valid optime in PV1. OpTime opTime(Timestamp(), 0); - hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t::min()}); - hbResp.setDurableOpTimeAndWallTime({opTime, Date_t::min()}); + hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t()}); + hbResp.setDurableOpTimeAndWallTime({opTime, Date_t()}); BSONObjBuilder responseBuilder; responseBuilder << "ok" << 1; hbResp.addToBSON(&responseBuilder); @@ -274,8 +274,8 @@ TEST_F(ReplCoordHBV1Test, hbResp.setConfig(rsConfig); // The smallest valid optime in PV1. OpTime opTime(Timestamp(), 0); - hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t::min()}); - hbResp.setDurableOpTimeAndWallTime({opTime, Date_t::min()}); + hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t()}); + hbResp.setDurableOpTimeAndWallTime({opTime, Date_t()}); BSONObjBuilder responseBuilder; responseBuilder << "ok" << 1; hbResp.addToBSON(&responseBuilder); @@ -386,15 +386,15 @@ TEST_F(ReplCoordHBV1Test, IgnoreTheContentsOfMetadataWhenItsReplicaSetIdDoesNotM hbResp.setSetName(rsConfig.getReplSetName()); hbResp.setState(MemberState::RS_PRIMARY); hbResp.setConfigVersion(rsConfig.getConfigVersion()); - hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t::min()}); - hbResp.setDurableOpTimeAndWallTime({opTime, Date_t::min()}); + hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t()}); + hbResp.setDurableOpTimeAndWallTime({opTime, Date_t()}); BSONObjBuilder responseBuilder; responseBuilder << "ok" << 1; hbResp.addToBSON(&responseBuilder); rpc::ReplSetMetadata metadata(opTime.getTerm(), - {opTime, Date_t::min()}, + {opTime, Date_t()}, opTime, rsConfig.getConfigVersion(), unexpectedId, diff --git a/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp index e1490b238d2..3fad34dfe2a 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp @@ -83,8 +83,8 @@ TEST_F(ReplCoordTest, NodeReturnsNotMasterWhenReconfigReceivedWhileSecondary) { HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); BSONObjBuilder result; ReplSetReconfigArgs args; @@ -108,8 +108,8 @@ TEST_F(ReplCoordTest, NodeReturnsInvalidReplicaSetConfigWhenReconfigReceivedWith << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); BSONObjBuilder result; @@ -152,8 +152,8 @@ TEST_F(ReplCoordTest, NodeReturnsInvalidReplicaSetConfigWhenReconfigReceivedWith << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); BSONObjBuilder result; @@ -192,8 +192,8 @@ TEST_F(ReplCoordTest, NodeReturnsInvalidReplicaSetConfigWhenReconfigReceivedWith << BSON("replicaSetId" << OID::gen())), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); BSONObjBuilder result; @@ -233,8 +233,8 @@ TEST_F(ReplCoordTest, << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); BSONObjBuilder result; @@ -314,8 +314,8 @@ TEST_F(ReplCoordTest, << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); Status status(ErrorCodes::InternalError, "Not Set"); @@ -333,10 +333,8 @@ TEST_F(ReplCoordTest, hbResp.setState(MemberState::RS_SECONDARY); hbResp.setConfigVersion(5); BSONObjBuilder respObj; - hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); respObj << "ok" << 1; hbResp.addToBSON(&respObj); net->scheduleResponse(noi, net->now(), makeResponseStatus(respObj.obj())); @@ -359,8 +357,8 @@ TEST_F(ReplCoordTest, NodeReturnsOutOfDiskSpaceWhenSavingANewConfigFailsDuringRe << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); Status status(ErrorCodes::InternalError, "Not Set"); @@ -388,8 +386,8 @@ TEST_F(ReplCoordTest, << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); Status status(ErrorCodes::InternalError, "Not Set"); @@ -428,8 +426,8 @@ TEST_F(ReplCoordTest, NodeReturnsConfigurationInProgressWhenReceivingAReconfigWh init(); start(HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); // initiate Status status(ErrorCodes::InternalError, "Not Set"); @@ -477,8 +475,8 @@ TEST_F(ReplCoordTest, PrimaryNodeAcceptsNewConfigWhenReceivingAReconfigWithAComp << BSON("replicaSetId" << OID::gen())), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); Status status(ErrorCodes::InternalError, "Not Set"); @@ -495,10 +493,8 @@ TEST_F(ReplCoordTest, PrimaryNodeAcceptsNewConfigWhenReceivingAReconfigWithAComp hbResp.setSetName("mySet"); hbResp.setState(MemberState::RS_SECONDARY); hbResp.setConfigVersion(2); - hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); BSONObjBuilder respObj; respObj << "ok" << 1; hbResp.addToBSON(&respObj); @@ -525,8 +521,8 @@ TEST_F( << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ASSERT_TRUE(getReplCoord()->getMemberState().primary()); @@ -556,10 +552,8 @@ TEST_F( hbResp2.setConfigVersion(3); hbResp2.setSetName("mySet"); hbResp2.setState(MemberState::RS_SECONDARY); - hbResp2.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp2.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp2.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp2.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); BSONObjBuilder respObj2; respObj2 << "ok" << 1; hbResp2.addToBSON(&respObj2); @@ -596,8 +590,8 @@ TEST_F(ReplCoordTest, NodeDoesNotAcceptHeartbeatReconfigWhileInTheMidstOfReconfi << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ASSERT_TRUE(getReplCoord()->getMemberState().primary()); @@ -632,10 +626,8 @@ TEST_F(ReplCoordTest, NodeDoesNotAcceptHeartbeatReconfigWhileInTheMidstOfReconfi hbResp.setConfigVersion(4); hbResp.setSetName("mySet"); hbResp.setState(MemberState::RS_SECONDARY); - hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); BSONObjBuilder respObj2; respObj2 << "ok" << 1; hbResp.addToBSON(&respObj2); @@ -669,8 +661,8 @@ TEST_F(ReplCoordTest, NodeAcceptsConfigFromAReconfigWithForceTrueWhileNotPrimary << "node2:12345"))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); // fail before forced BSONObjBuilder result; diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index 821c2d71202..9ea83b95b73 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -105,7 +105,7 @@ struct OpTimeWithTermOne { Timestamp timestamp; }; -OpTimeAndWallTime makeOpTimeAndWallTime(OpTime opTime, Date_t wallTime = Date_t::min()) { +OpTimeAndWallTime makeOpTimeAndWallTime(OpTime opTime, Date_t wallTime = Date_t()) { return {opTime, wallTime}; } @@ -133,8 +133,8 @@ TEST_F(ReplCoordTest, IsMasterIsFalseDuringStepdown) { ReplSetConfig config = assertMakeRSConfig(configObj); auto replCoord = getReplCoord(); ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ASSERT(replCoord->getMemberState().primary()); @@ -421,7 +421,7 @@ TEST_F(ReplCoordTest, InitiateSucceedsWhenQuorumCheckPasses) { hbArgs.setHeartbeatVersion(1); auto appliedTS = Timestamp(3, 3); - replCoordSetMyLastAppliedOpTime(OpTime(appliedTS, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(appliedTS, 1), Date_t() + Seconds(100)); Status status(ErrorCodes::InternalError, "Not set"); stdx::thread prsiThread([&] { doReplSetInitiate(getReplCoord(), &status); }); @@ -433,10 +433,8 @@ TEST_F(ReplCoordTest, InitiateSucceedsWhenQuorumCheckPasses) { ASSERT_BSONOBJ_EQ(hbArgs.toBSON(), noi->getRequest().cmdObj); ReplSetHeartbeatResponse hbResp; hbResp.setConfigVersion(0); - hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); getNet()->scheduleResponse( noi, startDate + Milliseconds(10), RemoteCommandResponse(hbResp.toBSON(), Milliseconds(8))); getNet()->runUntil(startDate + Milliseconds(10)); @@ -710,8 +708,8 @@ TEST_F(ReplCoordTest, NodeReturnsOkWhenRunningAwaitReplicationAgainstPrimaryWith // Become primary. ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ASSERT(getReplCoord()->getMemberState().primary()); @@ -747,8 +745,8 @@ TEST_F(ReplCoordTest, << 3))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTimeWithTermOne time1(100, 2); @@ -764,8 +762,8 @@ TEST_F(ReplCoordTest, ReplicationCoordinator::StatusAndDuration statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time1, writeConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time1, writeConcern); ASSERT_OK(statusAndDur.status); @@ -784,8 +782,8 @@ TEST_F(ReplCoordTest, // 2 nodes waiting for time2 statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 2, time2)); @@ -827,8 +825,8 @@ TEST_F(ReplCoordTest, NodeReturnsWriteConcernFailedUntilASufficientNumberOfNodes << 3))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTimeWithTermOne time1(100, 2); @@ -845,8 +843,8 @@ TEST_F(ReplCoordTest, NodeReturnsWriteConcernFailedUntilASufficientNumberOfNodes ReplicationCoordinator::StatusAndDuration statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time1, writeConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time1, writeConcern); ASSERT_OK(statusAndDur.status); @@ -861,8 +859,8 @@ TEST_F(ReplCoordTest, NodeReturnsWriteConcernFailedUntilASufficientNumberOfNodes // 2 nodes waiting for time2 statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 2, time2)); @@ -898,8 +896,8 @@ TEST_F(ReplCoordTest, << "node4"))), HostAndPort("node0")); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTime time1(Timestamp(100, 1), 1); @@ -965,8 +963,8 @@ TEST_F( << BSON("dc" << 2 << "rack" << 3)))), HostAndPort("node0")); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTime time1(Timestamp(100, 2), 1); @@ -988,8 +986,8 @@ TEST_F( auto opCtx = makeOperationContext(); // Nothing satisfied - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); ReplicationCoordinator::StatusAndDuration statusAndDur = getReplCoord()->awaitReplication(opCtx.get(), time1, majorityWriteConcern); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, statusAndDur.status); @@ -1023,8 +1021,8 @@ TEST_F( ASSERT_OK(statusAndDur.status); // multiDC satisfied but not majority or multiRack - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); getReplCoord()->setLastAppliedOptime_forTest(2, 3, time2).transitional_ignore(); getReplCoord()->setLastDurableOptime_forTest(2, 3, time2).transitional_ignore(); @@ -1121,8 +1119,8 @@ TEST_F(ReplCoordTest, NodeReturnsOkWhenAWriteConcernWithNoTimeoutHasBeenSatisfie << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ReplicationAwaiter awaiter(getReplCoord(), getServiceContext()); @@ -1138,8 +1136,8 @@ TEST_F(ReplCoordTest, NodeReturnsOkWhenAWriteConcernWithNoTimeoutHasBeenSatisfie awaiter.setOpTime(time1); awaiter.setWriteConcern(writeConcern); awaiter.start(); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 1, time1)); ReplicationCoordinator::StatusAndDuration statusAndDur = awaiter.getResult(); ASSERT_OK(statusAndDur.status); @@ -1148,8 +1146,8 @@ TEST_F(ReplCoordTest, NodeReturnsOkWhenAWriteConcernWithNoTimeoutHasBeenSatisfie // 2 nodes waiting for time2 awaiter.setOpTime(time2); awaiter.start(); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 1, time2)); statusAndDur = awaiter.getResult(); ASSERT_OK(statusAndDur.status); @@ -1185,8 +1183,8 @@ TEST_F(ReplCoordTest, NodeReturnsWriteConcernFailedWhenAWriteConcernTimesOutBefo << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ReplicationAwaiter awaiter(getReplCoord(), getServiceContext()); @@ -1202,8 +1200,8 @@ TEST_F(ReplCoordTest, NodeReturnsWriteConcernFailedWhenAWriteConcernTimesOutBefo awaiter.setOpTime(time2); awaiter.setWriteConcern(writeConcern); awaiter.start(); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 1, time1)); { NetworkInterfaceMock::InNetworkGuard inNet(getNet()); @@ -1236,8 +1234,8 @@ TEST_F(ReplCoordTest, << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ReplicationAwaiter awaiter(getReplCoord(), getServiceContext()); @@ -1286,8 +1284,8 @@ TEST_F(ReplCoordTest, NodeReturnsNotMasterWhenSteppingDownBeforeSatisfyingAWrite << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); const auto opCtx = makeOperationContext(); @@ -1328,8 +1326,8 @@ TEST_F(ReplCoordTest, << "node3"))), HostAndPort("node1")); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ReplicationAwaiter awaiter(getReplCoord(), getServiceContext()); @@ -1393,10 +1391,10 @@ protected: } // Makes it so enough secondaries are caught up that a stepdown command can succeed. - void catchUpSecondaries(const OpTime& desiredOpTime, Date_t desiredWallTime = Date_t::min()) { + void catchUpSecondaries(const OpTime& desiredOpTime, Date_t desiredWallTime = Date_t()) { auto config = getReplCoord()->getConfig(); auto heartbeatInterval = config.getHeartbeatInterval(); - if (desiredWallTime == Date_t::min() && !desiredOpTime.isNull()) { + if (desiredWallTime == Date_t() && !desiredOpTime.isNull()) { desiredWallTime = Date_t() + Seconds(desiredOpTime.getSecs()); } @@ -1560,8 +1558,8 @@ TEST_F(ReplCoordTest, ElectionIdTracksTermInPV1) { << "protocolVersion" << 1), HostAndPort("test1", 1234)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); ASSERT_TRUE(getReplCoord()->getMemberState().secondary()); @@ -1624,8 +1622,8 @@ TEST_F(ReplCoordTest, NodeChangesTermAndStepsDownWhenAndOnlyWhenUpdateTermSuppli << "protocolVersion" << 1), HostAndPort("test1", 1234)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); ASSERT_TRUE(getReplCoord()->getMemberState().secondary()); @@ -1670,8 +1668,8 @@ TEST_F(ReplCoordTest, ConcurrentStepDownShouldNotSignalTheSameFinishEventMoreTha << "protocolVersion" << 1), HostAndPort("test1", 1234)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); ASSERT_TRUE(getReplCoord()->getMemberState().secondary()); @@ -1726,8 +1724,8 @@ TEST_F(ReplCoordTest, DrainCompletionMidStepDown) { << "protocolVersion" << 1), HostAndPort("test1", 1234)); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); ASSERT_TRUE(getReplCoord()->getMemberState().secondary()); @@ -1763,8 +1761,8 @@ TEST_F(StepDownTest, StepDownCanCompleteBasedOnReplSetUpdatePositionAlone) { OpTimeWithTermOne opTime1(100, 1); OpTimeWithTermOne opTime2(200, 1); - replCoordSetMyLastAppliedOpTime(opTime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(opTime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(opTime2, Date_t() + Seconds(100)); // Secondaries not caught up yet. ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, opTime1)); @@ -1795,11 +1793,11 @@ TEST_F(StepDownTest, StepDownCanCompleteBasedOnReplSetUpdatePositionAlone) { << UpdatePositionArgs::kAppliedOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs()) + << Date_t() + Seconds(opTime2.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs())) + << Date_t() + Seconds(opTime2.asOpTime().getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << configVersion << UpdatePositionArgs::kMemberIdFieldName @@ -1807,11 +1805,11 @@ TEST_F(StepDownTest, StepDownCanCompleteBasedOnReplSetUpdatePositionAlone) { << UpdatePositionArgs::kAppliedOpTimeFieldName << opTime1.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(opTime1.asOpTime().getSecs()) + << Date_t() + Seconds(opTime1.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << opTime1.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(opTime1.asOpTime().getSecs())))))); + << Date_t() + Seconds(opTime1.asOpTime().getSecs())))))); ASSERT_OK(repl->processReplSetUpdatePosition(updatePositionArgs, &configVersion)); @@ -1826,8 +1824,8 @@ TEST_F(StepDownTest, StepDownFailureRestoresDrainState) { OpTimeWithTermOne opTime1(100, 1); OpTimeWithTermOne opTime2(200, 1); - replCoordSetMyLastAppliedOpTime(opTime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(opTime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(opTime2, Date_t() + Seconds(100)); // Secondaries not caught up yet. ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, opTime1)); @@ -1913,8 +1911,8 @@ TEST_F(StepDownTestWithUnelectableNode, OpTimeWithTermOne opTime1(100, 1); OpTimeWithTermOne opTime2(200, 1); - replCoordSetMyLastAppliedOpTime(opTime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(opTime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(opTime2, Date_t() + Seconds(100)); // No secondaries are caught up yet. ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, opTime1)); @@ -1947,11 +1945,11 @@ TEST_F(StepDownTestWithUnelectableNode, << UpdatePositionArgs::kAppliedOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs()) + << Date_t() + Seconds(opTime2.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs())) + << Date_t() + Seconds(opTime2.asOpTime().getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << configVersion << UpdatePositionArgs::kMemberIdFieldName @@ -1959,11 +1957,11 @@ TEST_F(StepDownTestWithUnelectableNode, << UpdatePositionArgs::kAppliedOpTimeFieldName << opTime1.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(opTime1.asOpTime().getSecs()) + << Date_t() + Seconds(opTime1.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << opTime1.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(opTime1.asOpTime().getSecs())))))); + << Date_t() + Seconds(opTime1.asOpTime().getSecs())))))); ASSERT_OK(repl->processReplSetUpdatePosition(catchupFirstSecondary, &configVersion)); @@ -1986,11 +1984,11 @@ TEST_F(StepDownTestWithUnelectableNode, << UpdatePositionArgs::kAppliedOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs()) + << Date_t() + Seconds(opTime2.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs())) + << Date_t() + Seconds(opTime2.asOpTime().getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << configVersion << UpdatePositionArgs::kMemberIdFieldName @@ -1998,11 +1996,11 @@ TEST_F(StepDownTestWithUnelectableNode, << UpdatePositionArgs::kAppliedOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs()) + << Date_t() + Seconds(opTime2.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << opTime2.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(opTime2.asOpTime().getSecs())))))); + << Date_t() + Seconds(opTime2.asOpTime().getSecs())))))); ASSERT_OK(repl->processReplSetUpdatePosition(catchupOtherSecondary, &configVersion)); @@ -2016,8 +2014,8 @@ TEST_F(StepDownTest, NodeReturnsNotMasterWhenAskedToStepDownAsANonPrimaryNode) { OpTimeWithTermOne optime1(100, 1); // All nodes are caught up - replCoordSetMyLastAppliedOpTime(optime1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime1, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2035,8 +2033,8 @@ TEST_F(StepDownTest, // Set up this test so that all nodes are caught up. This is necessary to exclude the false // positive case where stepDown returns "ExceededTimeLimit", but not because it could not // acquire the lock, but because it could not satisfy all stepdown conditions on time. - replCoordSetMyLastAppliedOpTime(optime1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime1, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2075,13 +2073,13 @@ protected: void simulateHeartbeatResponses(OpTime optimePrimary, OpTime optimeLagged, int numNodesCaughtUp, - Date_t wallTimePrimary = Date_t::min(), - Date_t wallTimeLagged = Date_t::min()) { + Date_t wallTimePrimary = Date_t(), + Date_t wallTimeLagged = Date_t()) { int hbNum = 1; - if (wallTimePrimary == Date_t::min()) { + if (wallTimePrimary == Date_t()) { wallTimePrimary = Date_t() + Seconds(optimePrimary.getSecs()); } - if (wallTimeLagged == Date_t::min()) { + if (wallTimeLagged == Date_t()) { wallTimeLagged = Date_t() + Seconds(optimeLagged.getSecs()); } while (getNet()->hasReadyRequests()) { @@ -2147,8 +2145,8 @@ TEST_F(StepDownTestFiveNode, OpTime optimePrimary(Timestamp(100, 2), 1); // All nodes are caught up - replCoordSetMyLastAppliedOpTime(optimePrimary, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optimePrimary, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optimePrimary, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optimePrimary, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optimeLagged)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 2, optimeLagged)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 3, optimeLagged)); @@ -2184,8 +2182,8 @@ TEST_F( OpTime optimePrimary(Timestamp(100, 2), 1); // All nodes are caught up - replCoordSetMyLastAppliedOpTime(optimePrimary, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optimePrimary, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optimePrimary, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optimePrimary, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optimeLagged)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 2, optimeLagged)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 3, optimeLagged)); @@ -2273,8 +2271,8 @@ TEST_F(ReplCoordTest, SingleNodeReplSetUnfreeze) { // Become Secondary. ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); ASSERT_TRUE(getTopoCoord().getMemberState().secondary()); ASSERT_TRUE(getReplCoord()->getMemberState().secondary()); @@ -2377,8 +2375,8 @@ TEST_F(StepDownTest, OpTimeWithTermOne optime2(100, 2); // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2415,8 +2413,8 @@ TEST_F(StepDownTest, // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2427,7 +2425,7 @@ TEST_F(StepDownTest, // Step down where the secondary actually has to catch up before the stepDown can succeed. auto result = stepDown_nonBlocking(false, Seconds(10), Seconds(60)); - catchUpSecondaries(optime2, Date_t::min() + Seconds(optime2.getSecs())); + catchUpSecondaries(optime2, Date_t() + Seconds(optime2.getSecs())); ASSERT_OK(*result.second.get()); ASSERT_TRUE(repl->getMemberState().secondary()); @@ -2440,8 +2438,8 @@ TEST_F(StepDownTest, // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2485,8 +2483,8 @@ TEST_F(StepDownTest, NodeReturnsInterruptedWhenInterruptedDuringStepDown) { OpTimeWithTermOne optime2(100, 2); // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2507,8 +2505,8 @@ TEST_F(StepDownTest, OnlyOneStepDownCmdIsAllowedAtATime) { // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2544,8 +2542,8 @@ TEST_F(StepDownTest, UnconditionalStepDownFailsStepDownCommand) { // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2577,8 +2575,8 @@ TEST_F(StepDownTest, InterruptingStepDownCommandRestoresWriteAvailability) { // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2629,8 +2627,8 @@ TEST_F(StepDownTest, InterruptingAfterUnconditionalStepdownDoesNotRestoreWriteAv // No secondary is caught up auto repl = getReplCoord(); - replCoordSetMyLastAppliedOpTime(optime2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime2, Date_t() + Seconds(100)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 1, optime1)); ASSERT_OK(repl->setLastAppliedOptime_forTest(1, 2, optime1)); @@ -2724,8 +2722,8 @@ TEST_F(ReplCoordTest, NodeIncludesOtherMembersProgressInUpdatePositionCommand) { OpTime optime1({2, 1}, 1); OpTime optime2({100, 1}, 1); OpTime optime3({100, 2}, 1); - replCoordSetMyLastAppliedOpTime(optime1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime1, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optime2)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 2, optime3)); ASSERT_OK(getReplCoord()->setLastDurableOptime_forTest(1, 2, optime3)); @@ -2801,8 +2799,8 @@ TEST_F(ReplCoordTest, << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); // Can't unset maintenance mode if it was never set to begin with. Status status = getReplCoord()->setMaintenanceMode(false); @@ -2828,8 +2826,8 @@ TEST_F(ReplCoordTest, << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); // valid set ASSERT_OK(getReplCoord()->setMaintenanceMode(true)); ASSERT_TRUE(getReplCoord()->getMemberState().recovering()); @@ -2864,8 +2862,8 @@ TEST_F(ReplCoordTest, AllowAsManyUnsetMaintenanceModesAsThereHaveBeenSetMaintena << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); // Can set multiple times ASSERT_OK(getReplCoord()->setMaintenanceMode(true)); ASSERT_OK(getReplCoord()->setMaintenanceMode(true)); @@ -2898,8 +2896,8 @@ TEST_F(ReplCoordTest, SettingAndUnsettingMaintenanceModeShouldNotAffectRollbackS << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); // We must take the RSTL in mode X before transitioning to RS_ROLLBACK. const auto opCtx = makeOperationContext(); @@ -2944,8 +2942,8 @@ TEST_F(ReplCoordTest, DoNotAllowMaintenanceModeWhilePrimary) { << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); // Can't modify maintenance mode when PRIMARY simulateSuccessfulV1Election(); @@ -2983,8 +2981,8 @@ TEST_F(ReplCoordTest, DoNotAllowSettingMaintenanceModeWhileConductingAnElection) << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); // TODO this election shouldn't have to happen. simulateSuccessfulV1Election(); @@ -3053,8 +3051,8 @@ TEST_F(ReplCoordTest, OpTimeWithTermOne time1(100, 1); OpTimeWithTermOne time2(100, 2); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 1, time1)); ASSERT_OK(getReplCoord()->setLastDurableOptime_forTest(2, 1, time1)); @@ -3098,8 +3096,8 @@ TEST_F(ReplCoordTest, OpTimeWithTermOne time1(100, 1); OpTimeWithTermOne time2(100, 2); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 1, time1)); std::vector caughtUpHosts = getReplCoord()->getHostsWrittenTo(time2, false); @@ -3192,7 +3190,7 @@ TEST_F(ReplCoordTest, IsMaster) { time_t lastWriteDate = 100; OpTime opTime = OpTime(Timestamp(lastWriteDate, 2), 1); - replCoordSetMyLastAppliedOpTime(opTime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime, Date_t() + Seconds(100)); IsMasterResponse response; getReplCoord()->fillIsMasterForReplSet(&response, {}); @@ -3254,8 +3252,8 @@ TEST_F(ReplCoordTest, IsMasterWithCommittedSnapshot) { time_t majorityWriteDate = lastWriteDate; OpTime majorityOpTime = opTime; - replCoordSetMyLastAppliedOpTime(opTime, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(opTime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(opTime, Date_t() + Seconds(100)); ASSERT_EQUALS(majorityOpTime, getReplCoord()->getCurrentCommittedSnapshotOpTime()); IsMasterResponse response; @@ -3327,14 +3325,14 @@ TEST_F(ReplCoordTest, DoNotProcessSelfWhenUpdatePositionContainsInfoAboutSelf) { << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTime time1({100, 1}, 1); OpTime time2({100, 2}, 1); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); WriteConcernOptions writeConcern; writeConcern.wTimeout = WriteConcernOptions::kNoWaiting; @@ -3360,11 +3358,11 @@ TEST_F(ReplCoordTest, DoNotProcessSelfWhenUpdatePositionContainsInfoAboutSelf) { << UpdatePositionArgs::kDurableOpTimeFieldName << time2.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(time2.getSecs()) + << Date_t() + Seconds(time2.getSecs()) << UpdatePositionArgs::kAppliedOpTimeFieldName << time2.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(time2.getSecs())))))); + << Date_t() + Seconds(time2.getSecs())))))); ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, 0)); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, @@ -3391,14 +3389,14 @@ TEST_F(ReplCoordTest, DoNotProcessUpdatePositionWhenItsConfigVersionIsIncorrect) << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTime time1({100, 1}, 1); OpTime time2({100, 2}, 1); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); WriteConcernOptions writeConcern; writeConcern.wTimeout = WriteConcernOptions::kNoWaiting; @@ -3418,11 +3416,11 @@ TEST_F(ReplCoordTest, DoNotProcessUpdatePositionWhenItsConfigVersionIsIncorrect) << UpdatePositionArgs::kDurableOpTimeFieldName << time2.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(time2.getSecs()) + << Date_t() + Seconds(time2.getSecs()) << UpdatePositionArgs::kAppliedOpTimeFieldName << time2.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(time2.getSecs())))))); + << Date_t() + Seconds(time2.getSecs())))))); auto opCtx = makeOperationContext(); @@ -3454,14 +3452,14 @@ TEST_F(ReplCoordTest, DoNotProcessUpdatePositionOfMembersWhoseIdsAreNotInTheConf << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTime time1({100, 1}, 1); OpTime time2({100, 2}, 1); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); WriteConcernOptions writeConcern; writeConcern.wTimeout = WriteConcernOptions::kNoWaiting; @@ -3481,11 +3479,11 @@ TEST_F(ReplCoordTest, DoNotProcessUpdatePositionOfMembersWhoseIdsAreNotInTheConf << UpdatePositionArgs::kDurableOpTimeFieldName << time2.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(time2.getSecs()) + << Date_t() + Seconds(time2.getSecs()) << UpdatePositionArgs::kAppliedOpTimeFieldName << time2.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(time2.getSecs())))))); + << Date_t() + Seconds(time2.getSecs())))))); auto opCtx = makeOperationContext(); @@ -3516,23 +3514,23 @@ TEST_F(ReplCoordTest, << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTimeWithTermOne time1(100, 1); OpTimeWithTermOne time2(100, 2); OpTimeWithTermOne staleTime(10, 0); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time1, Date_t() + Seconds(100)); WriteConcernOptions writeConcern; writeConcern.wTimeout = WriteConcernOptions::kNoWaiting; writeConcern.wNumNodes = 1; // receive a good update position - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); UpdatePositionArgs args; ASSERT_OK(updatePositionArgsInitialize( args, @@ -3546,11 +3544,11 @@ TEST_F(ReplCoordTest, << UpdatePositionArgs::kAppliedOpTimeFieldName << time2.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(time2.asOpTime().getSecs()) + << Date_t() + Seconds(time2.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << time2.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(time2.asOpTime().getSecs())) + << Date_t() + Seconds(time2.asOpTime().getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << 2 << UpdatePositionArgs::kMemberIdFieldName @@ -3558,11 +3556,11 @@ TEST_F(ReplCoordTest, << UpdatePositionArgs::kAppliedOpTimeFieldName << time2.asOpTime().toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(time2.asOpTime().getSecs()) + << Date_t() + Seconds(time2.asOpTime().getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << time2.asOpTime().toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(time2.asOpTime().getSecs())))))); + << Date_t() + Seconds(time2.asOpTime().getSecs())))))); auto opCtx = makeOperationContext(); @@ -3624,8 +3622,8 @@ TEST_F(ReplCoordTest, AwaitReplicationShouldResolveAsNormalDuringAReconfig) { disableSnapshots(); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 2), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 2), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 2), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 2), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTimeWithTermOne time(100, 2); @@ -3717,8 +3715,8 @@ TEST_F( << 2))), HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 2), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 2), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 2), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 2), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTimeWithTermOne time(100, 2); @@ -3791,15 +3789,15 @@ TEST_F(ReplCoordTest, disableSnapshots(); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); OpTime time(Timestamp(100, 2), 1); auto opCtx = makeOperationContext(); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 1, time)); @@ -3876,8 +3874,8 @@ TEST_F(ReplCoordTest, HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); OpTime time(Timestamp(100, 1), 1); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); simulateSuccessfulV1Election(); WriteConcernOptions majorityWriteConcern; @@ -3945,8 +3943,8 @@ TEST_F(ReplCoordTest, ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); OpTime zero(Timestamp(0, 0), 0); OpTime time(Timestamp(100, 1), 1); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); simulateSuccessfulV1Election(); ASSERT_EQUALS(zero, getReplCoord()->getLastCommittedOpTime()); @@ -3965,8 +3963,8 @@ TEST_F(ReplCoordTest, // Set a new, later OpTime. OpTime newTime(Timestamp(100, 1), 1); - replCoordSetMyLastAppliedOpTime(newTime, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(newTime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(newTime, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(newTime, Date_t() + Seconds(100)); ASSERT_EQUALS(time, getReplCoord()->getLastCommittedOpTime()); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(2, 3, newTime)); ASSERT_OK(getReplCoord()->setLastDurableOptime_forTest(2, 3, newTime)); @@ -4026,31 +4024,31 @@ TEST_F(StableOpTimeTest, CalculateStableOpTime) { long long term = 0; // There is a valid stable optime less than the commit point. - commitPoint = {OpTime({0, 3}, term), Date_t::min()}; - stableOpTimeCandidates = {{OpTime({0, 0}, term), Date_t::min()}, - {OpTime({0, 1}, term), Date_t::min()}, + commitPoint = {OpTime({0, 3}, term), Date_t()}; + stableOpTimeCandidates = {{OpTime({0, 0}, term), Date_t()}, + {OpTime({0, 1}, term), Date_t()}, {OpTime({0, 2}, term), Date_t() + Seconds(20)}, - {OpTime({0, 4}, term), Date_t::min()}}; + {OpTime({0, 4}, term), Date_t()}}; expectedStableOpTime = makeOpTimeAndWallTime(OpTime({0, 2}, term), Date_t() + Seconds(20)); stableOpTime = repl->chooseStableOpTimeFromCandidates_forTest(stableOpTimeCandidates, commitPoint); ASSERT_EQ(expectedStableOpTime, stableOpTime); // There is a valid stable optime equal to the commit point. - commitPoint = {OpTime({0, 2}, term), Date_t::min()}; - stableOpTimeCandidates = {{OpTime({0, 0}, term), Date_t::min()}, - {OpTime({0, 1}, term), Date_t::min()}, + commitPoint = {OpTime({0, 2}, term), Date_t()}; + stableOpTimeCandidates = {{OpTime({0, 0}, term), Date_t()}, + {OpTime({0, 1}, term), Date_t()}, {OpTime({0, 2}, term), Date_t() + Seconds(30)}, - {OpTime({0, 3}, term), Date_t::min()}}; + {OpTime({0, 3}, term), Date_t()}}; expectedStableOpTime = makeOpTimeAndWallTime(OpTime({0, 2}, term), Date_t() + Seconds(30)); stableOpTime = repl->chooseStableOpTimeFromCandidates_forTest(stableOpTimeCandidates, commitPoint); ASSERT_EQ(expectedStableOpTime, stableOpTime); // There is a valid stable optime, all candidates are smaller than the commit point. - commitPoint = {OpTime({0, 4}, term), Date_t::min()}; - stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t::min()}, - {OpTime({0, 2}, term), Date_t::min()}, + commitPoint = {OpTime({0, 4}, term), Date_t()}; + stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t()}, + {OpTime({0, 2}, term), Date_t()}, {OpTime({0, 3}, term), Date_t() + Seconds(40)}}; expectedStableOpTime = makeOpTimeAndWallTime(OpTime({0, 3}, term), Date_t() + Seconds(40)); stableOpTime = @@ -4058,17 +4056,17 @@ TEST_F(StableOpTimeTest, CalculateStableOpTime) { ASSERT_EQ(expectedStableOpTime, stableOpTime); // There is no valid stable optime, all candidates are greater than the commit point. - commitPoint = {OpTime({0, 0}, term), Date_t::min()}; - stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t::min()}, - {OpTime({0, 2}, term), Date_t::min()}, - {OpTime({0, 3}, term), Date_t::min()}}; + commitPoint = {OpTime({0, 0}, term), Date_t()}; + stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t()}, + {OpTime({0, 2}, term), Date_t()}, + {OpTime({0, 3}, term), Date_t()}}; expectedStableOpTime = boost::none; stableOpTime = repl->chooseStableOpTimeFromCandidates_forTest(stableOpTimeCandidates, commitPoint); ASSERT_EQ(expectedStableOpTime, stableOpTime); // There are no timestamp candidates. - commitPoint = {OpTime({0, 0}, term), Date_t::min()}; + commitPoint = {OpTime({0, 0}, term), Date_t()}; stableOpTimeCandidates = {}; expectedStableOpTime = boost::none; stableOpTime = @@ -4076,7 +4074,7 @@ TEST_F(StableOpTimeTest, CalculateStableOpTime) { ASSERT_EQ(expectedStableOpTime, stableOpTime); // There is a single timestamp candidate which is equal to the commit point. - commitPoint = {OpTime({0, 1}, term), Date_t::min()}; + commitPoint = {OpTime({0, 1}, term), Date_t()}; stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t() + Seconds(60)}}; expectedStableOpTime = makeOpTimeAndWallTime(OpTime({0, 1}, term), Date_t() + Seconds(60)); stableOpTime = @@ -4084,15 +4082,15 @@ TEST_F(StableOpTimeTest, CalculateStableOpTime) { ASSERT_EQ(expectedStableOpTime, stableOpTime); // There is a single timestamp candidate which is greater than the commit point. - commitPoint = {OpTime({0, 0}, term), Date_t::min()}; - stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t::min()}}; + commitPoint = {OpTime({0, 0}, term), Date_t()}; + stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t()}}; expectedStableOpTime = boost::none; stableOpTime = repl->chooseStableOpTimeFromCandidates_forTest(stableOpTimeCandidates, commitPoint); ASSERT_EQ(expectedStableOpTime, stableOpTime); // There is a single timestamp candidate which is less than the commit point. - commitPoint = {OpTime({0, 2}, term), Date_t::min()}; + commitPoint = {OpTime({0, 2}, term), Date_t()}; stableOpTimeCandidates = {{OpTime({0, 1}, term), Date_t() + Seconds(70)}}; expectedStableOpTime = makeOpTimeAndWallTime(OpTime({0, 1}, term), Date_t() + Seconds(70)); stableOpTime = @@ -4193,16 +4191,16 @@ TEST_F(StableOpTimeTest, SetMyLastAppliedSetsStableOpTimeForStorage) { ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); getStorageInterface()->allCommittedTimestamp = Timestamp(1, 1); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(1, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(1, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(1, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(1, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); // Advance the commit point so it's higher than all the others. - replCoordAdvanceCommitPoint(OpTimeWithTermOne(10, 1), Date_t::min() + Seconds(100), false); + replCoordAdvanceCommitPoint(OpTimeWithTermOne(10, 1), Date_t() + Seconds(100), false); ASSERT_EQUALS(Timestamp(1, 1), getStorageInterface()->getStableTimestamp()); // Check that the stable timestamp is not updated if the all-committed timestamp is behind. - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(1, 2), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(1, 2), Date_t() + Seconds(100)); stableTimestamp = getStorageInterface()->getStableTimestamp(); ASSERT_EQUALS(Timestamp(1, 1), getStorageInterface()->getStableTimestamp()); @@ -4210,18 +4208,18 @@ TEST_F(StableOpTimeTest, SetMyLastAppliedSetsStableOpTimeForStorage) { // Check that the stable timestamp is updated for the storage engine when we set the applied // optime. - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(2, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(2, 1), Date_t() + Seconds(100)); stableTimestamp = getStorageInterface()->getStableTimestamp(); ASSERT_EQUALS(Timestamp(2, 1), stableTimestamp); // Check that timestamp cleanup occurs. - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(2, 2), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(2, 2), Date_t() + Seconds(100)); stableTimestamp = getStorageInterface()->getStableTimestamp(); ASSERT_EQUALS(Timestamp(2, 2), stableTimestamp); auto opTimeCandidates = repl->getStableOpTimeCandidates_forTest(); std::set expectedOpTimeCandidates = { - makeOpTimeAndWallTime(OpTimeWithTermOne(2, 2), Date_t::min() + Seconds(100))}; + makeOpTimeAndWallTime(OpTimeWithTermOne(2, 2), Date_t() + Seconds(100))}; ASSERT_OPTIME_SET_EQ(expectedOpTimeCandidates, opTimeCandidates); } @@ -4262,7 +4260,7 @@ TEST_F(StableOpTimeTest, SetMyLastAppliedSetsStableOpTimeForStorageDisableMajori // Check that the stable timestamp is updated for the storage engine when we set the applied // optime, even though the last committed optime is unset. getStorageInterface()->allCommittedTimestamp = Timestamp(1, 1); - replCoordSetMyLastAppliedOpTime(OpTime({1, 1}, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime({1, 1}, 1), Date_t() + Seconds(100)); ASSERT_EQUALS(Timestamp(1, 1), getStorageInterface()->getStableTimestamp()); } @@ -4290,8 +4288,8 @@ TEST_F(StableOpTimeTest, AdvanceCommitPointSetsStableOpTimeForStorage) { << "test3:1234"))), HostAndPort("test2", 1234)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(1, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(1, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(1, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(1, 1), Date_t() + Seconds(100)); simulateSuccessfulV1Election(); Timestamp stableTimestamp; @@ -4301,37 +4299,37 @@ TEST_F(StableOpTimeTest, AdvanceCommitPointSetsStableOpTimeForStorage) { getStorageInterface()->allCommittedTimestamp = Timestamp(2, 1); // Add three stable optime candidates. - replCoordSetMyLastAppliedOpTime(OpTime({2, 1}, term), Date_t::min() + Seconds(1)); - replCoordSetMyLastAppliedOpTime(OpTime({2, 2}, term), Date_t::min() + Seconds(2)); - replCoordSetMyLastAppliedOpTime(OpTime({3, 2}, term), Date_t::min() + Seconds(3)); + replCoordSetMyLastAppliedOpTime(OpTime({2, 1}, term), Date_t() + Seconds(1)); + replCoordSetMyLastAppliedOpTime(OpTime({2, 2}, term), Date_t() + Seconds(2)); + replCoordSetMyLastAppliedOpTime(OpTime({3, 2}, term), Date_t() + Seconds(3)); // Set a commit point and check the stable optime. - replCoordAdvanceCommitPoint(OpTime({2, 1}, term), Date_t::min() + Seconds(1), false); + replCoordAdvanceCommitPoint(OpTime({2, 1}, term), Date_t() + Seconds(1), false); ASSERT_EQUALS(getReplCoord()->getLastCommittedOpTimeAndWallTime().wallTime, - Date_t::min() + Seconds(1)); + Date_t() + Seconds(1)); stableTimestamp = getStorageInterface()->getStableTimestamp(); ASSERT_EQUALS(Timestamp(2, 1), stableTimestamp); // Check that the stable timestamp is not updated if the all-committed timestamp is behind. - replCoordAdvanceCommitPoint(OpTime({2, 2}, term), Date_t::min() + Seconds(2), false); + replCoordAdvanceCommitPoint(OpTime({2, 2}, term), Date_t() + Seconds(2), false); ASSERT_EQUALS(getReplCoord()->getLastCommittedOpTimeAndWallTime().wallTime, - Date_t::min() + Seconds(2)); + Date_t() + Seconds(2)); stableTimestamp = getStorageInterface()->getStableTimestamp(); ASSERT_EQUALS(Timestamp(2, 1), stableTimestamp); getStorageInterface()->allCommittedTimestamp = Timestamp(4, 4); // Check that the stable timestamp is updated when we advance the commit point. - replCoordAdvanceCommitPoint(OpTime({3, 2}, term), Date_t::min() + Seconds(3), false); + replCoordAdvanceCommitPoint(OpTime({3, 2}, term), Date_t() + Seconds(3), false); ASSERT_EQUALS(getReplCoord()->getLastCommittedOpTimeAndWallTime().wallTime, - Date_t::min() + Seconds(3)); + Date_t() + Seconds(3)); stableTimestamp = getStorageInterface()->getStableTimestamp(); ASSERT_EQUALS(Timestamp(3, 2), stableTimestamp); // Check that timestamp candidate cleanup occurs. auto opTimeCandidates = getReplCoord()->getStableOpTimeCandidates_forTest(); std::set expectedOpTimeCandidates = { - makeOpTimeAndWallTime(OpTime({3, 2}, term), Date_t::min() + Seconds(3))}; + makeOpTimeAndWallTime(OpTime({3, 2}, term), Date_t() + Seconds(3))}; ASSERT_OPTIME_SET_EQ(expectedOpTimeCandidates, opTimeCandidates); } @@ -4356,17 +4354,17 @@ TEST_F(StableOpTimeTest, ClearOpTimeCandidatesPastCommonPointAfterRollback) { OpTime rollbackCommonPoint = OpTime({1, 2}, term); OpTimeAndWallTime commitPoint = - makeOpTimeAndWallTime(OpTime({1, 2}, term), Date_t::min() + Seconds(100)); + makeOpTimeAndWallTime(OpTime({1, 2}, term), Date_t() + Seconds(100)); ASSERT_EQUALS(Timestamp::min(), getStorageInterface()->getStableTimestamp()); - replCoordSetMyLastAppliedOpTime(OpTime({0, 1}, term), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime({0, 1}, term), Date_t() + Seconds(100)); // Advance commit point when it has the same term as the last applied. replCoordAdvanceCommitPoint(commitPoint, false); - replCoordSetMyLastAppliedOpTime(OpTime({1, 1}, term), Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(OpTime({1, 2}, term), Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(OpTime({1, 3}, term), Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(OpTime({1, 4}, term), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime({1, 1}, term), Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime({1, 2}, term), Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime({1, 3}, term), Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime({1, 4}, term), Date_t() + Seconds(100)); // The stable timestamp should be equal to the commit point timestamp. const Timestamp stableTimestamp = getStorageInterface()->getStableTimestamp(); @@ -4376,9 +4374,9 @@ TEST_F(StableOpTimeTest, ClearOpTimeCandidatesPastCommonPointAfterRollback) { // The stable optime candidate set should contain optimes >= the stable optime. std::set opTimeCandidates = repl->getStableOpTimeCandidates_forTest(); std::set expectedOpTimeCandidates = { - makeOpTimeAndWallTime(OpTime({1, 2}, term), Date_t::min() + Seconds(100)), - makeOpTimeAndWallTime(OpTime({1, 3}, term), Date_t::min() + Seconds(100)), - makeOpTimeAndWallTime(OpTime({1, 4}, term), Date_t::min() + Seconds(100))}; + makeOpTimeAndWallTime(OpTime({1, 2}, term), Date_t() + Seconds(100)), + makeOpTimeAndWallTime(OpTime({1, 3}, term), Date_t() + Seconds(100)), + makeOpTimeAndWallTime(OpTime({1, 4}, term), Date_t() + Seconds(100))}; ASSERT_OPTIME_SET_EQ(expectedOpTimeCandidates, opTimeCandidates); // We must take the RSTL in mode X before transitioning to RS_ROLLBACK. @@ -4391,8 +4389,8 @@ TEST_F(StableOpTimeTest, ClearOpTimeCandidatesPastCommonPointAfterRollback) { ASSERT_OPTIME_SET_EQ(expectedOpTimeCandidates, opTimeCandidates); // Simulate a rollback to the common point. - getExternalState()->setLastOpTimeAndWallTime( - rollbackCommonPoint, Date_t::min() + Seconds(rollbackCommonPoint.getSecs())); + getExternalState()->setLastOpTimeAndWallTime(rollbackCommonPoint, + Date_t() + Seconds(rollbackCommonPoint.getSecs())); repl->resetLastOpTimesFromOplog(opCtx.get(), ReplicationCoordinator::DataConsistency::Inconsistent); @@ -4416,11 +4414,11 @@ TEST_F(StableOpTimeTest, OpTimeCandidatesAreNotAddedWhenStateIsNotConsistent) { long long term = getTopoCoord().getTerm(); OpTimeAndWallTime consistentOpTime = - makeOpTimeAndWallTime(OpTime({1, 1}, term), Date_t::min() + Seconds(100)); + makeOpTimeAndWallTime(OpTime({1, 1}, term), Date_t() + Seconds(100)); OpTimeAndWallTime inconsistentOpTime = - makeOpTimeAndWallTime(OpTime({1, 2}, term), Date_t::min() + Seconds(100)); + makeOpTimeAndWallTime(OpTime({1, 2}, term), Date_t() + Seconds(100)); std::set expectedOpTimeCandidates = { - makeOpTimeAndWallTime(OpTime({1, 1}, term), Date_t::min() + Seconds(100))}; + makeOpTimeAndWallTime(OpTime({1, 1}, term), Date_t() + Seconds(100))}; // Set the lastApplied optime forward when data is consistent, and check that it was added to // the candidate set. @@ -4452,8 +4450,8 @@ TEST_F(ReplCoordTest, NodeReturnsShutdownInProgressWhenWaitingUntilAnOpTimeDurin << 0))), HostAndPort("node1", 12345)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(10, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(10, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(10, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(10, 1), Date_t() + Seconds(100)); auto opCtx = makeOperationContext(); @@ -4477,8 +4475,8 @@ TEST_F(ReplCoordTest, NodeReturnsInterruptedWhenWaitingUntilAnOpTimeIsInterrupte << 0))), HostAndPort("node1", 12345)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(10, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(10, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(10, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(10, 1), Date_t() + Seconds(100)); const auto opCtx = makeOperationContext(); killOperation(opCtx.get()); @@ -4518,8 +4516,8 @@ TEST_F(ReplCoordTest, NodeReturnsOkImmediatelyWhenWaitingUntilOpTimePassesAnOpTi << 0))), HostAndPort("node1", 12345)); - replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100)); auto opCtx = makeOperationContext(); @@ -4542,8 +4540,8 @@ TEST_F(ReplCoordTest, NodeReturnsOkImmediatelyWhenWaitingUntilOpTimePassesAnOpTi OpTimeWithTermOne time(100, 1); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); auto opCtx = makeOperationContext(); @@ -4590,8 +4588,8 @@ TEST_F(ReplCoordTest, ReadAfterCommittedWhileShutdown) { auto opCtx = makeOperationContext(); runSingleNodeElection(opCtx.get()); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(100)); shutdown(opCtx.get()); @@ -4615,8 +4613,8 @@ TEST_F(ReplCoordTest, ReadAfterCommittedInterrupted) { const auto opCtx = makeOperationContext(); runSingleNodeElection(opCtx.get()); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(10, 1), 0), Date_t() + Seconds(100)); killOperation(opCtx.get()); auto status = getReplCoord()->waitUntilOpTimeForRead( opCtx.get(), @@ -4638,8 +4636,8 @@ TEST_F(ReplCoordTest, ReadAfterCommittedGreaterOpTime) { auto opCtx = makeOperationContext(); runSingleNodeElection(opCtx.get()); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 1), Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->waitUntilOpTimeForRead( opCtx.get(), @@ -4661,8 +4659,8 @@ TEST_F(ReplCoordTest, ReadAfterCommittedEqualOpTime) { runSingleNodeElection(opCtx.get()); OpTime time(Timestamp(100, 1), 1); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->waitUntilOpTimeForRead( opCtx.get(), ReadConcernArgs(time, ReadConcernLevel::kMajorityReadConcern))); @@ -4682,13 +4680,13 @@ TEST_F(ReplCoordTest, ReadAfterCommittedDeferredGreaterOpTime) { auto opCtx = makeOperationContext(); runSingleNodeElection(opCtx.get()); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 1), Date_t() + Seconds(100)); OpTime committedOpTime(Timestamp(200, 1), 1); auto pseudoLogOp = stdx::async(stdx::launch::async, [this, &committedOpTime]() { // Not guaranteed to be scheduled after waitUntil blocks... - replCoordSetMyLastAppliedOpTime(committedOpTime, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(committedOpTime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(committedOpTime, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(committedOpTime, Date_t() + Seconds(100)); }); ASSERT_OK(getReplCoord()->waitUntilOpTimeForRead( @@ -4709,15 +4707,15 @@ TEST_F(ReplCoordTest, ReadAfterCommittedDeferredEqualOpTime) { HostAndPort("node1", 12345)); auto opCtx = makeOperationContext(); runSingleNodeElection(opCtx.get()); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 1), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 1), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(100, 1), 1), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(100, 1), 1), Date_t() + Seconds(100)); OpTime opTimeToWait(Timestamp(100, 1), 1); auto pseudoLogOp = stdx::async(stdx::launch::async, [this, &opTimeToWait]() { // Not guaranteed to be scheduled after waitUntil blocks... - replCoordSetMyLastAppliedOpTime(opTimeToWait, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(opTimeToWait, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTimeToWait, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(opTimeToWait, Date_t() + Seconds(100)); }); ASSERT_OK(getReplCoord()->waitUntilOpTimeForRead( @@ -4783,7 +4781,7 @@ TEST_F(ReplCoordTest, IgnoreTheContentsOfMetadataWhenItsConfigVersionDoesNotMatc StatusWith metadata = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(10, 0) << "t" << 2) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(10, 0) << "t" << 2) << "configVersion" @@ -4801,7 +4799,7 @@ TEST_F(ReplCoordTest, IgnoreTheContentsOfMetadataWhenItsConfigVersionDoesNotMatc StatusWith metadata2 = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(10, 0) << "t" << 2) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(10, 0) << "t" << 2) << "configVersion" @@ -4847,7 +4845,7 @@ TEST_F(ReplCoordTest, UpdateLastCommittedOpTimeWhenTheLastCommittedOpTimeIsNewer OpTime time(Timestamp(10, 1), 1); OpTime oldTime(Timestamp(9, 1), 1); - Date_t wallTime = Date_t::min() + Seconds(10); + Date_t wallTime = Date_t() + Seconds(10); replCoordSetMyLastAppliedOpTime(time, wallTime); // higher OpTime, should change @@ -4857,7 +4855,7 @@ TEST_F(ReplCoordTest, UpdateLastCommittedOpTimeWhenTheLastCommittedOpTimeIsNewer ASSERT_EQUALS(time, getReplCoord()->getCurrentCommittedSnapshotOpTime()); // lower OpTime, should not change - getReplCoord()->advanceCommitPoint({oldTime, Date_t::min() + Seconds(5)}, false); + getReplCoord()->advanceCommitPoint({oldTime, Date_t() + Seconds(5)}, false); ASSERT_EQUALS(time, getReplCoord()->getLastCommittedOpTime()); ASSERT_EQUALS(wallTime, getReplCoord()->getLastCommittedOpTimeAndWallTime().wallTime); ASSERT_EQUALS(time, getReplCoord()->getCurrentCommittedSnapshotOpTime()); @@ -4894,7 +4892,7 @@ TEST_F(ReplCoordTest, UpdateTermWhenTheTermFromMetadataIsNewerButNeverUpdateCurr StatusWith metadata = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(10, 0) << "t" << 3) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(10, 0) << "t" << 3) << "configVersion" @@ -4914,7 +4912,7 @@ TEST_F(ReplCoordTest, UpdateTermWhenTheTermFromMetadataIsNewerButNeverUpdateCurr StatusWith metadata2 = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(11, 0) << "t" << 3) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(11, 0) << "t" << 3) << "configVersion" @@ -4934,7 +4932,7 @@ TEST_F(ReplCoordTest, UpdateTermWhenTheTermFromMetadataIsNewerButNeverUpdateCurr StatusWith metadata3 = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(11, 0) << "t" << 3) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(11, 0) << "t" << 3) << "configVersion" @@ -4982,7 +4980,7 @@ TEST_F(ReplCoordTest, StatusWith metadata = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(10, 0) << "t" << 3) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(10, 0) << "t" << 3) << "configVersion" @@ -5044,13 +5042,13 @@ TEST_F(ReplCoordTest, LastCommittedOpTimeOnlyUpdatedFromHeartbeatWhenLastApplied auto opTime1 = OpTime({10, 1}, 1); auto opTime2 = OpTime({11, 1}, 2); // In higher term. auto commitPoint = OpTime({15, 1}, 2); - replCoordSetMyLastAppliedOpTime(opTime1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime1, Date_t() + Seconds(100)); // Node 1 is the current primary. The commit point has a higher term than lastApplied. rpc::ReplSetMetadata metadata( - 2, // term - {commitPoint, Date_t::min() + Seconds(commitPoint.getSecs())}, // committed OpTime - commitPoint, // visibleOpTime + 2, // term + {commitPoint, Date_t() + Seconds(commitPoint.getSecs())}, // committed OpTime + commitPoint, // visibleOpTime config.getConfigVersion(), {}, // replset id 1, // currentPrimaryIndex, @@ -5083,7 +5081,7 @@ TEST_F(ReplCoordTest, LastCommittedOpTimeOnlyUpdatedFromHeartbeatWhenLastApplied } // Update lastApplied, so commit point can be advanced. - replCoordSetMyLastAppliedOpTime(opTime2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(opTime2, Date_t() + Seconds(100)); { net->enterNetwork(); net->runUntil(net->now() + config.getHeartbeatInterval()); @@ -5125,13 +5123,13 @@ TEST_F(ReplCoordTest, LastCommittedOpTimeOnlyUpdatedFromHeartbeatInFCV42) { auto lastAppliedOpTime = OpTime({11, 1}, 2); auto commitPoint = OpTime({15, 1}, 2); - replCoordSetMyLastAppliedOpTime(lastAppliedOpTime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(lastAppliedOpTime, Date_t() + Seconds(100)); // Node 1 is the current primary. rpc::ReplSetMetadata metadata( - 2, // term - {commitPoint, Date_t::min() + Seconds(commitPoint.getSecs())}, // committed OpTime - commitPoint, // visibleOpTime + 2, // term + {commitPoint, Date_t() + Seconds(commitPoint.getSecs())}, // committed OpTime + commitPoint, // visibleOpTime config.getConfigVersion(), {}, // replset id 1, // currentPrimaryIndex, @@ -5200,8 +5198,8 @@ TEST_F(ReplCoordTest, AdvanceCommitPointFromSyncSourceCanSetCommitPointToLastApp HostAndPort("node1", 12345)); ASSERT_EQUALS(OpTime(), getReplCoord()->getLastCommittedOpTime()); - OpTimeAndWallTime lastApplied = {OpTime({10, 1}, 1), Date_t::min() + Seconds(10)}; - OpTimeAndWallTime commitPoint = {OpTime({15, 1}, 2), Date_t::min() + Seconds(15)}; + OpTimeAndWallTime lastApplied = {OpTime({10, 1}, 1), Date_t() + Seconds(10)}; + OpTimeAndWallTime commitPoint = {OpTime({15, 1}, 2), Date_t() + Seconds(15)}; replCoordSetMyLastAppliedOpTime(lastApplied.opTime, lastApplied.wallTime); const bool fromSyncSource = true; @@ -5236,8 +5234,8 @@ TEST_F(ReplCoordTest, PrepareOplogQueryMetadata) { OpTime optime1{Timestamp(10, 0), 5}; OpTime optime2{Timestamp(11, 2), 5}; - Date_t wallTime1 = Date_t::min() + Seconds(1); - Date_t wallTime2 = Date_t::min() + Seconds(2); + Date_t wallTime1 = Date_t() + Seconds(1); + Date_t wallTime2 = Date_t() + Seconds(2); replCoordSetMyLastAppliedOpTime(optime2, wallTime2); // pass dummy Date_t to avoid advanceCommitPoint invariant @@ -5307,7 +5305,7 @@ TEST_F(ReplCoordTest, TermAndLastCommittedOpTimeUpdatedFromHeartbeatWhenArbiter) StatusWith metadata = replReadFromMetadata(BSON( rpc::kReplSetMetadataFieldName << BSON( "lastOpCommitted" << BSON("ts" << Timestamp(10, 1) << "t" << 3) << "lastCommittedWall" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "lastOpVisible" << BSON("ts" << Timestamp(10, 1) << "t" << 3) << "configVersion" @@ -5513,10 +5511,8 @@ TEST_F(ReplCoordTest, hbResp.setConfigVersion(3); hbResp.setSetName("mySet"); hbResp.setState(MemberState::RS_SECONDARY); - hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); net->scheduleResponse(noi, net->now(), makeResponseStatus(hbResp.toBSON())); net->runReadyNetworkOperations(); net->exitNetwork(); @@ -5569,10 +5565,8 @@ TEST_F(ReplCoordTest, hbResp.setSetName("mySet"); hbResp.setState(MemberState::RS_PRIMARY); hbResp.setTerm(replCoord->getTerm()); - hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); - hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 1), 0), Date_t::min() + Seconds(100)}); + hbResp.setAppliedOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); + hbResp.setDurableOpTimeAndWallTime({OpTime(Timestamp(100, 1), 0), Date_t() + Seconds(100)}); hbResp.setConfigVersion(1); // Heartbeat response is scheduled with a delay so that we can be sure that @@ -5715,17 +5709,17 @@ TEST_F(ReplCoordTest, AdvanceCommittedSnapshotToMostRecentSnapshotPriorToOpTimeW OpTime time5(Timestamp(100, 5), 1); OpTime time6(Timestamp(100, 6), 1); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(time5, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time5, Date_t() + Seconds(100)); // ensure current snapshot follows price is right rules (closest but not greater than) - replCoordSetMyLastDurableOpTime(time3, Date_t::min() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time3, Date_t() + Seconds(100)); ASSERT_EQUALS(time2, getReplCoord()->getCurrentCommittedSnapshotOpTime()); - replCoordSetMyLastDurableOpTime(time4, Date_t::min() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time4, Date_t() + Seconds(100)); ASSERT_EQUALS(time2, getReplCoord()->getCurrentCommittedSnapshotOpTime()); - replCoordSetMyLastDurableOpTime(time5, Date_t::min() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time5, Date_t() + Seconds(100)); ASSERT_EQUALS(time5, getReplCoord()->getCurrentCommittedSnapshotOpTime()); } @@ -5751,10 +5745,10 @@ TEST_F(ReplCoordTest, ZeroCommittedSnapshotWhenAllSnapshotsAreDropped) { OpTime time5(Timestamp(100, 5), 1); OpTime time6(Timestamp(100, 6), 1); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); - replCoordSetMyLastAppliedOpTime(time5, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time5, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time5, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time5, Date_t() + Seconds(100)); // ensure dropping all snapshots should reset the current committed snapshot getReplCoord()->dropAllSnapshots(); @@ -5779,11 +5773,11 @@ TEST_F(ReplCoordTest, DoNotAdvanceCommittedSnapshotWhenAppliedOpTimeChanges) { OpTime time1(Timestamp(100, 1), 1); OpTime time2(Timestamp(100, 2), 1); - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); ASSERT_EQUALS(OpTime(), getReplCoord()->getCurrentCommittedSnapshotOpTime()); - replCoordSetMyLastAppliedOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time2, Date_t() + Seconds(100)); ASSERT_EQUALS(OpTime(), getReplCoord()->getCurrentCommittedSnapshotOpTime()); - replCoordSetMyLastDurableOpTime(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time2, Date_t() + Seconds(100)); ASSERT_EQUALS(time2, getReplCoord()->getCurrentCommittedSnapshotOpTime()); } @@ -5807,12 +5801,12 @@ TEST_F(ReplCoordTest, OpTime time3(Timestamp(100, 3), term); auto consistency = ReplicationCoordinator::DataConsistency::Consistent; - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); ASSERT_EQUALS(time1, getReplCoord()->getMyLastAppliedOpTime()); - replCoordSetMyLastAppliedOpTimeForward(time3, consistency, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTimeForward(time3, consistency, Date_t() + Seconds(100)); ASSERT_EQUALS(time3, getReplCoord()->getMyLastAppliedOpTime()); - replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTimeForward(time2, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTimeForward(time2, Date_t() + Seconds(100)); ASSERT_EQUALS(time3, getReplCoord()->getMyLastAppliedOpTime()); } @@ -5835,11 +5829,11 @@ DEATH_TEST_F(ReplCoordTest, OpTime time2(Timestamp(99, 1), 2); auto consistency = ReplicationCoordinator::DataConsistency::Consistent; - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); ASSERT_EQUALS(time1, getReplCoord()->getMyLastAppliedOpTime()); // Since in pv1, oplog entries are ordered by non-decreasing // term and strictly increasing timestamp, it leads to invariant failure. - replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t() + Seconds(100)); } DEATH_TEST_F(ReplCoordTest, @@ -5861,11 +5855,11 @@ DEATH_TEST_F(ReplCoordTest, OpTime time2(Timestamp(100, 1), 2); auto consistency = ReplicationCoordinator::DataConsistency::Consistent; - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); ASSERT_EQUALS(time1, getReplCoord()->getMyLastAppliedOpTime()); // Since in pv1, oplog entries are ordered by non-decreasing // term and strictly increasing timestamp, it leads to invariant failure. - replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t() + Seconds(100)); } DEATH_TEST_F(ReplCoordTest, @@ -5887,11 +5881,11 @@ DEATH_TEST_F(ReplCoordTest, OpTime time2(Timestamp(100, 2), 0); auto consistency = ReplicationCoordinator::DataConsistency::Consistent; - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); ASSERT_EQUALS(time1, getReplCoord()->getMyLastAppliedOpTime()); // Since in pv1, oplog entries are ordered by non-decreasing // term and strictly increasing timestamp, it leads to invariant failure. - replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t() + Seconds(100)); } DEATH_TEST_F(ReplCoordTest, @@ -5913,11 +5907,11 @@ DEATH_TEST_F(ReplCoordTest, OpTime time2(Timestamp(100, 1), 0); auto consistency = ReplicationCoordinator::DataConsistency::Consistent; - replCoordSetMyLastAppliedOpTime(time1, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time1, Date_t() + Seconds(100)); ASSERT_EQUALS(time1, getReplCoord()->getMyLastAppliedOpTime()); // Since in pv1, oplog entries are ordered by non-decreasing // term and strictly increasing timestamp, it leads to invariant failure. - replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTimeForward(time2, consistency, Date_t() + Seconds(100)); } TEST_F(ReplCoordTest, OnlyForwardSyncProgressForOtherNodesWhenTheNodesAreBelievedToBeUp) { @@ -5939,8 +5933,8 @@ TEST_F(ReplCoordTest, OnlyForwardSyncProgressForOtherNodesWhenTheNodesAreBelieve << BSON("electionTimeoutMillis" << 2000 << "heartbeatIntervalMillis" << 40000)), HostAndPort("test1", 1234)); OpTime optime(Timestamp(100, 2), 0); - replCoordSetMyLastAppliedOpTime(optime, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime, Date_t() + Seconds(100)); ASSERT_OK(getReplCoord()->setLastAppliedOptime_forTest(1, 1, optime)); ASSERT_OK(getReplCoord()->setLastDurableOptime_forTest(1, 1, optime)); @@ -6013,22 +6007,17 @@ TEST_F(ReplCoordTest, UpdatePositionCmdHasMetadata) { << BSON("electionTimeoutMillis" << 2000 << "heartbeatIntervalMillis" << 40000)), HostAndPort("test1", 1234)); OpTime optime(Timestamp(100, 2), 0); - replCoordSetMyLastAppliedOpTime(optime, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(optime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(optime, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(optime, Date_t() + Seconds(100)); auto opCtx = makeOperationContext(); // Set last committed optime via metadata. Pass dummy Date_t to avoid advanceCommitPoint // invariant. - rpc::ReplSetMetadata syncSourceMetadata(optime.getTerm(), - {optime, Date_t::min() + Seconds(optime.getSecs())}, - optime, - 1, - OID(), - -1, - 1); + rpc::ReplSetMetadata syncSourceMetadata( + optime.getTerm(), {optime, Date_t() + Seconds(optime.getSecs())}, optime, 1, OID(), -1, 1); getReplCoord()->processReplSetMetadata(syncSourceMetadata); // Pass dummy Date_t to avoid advanceCommitPoint invariant. - getReplCoord()->advanceCommitPoint({optime, Date_t::min() + Seconds(optime.getSecs())}, true); + getReplCoord()->advanceCommitPoint({optime, Date_t() + Seconds(optime.getSecs())}, true); BSONObj cmd = unittest::assertGet(getReplCoord()->prepareReplSetUpdatePositionCommand()); auto metadata = unittest::assertGet(replReadFromMetadata(cmd)); @@ -6074,8 +6063,8 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod HostAndPort("node1", 12345)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); OpTime startingOpTime = OpTime(Timestamp(100, 1), 0); - replCoordSetMyLastAppliedOpTime(startingOpTime, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(startingOpTime, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(startingOpTime, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(startingOpTime, Date_t() + Seconds(100)); // Receive notification that every node is up. UpdatePositionArgs args; @@ -6091,11 +6080,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())) + << Date_t() + Seconds(startingOpTime.getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << 2 << UpdatePositionArgs::kMemberIdFieldName @@ -6103,11 +6092,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())) + << Date_t() + Seconds(startingOpTime.getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << 2 << UpdatePositionArgs::kMemberIdFieldName @@ -6115,11 +6104,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())) + << Date_t() + Seconds(startingOpTime.getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << 2 << UpdatePositionArgs::kMemberIdFieldName @@ -6127,11 +6116,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())))))); + << Date_t() + Seconds(startingOpTime.getSecs())))))); ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, 0)); // Become PRIMARY. @@ -6151,11 +6140,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())) + << Date_t() + Seconds(startingOpTime.getSecs())) << BSON(UpdatePositionArgs::kConfigVersionFieldName << 2 << UpdatePositionArgs::kMemberIdFieldName @@ -6163,11 +6152,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())))), + << Date_t() + Seconds(startingOpTime.getSecs())))), /*requireWallTime*/ true)); const Date_t startDate = getNet()->now(); getNet()->enterNetwork(); @@ -6218,11 +6207,11 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod << UpdatePositionArgs::kDurableOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kDurableWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs()) + << Date_t() + Seconds(startingOpTime.getSecs()) << UpdatePositionArgs::kAppliedOpTimeFieldName << startingOpTime.toBSON() << UpdatePositionArgs::kAppliedWallTimeFieldName - << Date_t::min() + Seconds(startingOpTime.getSecs())))))); + << Date_t() + Seconds(startingOpTime.getSecs())))))); ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args2, 0)); hbArgs.setSetName("mySet"); @@ -6260,8 +6249,8 @@ TEST_F(ReplCoordTest, WaitForMemberState) { HostAndPort("test1", 1234)); auto replCoord = getReplCoord(); auto initialTerm = replCoord->getTerm(); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(1, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(1, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(1, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(1, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); // Single node cluster - this node should start election on setFollowerMode() completion. @@ -6297,8 +6286,8 @@ TEST_F(ReplCoordTest, WaitForDrainFinish) { HostAndPort("test1", 1234)); auto replCoord = getReplCoord(); auto initialTerm = replCoord->getTerm(); - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(1, 1), 0), Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(1, 1), 0), Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(1, 1), 0), Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(1, 1), 0), Date_t() + Seconds(100)); ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_SECONDARY)); // Single node cluster - this node should start election on setFollowerMode() completion. @@ -6443,8 +6432,8 @@ TEST_F(ReplCoordTest, NodeStoresElectionVotes) { HostAndPort("node1", 12345)); auto time = OpTimeWithTermOne(100, 1); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); simulateSuccessfulV1Election(); auto opCtx = makeOperationContext(); @@ -6497,8 +6486,8 @@ TEST_F(ReplCoordTest, NodeDoesNotStoreDryRunVotes) { HostAndPort("node1", 12345)); auto time = OpTimeWithTermOne(100, 1); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); simulateSuccessfulV1Election(); auto opCtx = makeOperationContext(); @@ -6549,8 +6538,8 @@ TEST_F(ReplCoordTest, NodeFailsVoteRequestIfItFailsToStoreLastVote) { HostAndPort("node1", 12345)); auto time = OpTimeWithTermOne(100, 1); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); simulateSuccessfulV1Election(); // Get our current term, as primary. @@ -6610,8 +6599,8 @@ TEST_F(ReplCoordTest, NodeNodesNotGrantVoteIfInTerminalShutdown) { HostAndPort("node1", 12345)); auto time = OpTimeWithTermOne(100, 1); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); - replCoordSetMyLastAppliedOpTime(time, Date_t::min() + Seconds(100)); - replCoordSetMyLastDurableOpTime(time, Date_t::min() + Seconds(100)); + replCoordSetMyLastAppliedOpTime(time, Date_t() + Seconds(100)); + replCoordSetMyLastDurableOpTime(time, Date_t() + Seconds(100)); simulateSuccessfulV1Election(); // Get our current term, as primary. diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp index 81a7a72d2a5..9194089e26e 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_mock.cpp @@ -235,7 +235,7 @@ void ReplicationCoordinatorMock::setMyLastDurableOpTimeAndWallTimeForward( void ReplicationCoordinatorMock::resetMyLastOpTimes() { _myLastDurableOpTime = OpTime(); - _myLastDurableWallTime = Date_t::min(); + _myLastDurableWallTime = Date_t(); } OpTimeAndWallTime ReplicationCoordinatorMock::getMyLastAppliedOpTimeAndWallTime() const { @@ -461,7 +461,7 @@ OpTime ReplicationCoordinatorMock::getLastCommittedOpTime() const { } OpTimeAndWallTime ReplicationCoordinatorMock::getLastCommittedOpTimeAndWallTime() const { - return {OpTime(), Date_t::min()}; + return {OpTime(), Date_t()}; } Status ReplicationCoordinatorMock::processReplSetRequestVotes( diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp index 8324d84232f..82317b139a2 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp @@ -236,9 +236,9 @@ void ReplCoordTest::simulateEnoughHeartbeatsForAllNodesUp() { hbResp.setState(MemberState::RS_SECONDARY); hbResp.setConfigVersion(rsConfig.getConfigVersion()); hbResp.setAppliedOpTimeAndWallTime( - {OpTime(Timestamp(100, 2), 0), Date_t::min() + Seconds(100)}); + {OpTime(Timestamp(100, 2), 0), Date_t() + Seconds(100)}); hbResp.setDurableOpTimeAndWallTime( - {OpTime(Timestamp(100, 2), 0), Date_t::min() + Seconds(100)}); + {OpTime(Timestamp(100, 2), 0), Date_t() + Seconds(100)}); BSONObjBuilder respObj; net->scheduleResponse(noi, net->now(), makeResponseStatus(hbResp.toBSON())); } else { @@ -340,8 +340,8 @@ void ReplCoordTest::simulateSuccessfulV1ElectionWithoutExitingDrainMode(Date_t e hbResp.setState(MemberState::RS_SECONDARY); // The smallest valid optime in PV1. OpTime opTime(Timestamp(), 0); - hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t::min() + Seconds(opTime.getSecs())}); - hbResp.setDurableOpTimeAndWallTime({opTime, Date_t::min() + Seconds(opTime.getSecs())}); + hbResp.setAppliedOpTimeAndWallTime({opTime, Date_t() + Seconds(opTime.getSecs())}); + hbResp.setDurableOpTimeAndWallTime({opTime, Date_t() + Seconds(opTime.getSecs())}); hbResp.setConfigVersion(rsConfig.getConfigVersion()); net->scheduleResponse(noi, net->now(), makeResponseStatus(hbResp.toBSON())); } else if (request.cmdObj.firstElement().fieldNameStringData() == "replSetRequestVotes") { @@ -397,8 +397,8 @@ void ReplCoordTest::signalDrainComplete(OperationContext* opCtx) { } void ReplCoordTest::runSingleNodeElection(OperationContext* opCtx) { - replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(1, 1), 0), Date_t::min() + Seconds(1)); - replCoordSetMyLastDurableOpTime(OpTime(Timestamp(1, 1), 0), Date_t::min() + Seconds(1)); + replCoordSetMyLastAppliedOpTime(OpTime(Timestamp(1, 1), 0), Date_t() + Seconds(1)); + replCoordSetMyLastDurableOpTime(OpTime(Timestamp(1, 1), 0), Date_t() + Seconds(1)); ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY)); getReplCoord()->waitForElectionFinish_forTest(); @@ -438,10 +438,8 @@ bool ReplCoordTest::consumeHeartbeatV1(const NetworkInterfaceMock::NetworkOperat hbResp.setSetName(rsConfig.getReplSetName()); hbResp.setState(MemberState::RS_SECONDARY); hbResp.setConfigVersion(rsConfig.getConfigVersion()); - hbResp.setAppliedOpTimeAndWallTime( - {lastApplied, Date_t::min() + Seconds(lastApplied.getSecs())}); - hbResp.setDurableOpTimeAndWallTime( - {lastApplied, Date_t::min() + Seconds(lastApplied.getSecs())}); + hbResp.setAppliedOpTimeAndWallTime({lastApplied, Date_t() + Seconds(lastApplied.getSecs())}); + hbResp.setDurableOpTimeAndWallTime({lastApplied, Date_t() + Seconds(lastApplied.getSecs())}); BSONObjBuilder respObj; net->scheduleResponse(noi, net->now(), makeResponseStatus(hbResp.toBSON())); return true; diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.h b/src/mongo/db/repl/replication_coordinator_test_fixture.h index c3d7cd14d28..0c30aa3eb72 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.h +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.h @@ -117,8 +117,8 @@ protected: return rpc::ReplSetMetadata::readFromMetadata(doc, requireWallTime); } - void replCoordSetMyLastAppliedOpTime(const OpTime& opTime, Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + void replCoordSetMyLastAppliedOpTime(const OpTime& opTime, Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getReplCoord()->setMyLastAppliedOpTimeAndWallTime({opTime, wallTime}); @@ -126,32 +126,31 @@ protected: void replCoordSetMyLastAppliedOpTimeForward(const OpTime& opTime, ReplicationCoordinator::DataConsistency consistency, - Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getReplCoord()->setMyLastAppliedOpTimeAndWallTimeForward({opTime, wallTime}, consistency); } - void replCoordSetMyLastDurableOpTime(const OpTime& opTime, Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + void replCoordSetMyLastDurableOpTime(const OpTime& opTime, Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getReplCoord()->setMyLastDurableOpTimeAndWallTime({opTime, wallTime}); } - void replCoordSetMyLastDurableOpTimeForward(const OpTime& opTime, - Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + void replCoordSetMyLastDurableOpTimeForward(const OpTime& opTime, Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getReplCoord()->setMyLastDurableOpTimeAndWallTimeForward({opTime, wallTime}); } void replCoordAdvanceCommitPoint(const OpTime& opTime, - Date_t wallTime = Date_t::min(), + Date_t wallTime = Date_t(), bool fromSyncSource = false) { - if (wallTime == Date_t::min()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getReplCoord()->advanceCommitPoint({opTime, wallTime}, fromSyncSource); diff --git a/src/mongo/db/repl/reporter_test.cpp b/src/mongo/db/repl/reporter_test.cpp index 439f849e18f..6213eb4fe26 100644 --- a/src/mongo/db/repl/reporter_test.cpp +++ b/src/mongo/db/repl/reporter_test.cpp @@ -73,11 +73,11 @@ public: itr.second.lastDurableOpTime.append(&entry, UpdatePositionArgs::kDurableOpTimeFieldName); entry.appendDate(UpdatePositionArgs::kDurableWallTimeFieldName, - Date_t::min() + Seconds(itr.second.lastDurableOpTime.getSecs())); + Date_t() + Seconds(itr.second.lastDurableOpTime.getSecs())); itr.second.lastAppliedOpTime.append(&entry, UpdatePositionArgs::kAppliedOpTimeFieldName); entry.appendDate(UpdatePositionArgs::kAppliedWallTimeFieldName, - Date_t::min() + Seconds(itr.second.lastAppliedOpTime.getSecs())); + Date_t() + Seconds(itr.second.lastAppliedOpTime.getSecs())); entry.append(UpdatePositionArgs::kMemberIdFieldName, itr.first); if (_configVersion != -1) { entry.append(UpdatePositionArgs::kConfigVersionFieldName, _configVersion); diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index ac6331d02f7..6361607d8c0 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -190,7 +190,7 @@ void ApplyBatchFinalizerForJournal::_run() { Client::initThread("ApplyBatchFinalizerForJournal"); while (true) { - OpTimeAndWallTime latestOpTimeAndWallTime = {OpTime(), Date_t::min()}; + OpTimeAndWallTime latestOpTimeAndWallTime = {OpTime(), Date_t()}; { stdx::unique_lock lock(_mutex); @@ -203,7 +203,7 @@ void ApplyBatchFinalizerForJournal::_run() { } latestOpTimeAndWallTime = _latestOpTimeAndWallTime; - _latestOpTimeAndWallTime = {OpTime(), Date_t::min()}; + _latestOpTimeAndWallTime = {OpTime(), Date_t()}; } auto opCtx = cc().makeOperationContext(); diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp index 9d1b2d2d05e..6de324f0139 100644 --- a/src/mongo/db/repl/topology_coordinator.cpp +++ b/src/mongo/db/repl/topology_coordinator.cpp @@ -1397,8 +1397,7 @@ void TopologyCoordinator::setCurrentPrimary_forTest(int primaryIndex, hbResponse.setState(MemberState::RS_PRIMARY); hbResponse.setElectionTime(electionTime); hbResponse.setAppliedOpTimeAndWallTime( - {_memberData.at(primaryIndex).getHeartbeatAppliedOpTime(), - Date_t::min() + Seconds(1)}); + {_memberData.at(primaryIndex).getHeartbeatAppliedOpTime(), Date_t() + Seconds(1)}); hbResponse.setSyncingTo(HostAndPort()); _memberData.at(primaryIndex) .setUpValues(_memberData.at(primaryIndex).getLastHeartbeat(), @@ -1611,9 +1610,7 @@ void TopologyCoordinator::prepareStatusResponse(const ReplSetStatusArgs& rsStatu BSONObjBuilder optimes; _lastCommittedOpTimeAndWallTime.opTime.append(&optimes, "lastCommittedOpTime"); - if (_lastCommittedOpTimeAndWallTime.wallTime.isFormattable()) { - optimes.appendDate("lastCommittedWallTime", _lastCommittedOpTimeAndWallTime.wallTime); - } + optimes.appendDate("lastCommittedWallTime", _lastCommittedOpTimeAndWallTime.wallTime); if (!rsStatusArgs.readConcernMajorityOpTime.opTime.isNull()) { rsStatusArgs.readConcernMajorityOpTime.opTime.append(&optimes, "readConcernMajorityOpTime"); @@ -1624,14 +1621,8 @@ void TopologyCoordinator::prepareStatusResponse(const ReplSetStatusArgs& rsStatu appendOpTime(&optimes, "appliedOpTime", lastOpApplied); appendOpTime(&optimes, "durableOpTime", lastOpDurable); - // SERVER-40565 The python driver cannot parse Date_t::min() as a valid date. These dates should - // only be equal to Date_t::min() if their corresponding optimes are null. - if (lastOpAppliedWall.isFormattable()) { - optimes.appendDate("lastAppliedWallTime", lastOpAppliedWall); - } - if (lastOpDurableWall.isFormattable()) { - optimes.appendDate("lastDurableWallTime", lastOpDurableWall); - } + optimes.appendDate("lastAppliedWallTime", lastOpAppliedWall); + optimes.appendDate("lastDurableWallTime", lastOpDurableWall); response->append("optimes", optimes.obj()); if (lastStableRecoveryTimestamp) { diff --git a/src/mongo/db/repl/topology_coordinator_v1_test.cpp b/src/mongo/db/repl/topology_coordinator_v1_test.cpp index 63c3fdebdfb..1f4864379c2 100644 --- a/src/mongo/db/repl/topology_coordinator_v1_test.cpp +++ b/src/mongo/db/repl/topology_coordinator_v1_test.cpp @@ -117,8 +117,8 @@ protected: ASSERT_OK(getTopoCoord().completeTransitionToPrimary(dummyOpTime)); } - void setMyOpTime(const OpTime& opTime, Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + void setMyOpTime(const OpTime& opTime, Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getTopoCoord().setMyLastAppliedOpTimeAndWallTime({opTime, wallTime}, now(), false); @@ -127,8 +127,8 @@ protected: void topoCoordSetMyLastAppliedOpTime(const OpTime& opTime, Date_t now, bool isRollbackAllowed, - Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getTopoCoord().setMyLastAppliedOpTimeAndWallTime( @@ -138,8 +138,8 @@ protected: void topoCoordSetMyLastDurableOpTime(const OpTime& opTime, Date_t now, bool isRollbackAllowed, - Date_t wallTime = Date_t::min()) { - if (wallTime == Date_t::min()) { + Date_t wallTime = Date_t()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getTopoCoord().setMyLastDurableOpTimeAndWallTime( @@ -147,9 +147,9 @@ protected: } void topoCoordAdvanceLastCommittedOpTime(const OpTime& opTime, - Date_t wallTime = Date_t::min(), + Date_t wallTime = Date_t(), const bool fromSyncSource = false) { - if (wallTime == Date_t::min()) { + if (wallTime == Date_t()) { wallTime = Date_t() + Seconds(opTime.getSecs()); } getTopoCoord().advanceLastCommittedOpTimeAndWallTime({opTime, wallTime}, fromSyncSource); @@ -221,7 +221,7 @@ protected: OplogQueryMetadata makeOplogQueryMetadata(OpTime lastAppliedOpTime = OpTime(), int primaryIndex = -1, int syncSourceIndex = -1, - Date_t lastCommittedWall = Date_t::min()) { + Date_t lastCommittedWall = Date_t()) { return OplogQueryMetadata( {OpTime(), lastCommittedWall}, lastAppliedOpTime, -1, primaryIndex, syncSourceIndex); } @@ -283,12 +283,12 @@ private: const OpTime& lastOpTimeSender, Milliseconds roundTripTime, const HostAndPort& syncingTo, - Date_t lastDurableWallTime = Date_t::min(), - Date_t lastAppliedWallTime = Date_t::min()) { - if (lastDurableWallTime == Date_t::min()) { + Date_t lastDurableWallTime = Date_t(), + Date_t lastAppliedWallTime = Date_t()) { + if (lastDurableWallTime == Date_t()) { lastDurableWallTime = Date_t() + Seconds(lastOpTimeSender.getSecs()); } - if (lastAppliedWallTime == Date_t::min()) { + if (lastAppliedWallTime == Date_t()) { lastAppliedWallTime = Date_t() + Seconds(lastOpTimeSender.getSecs()); } ReplSetHeartbeatResponse hb; @@ -3706,7 +3706,7 @@ TEST_F(HeartbeatResponseTestV1, ShouldNotChangeSyncSourceWhenMemberHasYetToHeart TEST_F(HeartbeatResponseTestV1, ShouldNotChangeSyncSourceWhenMemberNotInConfig) { // In this test, the TopologyCoordinator should tell us to change sync sources away from // "host4" since "host4" is absent from the config of version 10. - ReplSetMetadata replMetadata(0, {OpTime(), Date_t::min()}, OpTime(), 10, OID(), -1, -1); + ReplSetMetadata replMetadata(0, {OpTime(), Date_t()}, OpTime(), 10, OID(), -1, -1); ASSERT_TRUE(getTopoCoord().shouldChangeSyncSource( HostAndPort("host4"), replMetadata, makeOplogQueryMetadata(), now())); } @@ -3750,7 +3750,7 @@ TEST_F(HeartbeatResponseTestV1, ReconfigNodeRemovedBetweenHeartbeatRequestAndRep /*requireWallTime*/ true) .transitional_ignore(); hb.setDurableOpTimeAndWallTime( - {lastOpTimeApplied, Date_t::min() + Seconds(lastOpTimeApplied.getSecs())}); + {lastOpTimeApplied, Date_t() + Seconds(lastOpTimeApplied.getSecs())}); hb.setElectionTime(election.getTimestamp()); StatusWith hbResponse = StatusWith(hb); HeartbeatResponseAction action = getTopoCoord().processHeartbeatResponse( @@ -3797,11 +3797,11 @@ TEST_F(HeartbeatResponseTestV1, ReconfigBetweenHeartbeatRequestAndRepsonse) { ReplSetHeartbeatResponse hb; hb.initialize(BSON("ok" << 1 << "durableOpTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "durableWallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "opTime" << OpTime(Timestamp(100, 0), 0).toBSON() << "wallTime" - << Date_t::min() + Seconds(100) + << Date_t() + Seconds(100) << "v" << 1 << "state" @@ -3810,7 +3810,7 @@ TEST_F(HeartbeatResponseTestV1, ReconfigBetweenHeartbeatRequestAndRepsonse) { /*requireWallTime*/ true) .transitional_ignore(); hb.setDurableOpTimeAndWallTime( - {lastOpTimeApplied, Date_t::min() + Seconds(lastOpTimeApplied.getSecs())}); + {lastOpTimeApplied, Date_t() + Seconds(lastOpTimeApplied.getSecs())}); hb.setElectionTime(election.getTimestamp()); StatusWith hbResponse = StatusWith(hb); topoCoordSetMyLastAppliedOpTime(lastOpTimeApplied, Date_t(), false); @@ -3971,9 +3971,9 @@ TEST_F(TopoCoordTest, FreshestNodeDoesCatchupTakeover) { setSelfMemberState(MemberState::RS_SECONDARY); OpTime currentOptime(Timestamp(200, 1), 0); - Date_t currentWallTime = Date_t::min() + Seconds(currentOptime.getSecs()); + Date_t currentWallTime = Date_t() + Seconds(currentOptime.getSecs()); OpTime behindOptime(Timestamp(100, 1), 0); - Date_t behindWallTime = Date_t::min() + Seconds(behindOptime.getSecs()); + Date_t behindWallTime = Date_t() + Seconds(behindOptime.getSecs()); // Create a mock heartbeat response to be able to compare who is the freshest node. // The latest heartbeat responses are looked at for determining the latest optime @@ -4028,9 +4028,9 @@ TEST_F(TopoCoordTest, StaleNodeDoesntDoCatchupTakeover) { setSelfMemberState(MemberState::RS_SECONDARY); OpTime currentOptime(Timestamp(200, 1), 0); - Date_t currentWallTime = Date_t::min() + Seconds(currentOptime.getSecs()); + Date_t currentWallTime = Date_t() + Seconds(currentOptime.getSecs()); OpTime behindOptime(Timestamp(100, 1), 0); - Date_t behindWallTime = Date_t::min() + Seconds(behindOptime.getSecs()); + Date_t behindWallTime = Date_t() + Seconds(behindOptime.getSecs()); // Create a mock heartbeat response to be able to compare who is the freshest node. ReplSetHeartbeatResponse hbResp = ReplSetHeartbeatResponse(); @@ -4087,7 +4087,7 @@ TEST_F(TopoCoordTest, NodeDoesntDoCatchupTakeoverHeartbeatSaysPrimaryCaughtUp) { setSelfMemberState(MemberState::RS_SECONDARY); OpTime currentOptime(Timestamp(200, 1), 0); - Date_t currentWallTime = Date_t::min() + Seconds(currentOptime.getSecs()); + Date_t currentWallTime = Date_t() + Seconds(currentOptime.getSecs()); // Create a mock heartbeat response to be able to compare who is the freshest node. ReplSetHeartbeatResponse hbResp = ReplSetHeartbeatResponse(); @@ -4144,8 +4144,8 @@ TEST_F(TopoCoordTest, NodeDoesntDoCatchupTakeoverIfTermNumbersSayPrimaryCaughtUp OpTime currentOptime(Timestamp(200, 1), 1); OpTime behindOptime(Timestamp(100, 1), 0); - Date_t currentWallTime = Date_t::min() + Seconds(currentOptime.getSecs()); - Date_t behindWallTime = Date_t::min() + Seconds(behindOptime.getSecs()); + Date_t currentWallTime = Date_t() + Seconds(currentOptime.getSecs()); + Date_t behindWallTime = Date_t() + Seconds(behindOptime.getSecs()); // Create a mock heartbeat response to be able to compare who is the freshest node. ReplSetHeartbeatResponse hbResp = ReplSetHeartbeatResponse(); diff --git a/src/mongo/db/repl/update_position_args.cpp b/src/mongo/db/repl/update_position_args.cpp index 70dad16f1ca..cb31e270a97 100644 --- a/src/mongo/db/repl/update_position_args.cpp +++ b/src/mongo/db/repl/update_position_args.cpp @@ -79,7 +79,7 @@ Status UpdatePositionArgs::initialize(const BSONObj& argsObj, bool requireWallTi if (!status.isOK()) return status; - Date_t appliedWallTime = Date_t::min(); + Date_t appliedWallTime = Date_t(); BSONElement appliedWallTimeElement; status = bsonExtractTypedField( entry, kAppliedWallTimeFieldName, BSONType::Date, &appliedWallTimeElement); @@ -88,7 +88,7 @@ Status UpdatePositionArgs::initialize(const BSONObj& argsObj, bool requireWallTi if (status.isOK()) appliedWallTime = appliedWallTimeElement.Date(); - Date_t durableWallTime = Date_t::min(); + Date_t durableWallTime = Date_t(); BSONElement durableWallTimeElement; status = bsonExtractTypedField( entry, kDurableWallTimeFieldName, BSONType::Date, &durableWallTimeElement); diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index 6b1cfda9eb9..cb2b92022c5 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -445,7 +445,7 @@ public: ASSERT_FALSE(txnDoc.hasField(SessionTxnRecord::kStartOpTimeFieldName)); } - void setReplCoordAppliedOpTime(const repl::OpTime& opTime, Date_t wallTime = Date_t::min()) { + void setReplCoordAppliedOpTime(const repl::OpTime& opTime, Date_t wallTime = Date_t()) { repl::ReplicationCoordinator::get(getGlobalServiceContext()) ->setMyLastAppliedOpTimeAndWallTime({opTime, wallTime}); ASSERT_OK(repl::ReplicationCoordinator::get(getGlobalServiceContext()) diff --git a/src/mongo/rpc/metadata/oplog_query_metadata_test.cpp b/src/mongo/rpc/metadata/oplog_query_metadata_test.cpp index 6c48f245da2..c79dbeee5d9 100644 --- a/src/mongo/rpc/metadata/oplog_query_metadata_test.cpp +++ b/src/mongo/rpc/metadata/oplog_query_metadata_test.cpp @@ -41,7 +41,7 @@ using repl::OpTime; TEST(ReplResponseMetadataTest, OplogQueryMetadataRoundtrip) { OpTime opTime1(Timestamp(1234, 100), 5); - Date_t committedWall = Date_t::min() + Seconds(opTime1.getSecs()); + Date_t committedWall = Date_t() + Seconds(opTime1.getSecs()); OpTime opTime2(Timestamp(7777, 101), 6); OplogQueryMetadata metadata({opTime1, committedWall}, opTime2, 6, 12, -1); diff --git a/src/mongo/rpc/metadata/repl_set_metadata_test.cpp b/src/mongo/rpc/metadata/repl_set_metadata_test.cpp index 36e447889ec..a2802b35416 100644 --- a/src/mongo/rpc/metadata/repl_set_metadata_test.cpp +++ b/src/mongo/rpc/metadata/repl_set_metadata_test.cpp @@ -48,7 +48,7 @@ TEST(ReplResponseMetadataTest, ReplicaSetIdNotSet) { TEST(ReplResponseMetadataTest, Roundtrip) { OpTime opTime(Timestamp(1234, 100), 5); OpTime opTime2(Timestamp(7777, 100), 6); - Date_t committedWallTime = Date_t::min() + Seconds(opTime.getSecs()); + Date_t committedWallTime = Date_t() + Seconds(opTime.getSecs()); ReplSetMetadata metadata(3, {opTime, committedWallTime}, opTime2, 6, OID::gen(), 12, -1); ASSERT_EQ(opTime, metadata.getLastOpCommitted().opTime); diff --git a/src/mongo/s/catalog/sharding_catalog_test.cpp b/src/mongo/s/catalog/sharding_catalog_test.cpp index a9d0959a61c..10bd2e3afe8 100644 --- a/src/mongo/s/catalog/sharding_catalog_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_test.cpp @@ -120,7 +120,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionExisting) { checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm); ReplSetMetadata metadata(10, - {newOpTime, Date_t::min() + Seconds(newOpTime.getSecs())}, + {newOpTime, Date_t() + Seconds(newOpTime.getSecs())}, newOpTime, 100, OID(), @@ -193,7 +193,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabaseExisting) { checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm); ReplSetMetadata metadata(10, - {newOpTime, Date_t::min() + Seconds(newOpTime.getSecs())}, + {newOpTime, Date_t() + Seconds(newOpTime.getSecs())}, newOpTime, 100, OID(), @@ -418,7 +418,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSWithSortAndLimit) { checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm); ReplSetMetadata metadata(10, - {newOpTime, Date_t::min() + Seconds(newOpTime.getSecs())}, + {newOpTime, Date_t() + Seconds(newOpTime.getSecs())}, newOpTime, 100, OID(), @@ -825,7 +825,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionsValidResultsNoDb) { checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm); ReplSetMetadata metadata(10, - {newOpTime, Date_t::min() + Seconds(newOpTime.getSecs())}, + {newOpTime, Date_t() + Seconds(newOpTime.getSecs())}, newOpTime, 100, OID(), -- cgit v1.2.1