diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-11-17 16:39:51 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-11-20 15:01:59 -0500 |
commit | 08d239f5c350910f0aa5631d8ad79cdf0bd6d43f (patch) | |
tree | 33c8bccad027510cf3f8f399b91353588e6b860a | |
parent | 77aad5497f85364184c36312d1f6a371b6a3c016 (diff) | |
download | mongo-08d239f5c350910f0aa5631d8ad79cdf0bd6d43f.tar.gz |
SERVER-32027 Fix unit-tests which rely on having a valid wallclock time
(cherry picked from commit c98068d7c836e2d36a862189733d903b24b02d9a)
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/logical_clock_test.cpp | 40 | ||||
-rw-r--r-- | src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/s/session_catalog_migration_source.cpp | 98 | ||||
-rw-r--r-- | src/mongo/db/s/session_catalog_migration_source.h | 16 | ||||
-rw-r--r-- | src/mongo/db/s/session_catalog_migration_source_test.cpp | 30 | ||||
-rw-r--r-- | src/mongo/dbtests/documentsourcetests.cpp | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/query_stage_multiplan.cpp | 3 | ||||
-rw-r--r-- | src/mongo/util/clock_source_mock.h | 2 |
9 files changed, 90 insertions, 107 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 68bf76f3478..6abe8ceba72 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1509,7 +1509,7 @@ public: invariant(coll); exec = uassertStatusOK( - getExecutor(opCtx, coll, std::move(cq), PlanExecutor::YIELD_AUTO)); + getExecutor(opCtx, coll, std::move(cq), PlanExecutor::YIELD_AUTO, 0)); } // Make sure the PlanExecutor is destroyed while holding the necessary locks. diff --git a/src/mongo/db/logical_clock_test.cpp b/src/mongo/db/logical_clock_test.cpp index 4dd64809a86..0db83d6dbee 100644 --- a/src/mongo/db/logical_clock_test.cpp +++ b/src/mongo/db/logical_clock_test.cpp @@ -45,7 +45,7 @@ namespace mongo { namespace { -std::string kDummyNamespaceString = "test.foo"; +const NamespaceString kDummyNamespaceString("test", "foo"); using LogicalClockTest = LogicalClockTestFixture; @@ -139,7 +139,7 @@ TEST_F(LogicalClockTest, WritesToOplogAdvanceClusterTime) { getClock()->setClusterTimeFromTrustedSource(initialTime); ASSERT_TRUE(getClock()->getClusterTime() == initialTime); - getDBClient()->insert(kDummyNamespaceString, BSON("x" << 1)); + getDBClient()->insert(kDummyNamespaceString.ns(), BSON("x" << 1)); ASSERT_TRUE(getClock()->getClusterTime() > initialTime); ASSERT_EQ(getClock()->getClusterTime().asTimestamp(), replicationCoordinator()->getMyLastAppliedOpTime().getTimestamp()); @@ -164,7 +164,7 @@ TEST_F(LogicalClockTest, WallClockSetTooFarInPast) { // If cluster time is either uninitialized or even farther in the past, a write would set // cluster time more than maxAcceptableLogicalClockDriftSecs in the past. - getDBClient()->insert(kDummyNamespaceString, BSON("x" << 1)); + getDBClient()->insert(kDummyNamespaceString.ns(), BSON("x" << 1)); ASSERT_TRUE( getClock()->getClusterTime() < LogicalTime(Timestamp(currentSecs - LogicalClock::kMaxAcceptableLogicalClockDriftSecs, 0))); @@ -195,7 +195,7 @@ TEST_F(LogicalClockTest, WallClockSetTooFarInFuture) { // A write gets through and advances cluster time more than maxAcceptableLogicalClockDriftSecs // in the future. - getDBClient()->insert(kDummyNamespaceString, BSON("x" << 1)); + getDBClient()->insert(kDummyNamespaceString.ns(), BSON("x" << 1)); ASSERT_TRUE( getClock()->getClusterTime() > LogicalTime(Timestamp(currentSecs + LogicalClock::kMaxAcceptableLogicalClockDriftSecs, 0))); @@ -228,65 +228,65 @@ TEST_F(LogicalClockTest, ReserveTicksBehaviorAroundMaxTime) { // Can always advance to the max value for the inc field. resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal - 1, maxVal - 1)); getClock()->reserveTicks(1); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal - 1, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal - 1, maxVal)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal - 1, maxVal - 5)); getClock()->reserveTicks(5); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal - 1, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal - 1, maxVal)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(0, maxVal - 1)); getClock()->reserveTicks(1); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(0, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(0, maxVal)); // Can overflow inc into seconds to reach max seconds value. resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal - 1, maxVal)); getClock()->reserveTicks(1); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, 1)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, 1)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal - 1, maxVal - 5)); getClock()->reserveTicks(10); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, 10)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, 10)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal - 1, 1)); getClock()->reserveTicks(maxVal); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal)); // Can advance inc field when seconds field is at the max value. resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, 1)); getClock()->reserveTicks(1); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, 2)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, 2)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, 1)); getClock()->reserveTicks(100); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, 101)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, 101)); // Can advance to the max value for both the inc and seconds fields. resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, maxVal - 1)); getClock()->reserveTicks(1); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, maxVal - 5)); getClock()->reserveTicks(5); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal)); // Verify scenarios where the clock cannot be advanced. // Can't overflow inc into seconds when seconds field is at the max value. resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, maxVal)); ASSERT_THROWS(getClock()->reserveTicks(1), std::exception); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, maxVal)); ASSERT_THROWS(getClock()->reserveTicks(5), std::exception); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, maxVal - 1)); ASSERT_THROWS(getClock()->reserveTicks(2), std::exception); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal - 1)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal - 1)); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(maxVal, maxVal - 11)); ASSERT_THROWS(getClock()->reserveTicks(12), std::exception); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, maxVal - 11)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, maxVal - 11)); } // Verify behavior of advancing cluster time when the wall clock is near the max allowed value. @@ -298,14 +298,14 @@ TEST_F(LogicalClockTest, ReserveTicksBehaviorWhenWallClockNearMaxTime) { resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(1, 1)); getClock()->reserveTicks(1); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(maxVal, 1)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(maxVal, 1)); // Should fail when wall clock would advance cluster time beyond the max allowed time. setMockClockSourceTime(Date_t::max()); resetClock()->setClusterTimeFromTrustedSource(buildLogicalTime(1, 1)); ASSERT_THROWS(getClock()->reserveTicks(1), std::exception); - ASSERT_TRUE(getClock()->getClusterTime() == buildLogicalTime(1, 1)); + ASSERT_EQ(getClock()->getClusterTime(), buildLogicalTime(1, 1)); } // Verify the clock rejects cluster times greater than the max allowed time. diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp index 05436465040..b12c13b2a05 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp @@ -207,8 +207,8 @@ Status MigrationChunkClonerSourceLegacy::startClone(OperationContext* opCtx) { auto const replCoord = repl::ReplicationCoordinator::get(opCtx); if (replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet) { - _sessionCatalogSource = stdx::make_unique<SessionCatalogMigrationSource>(_args.getNss()); - _sessionCatalogSource->init(opCtx); + _sessionCatalogSource = + stdx::make_unique<SessionCatalogMigrationSource>(opCtx, _args.getNss()); // Prime up the session migration source if there are oplog entries to migrate. _sessionCatalogSource->fetchNextOplog(opCtx); diff --git a/src/mongo/db/s/session_catalog_migration_source.cpp b/src/mongo/db/s/session_catalog_migration_source.cpp index 5328f0ac30e..9ca38970dc7 100644 --- a/src/mongo/db/s/session_catalog_migration_source.cpp +++ b/src/mongo/db/s/session_catalog_migration_source.cpp @@ -110,10 +110,52 @@ repl::OplogEntry makeSentinelOplogEntry(OperationSessionInfo sessionInfo) { kIncompleteHistoryStmtId); // statement id } -} // unnamed namespace +} // namespace -SessionCatalogMigrationSource::SessionCatalogMigrationSource(NamespaceString ns) - : _ns(std::move(ns)) {} +SessionCatalogMigrationSource::SessionCatalogMigrationSource(OperationContext* opCtx, + NamespaceString ns) + : _ns(std::move(ns)), + _rollbackIdAtInit( + uassertStatusOK(repl::ReplicationProcess::get(opCtx)->getRollbackID(opCtx))) { + // Sort is not needed for correctness. This is just for making it easier to write deterministic + // tests. + Query query; + query.sort(BSON("_id" << 1)); + + DBDirectClient client(opCtx); + auto cursor = client.query(NamespaceString::kSessionTransactionsTableNamespace.ns(), query); + + while (cursor->more()) { + auto nextSession = SessionTxnRecord::parse( + IDLParserErrorContext("Session migration cloning"), cursor->next()); + if (!nextSession.getLastWriteOpTime().isNull()) { + _sessionOplogIterators.push_back( + stdx::make_unique<SessionOplogIterator>(std::move(nextSession), _rollbackIdAtInit)); + } + } + + { + AutoGetCollection autoColl(opCtx, NamespaceString::kRsOplogNamespace, MODE_IX); + writeConflictRetry( + opCtx, + "session migration initialization majority commit barrier", + NamespaceString::kRsOplogNamespace.ns(), + [&] { + const auto message = BSON("sessionMigrateCloneStart" << _ns.ns()); + + WriteUnitOfWork wuow(opCtx); + opCtx->getClient()->getServiceContext()->getOpObserver()->onInternalOpMessage( + opCtx, _ns, {}, {}, message); + wuow.commit(); + }); + } + + auto opTimeToWait = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); + WriteConcernResult result; + WriteConcernOptions majority( + WriteConcernOptions::kMajority, WriteConcernOptions::SyncMode::UNSET, 0); + uassertStatusOK(waitForWriteConcern(opCtx, opTimeToWait, majority, &result)); +} bool SessionCatalogMigrationSource::hasMoreOplog() { return _hasMoreOplogFromSessionCatalog() || _hasNewWrites(); @@ -188,7 +230,6 @@ repl::OplogEntry SessionCatalogMigrationSource::_getLastFetchedOplogFromSessionC bool SessionCatalogMigrationSource::_fetchNextOplogFromSessionCatalog(OperationContext* opCtx) { stdx::unique_lock<stdx::mutex> lk(_sessionCloneMutex); - invariant(_alreadyInitialized); if (!_lastFetchedOplogBuffer.empty()) { _lastFetchedOplog = _lastFetchedOplogBuffer.back(); _lastFetchedOplogBuffer.pop_back(); @@ -230,7 +271,6 @@ bool SessionCatalogMigrationSource::_fetchNextNewWriteOplog(OperationContext* op { stdx::lock_guard<stdx::mutex> lk(_newOplogMutex); - invariant(_alreadyInitialized); if (_newWriteOpTimeList.empty()) { _lastFetchedNewWriteOplog.reset(); return false; @@ -262,54 +302,6 @@ void SessionCatalogMigrationSource::notifyNewWriteOpTime(repl::OpTime opTime) { _newWriteOpTimeList.push_back(opTime); } -void SessionCatalogMigrationSource::init(OperationContext* opCtx) { - invariant(!_alreadyInitialized); - - _rollbackIdAtInit = uassertStatusOK(repl::ReplicationProcess::get(opCtx)->getRollbackID(opCtx)); - - DBDirectClient client(opCtx); - Query query; - // Sort is not needed for correctness. This is just for making it easier to write deterministic - // tests. - query.sort(BSON("_id" << 1)); - auto cursor = client.query(NamespaceString::kSessionTransactionsTableNamespace.ns(), query); - - std::vector<std::unique_ptr<SessionOplogIterator>> sessionOplogIterators; - while (cursor->more()) { - auto nextSession = SessionTxnRecord::parse( - IDLParserErrorContext("Session migration cloning"), cursor->next()); - if (!nextSession.getLastWriteOpTime().isNull()) { - sessionOplogIterators.push_back( - stdx::make_unique<SessionOplogIterator>(std::move(nextSession), _rollbackIdAtInit)); - } - } - - { - auto message = BSON("sessionMigrateCloneStart" << _ns.ns()); - AutoGetCollection autoColl(opCtx, NamespaceString::kRsOplogNamespace, MODE_IX); - writeConflictRetry( - opCtx, - "session migration initialization majority commit barrier", - NamespaceString::kRsOplogNamespace.ns(), - [&] { - WriteUnitOfWork wuow(opCtx); - opCtx->getClient()->getServiceContext()->getOpObserver()->onInternalOpMessage( - opCtx, _ns, {}, {}, message); - wuow.commit(); - }); - } - - auto opTimeToWait = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); - WriteConcernResult result; - WriteConcernOptions majority( - WriteConcernOptions::kMajority, WriteConcernOptions::SyncMode::UNSET, 0); - uassertStatusOK(waitForWriteConcern(opCtx, opTimeToWait, majority, &result)); - - stdx::lock_guard<stdx::mutex> lk(_sessionCloneMutex); - _alreadyInitialized = true; - _sessionOplogIterators.swap(sessionOplogIterators); -} - SessionCatalogMigrationSource::SessionOplogIterator::SessionOplogIterator( SessionTxnRecord txnRecord, int expectedRollbackId) : _record(std::move(txnRecord)), _initialRollbackId(expectedRollbackId) { diff --git a/src/mongo/db/s/session_catalog_migration_source.h b/src/mongo/db/s/session_catalog_migration_source.h index 2e5faf393c2..75d7a0073f1 100644 --- a/src/mongo/db/s/session_catalog_migration_source.h +++ b/src/mongo/db/s/session_catalog_migration_source.h @@ -83,9 +83,7 @@ public: bool shouldWaitForMajority = false; }; - explicit SessionCatalogMigrationSource(NamespaceString ns); - - void init(OperationContext* opCtx); + SessionCatalogMigrationSource(OperationContext* opCtx, NamespaceString ns); /** * Returns true if there are more oplog entries to fetch at this moment. Note that new writes @@ -190,14 +188,16 @@ private: */ repl::OplogEntry _getLastFetchedNewWriteOplog(); + // Namespace for which the migration is happening const NamespaceString _ns; - // Protects _alreadyInitialized, _sessionCatalogCursor, _sessionOplogIterators - // _currentOplogIterator, _lastFetchedOplogBuffer, _lastFetchedOplog - stdx::mutex _sessionCloneMutex; - bool _alreadyInitialized = false; + // The rollback id just before migration started. This value is needed so that step-down + // followed by step-up situations can be discovered. + const int _rollbackIdAtInit; - int _rollbackIdAtInit = 0; + // Protects _sessionCatalogCursor, _sessionOplogIterators, _currentOplogIterator, + // _lastFetchedOplogBuffer, _lastFetchedOplog + stdx::mutex _sessionCloneMutex; // List of remaining session records that needs to be cloned. std::vector<std::unique_ptr<SessionOplogIterator>> _sessionOplogIterators; diff --git a/src/mongo/db/s/session_catalog_migration_source_test.cpp b/src/mongo/db/s/session_catalog_migration_source_test.cpp index 4b8c7ad3bdf..74f87bbba25 100644 --- a/src/mongo/db/s/session_catalog_migration_source_test.cpp +++ b/src/mongo/db/s/session_catalog_migration_source_test.cpp @@ -101,8 +101,7 @@ repl::OplogEntry makeOplogEntry(repl::OpTime opTime, } TEST_F(SessionCatalogMigrationSourceTest, NoSessionsToTransferShouldNotHaveOplog) { - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_FALSE(migrationSource.fetchNextOplog(opCtx())); ASSERT_FALSE(migrationSource.hasMoreOplog()); } @@ -137,8 +136,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithTwoWrites) { DBDirectClient client(opCtx()); client.insert(NamespaceString::kSessionTransactionsTableNamespace.ns(), sessionRecord.toBSON()); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); { @@ -223,8 +221,7 @@ TEST_F(SessionCatalogMigrationSourceTest, TwoSessionWithTwoWrites) { insertOplogEntry(entry1b); insertOplogEntry(entry2b); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); auto checkNextBatch = [this, &migrationSource](const repl::OplogEntry& firstExpectedOplog, @@ -320,8 +317,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OneSessionWithFindAndModifyPreImageAnd DBDirectClient client(opCtx()); client.insert(NamespaceString::kSessionTransactionsTableNamespace.ns(), sessionRecord.toBSON()); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); auto expectedSequece = {entry3, entry4, entry1, entry2}; @@ -382,8 +378,7 @@ TEST_F(SessionCatalogMigrationSourceTest, OplogWithOtherNsShouldBeIgnored) { client.insert(NamespaceString::kSessionTransactionsTableNamespace.ns(), sessionRecord2.toBSON()); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); ASSERT_TRUE(migrationSource.hasMoreOplog()); @@ -438,8 +433,7 @@ TEST_F(SessionCatalogMigrationSourceTest, SessionDumpWithMultipleNewWrites) { repl::OpTime(Timestamp(0, 0), 0)); // optime of previous write within same transaction insertOplogEntry(entry3); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); migrationSource.notifyNewWriteOpTime(entry2.getOpTime()); @@ -474,8 +468,7 @@ TEST_F(SessionCatalogMigrationSourceTest, SessionDumpWithMultipleNewWrites) { } TEST_F(SessionCatalogMigrationSourceTest, ShouldAssertIfOplogCannotBeFound) { - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_FALSE(migrationSource.fetchNextOplog(opCtx())); migrationSource.notifyNewWriteOpTime(repl::OpTime(Timestamp(100, 3), 1)); @@ -484,8 +477,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ShouldAssertIfOplogCannotBeFound) { } TEST_F(SessionCatalogMigrationSourceTest, ShouldBeAbleInsertNewWritesAfterBufferWasDepleted) { - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_FALSE(migrationSource.fetchNextOplog(opCtx())); { @@ -581,8 +573,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ReturnsDeadEndSentinelForIncompleteHis DBDirectClient client(opCtx()); client.insert(NamespaceString::kSessionTransactionsTableNamespace.ns(), sessionRecord.toBSON()); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); { @@ -638,8 +629,7 @@ TEST_F(SessionCatalogMigrationSourceTest, ShouldAssertWhenRollbackDetected) { DBDirectClient client(opCtx()); client.insert(NamespaceString::kSessionTransactionsTableNamespace.ns(), sessionRecord.toBSON()); - SessionCatalogMigrationSource migrationSource(kNs); - migrationSource.init(opCtx()); + SessionCatalogMigrationSource migrationSource(opCtx(), kNs); ASSERT_TRUE(migrationSource.fetchNextOplog(opCtx())); { diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp index 69f03245f37..97ddc5057df 100644 --- a/src/mongo/dbtests/documentsourcetests.cpp +++ b/src/mongo/dbtests/documentsourcetests.cpp @@ -95,7 +95,7 @@ protected: auto cq = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(qr))); auto exec = uassertStatusOK( - getExecutor(opCtx(), ctx.getCollection(), std::move(cq), PlanExecutor::NO_YIELD)); + getExecutor(opCtx(), ctx.getCollection(), std::move(cq), PlanExecutor::NO_YIELD, 0)); exec->saveState(); _source = DocumentSourceCursor::create(ctx.getCollection(), std::move(exec), _ctx); diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp index a76b67ac9d0..4a48984871a 100644 --- a/src/mongo/dbtests/query_stage_multiplan.cpp +++ b/src/mongo/dbtests/query_stage_multiplan.cpp @@ -405,7 +405,8 @@ TEST_F(QueryStageMultiPlanTest, MPSSummaryStats) { auto qr = stdx::make_unique<QueryRequest>(nss); qr->setFilter(BSON("foo" << BSON("$gte" << 0))); auto cq = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(qr))); - auto exec = uassertStatusOK(getExecutor(opCtx(), coll, std::move(cq), PlanExecutor::NO_YIELD)); + auto exec = + uassertStatusOK(getExecutor(opCtx(), coll, std::move(cq), PlanExecutor::NO_YIELD, 0)); ASSERT_EQ(exec->getRootStage()->stageType(), STAGE_MULTI_PLAN); ASSERT_OK(exec->executePlan()); diff --git a/src/mongo/util/clock_source_mock.h b/src/mongo/util/clock_source_mock.h index 1ee245709ea..d6666aedefe 100644 --- a/src/mongo/util/clock_source_mock.h +++ b/src/mongo/util/clock_source_mock.h @@ -69,7 +69,7 @@ private: void _processAlarms(stdx::unique_lock<stdx::mutex> lk); stdx::mutex _mutex; - Date_t _now; + Date_t _now{Date_t::fromMillisSinceEpoch(1)}; std::vector<Alarm> _alarms; }; |