diff options
author | Mickey. J Winters <mickey.winters@mongodb.com> | 2023-04-04 14:41:34 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-04-04 15:16:59 +0000 |
commit | 4c5acba22fc2d30e2d0cd64beed1b5225b81789d (patch) | |
tree | b6ed9ef7b2a23166abbf445a5a701dc22cfe309a /src/mongo | |
parent | cb71fd5563fa51c8505bf28d9376e24d069eb72f (diff) | |
download | mongo-4c5acba22fc2d30e2d0cd64beed1b5225b81789d.tar.gz |
Revert "SERVER-73053 TransactionHistoryIterator queries change collections if its for a serverless change stream"
This reverts commit 11f7a63fcd931ccd1834a1b5131dcdaeee8b626a.
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/transaction/transaction_history_iterator.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/mongo/db/transaction/transaction_history_iterator.cpp b/src/mongo/db/transaction/transaction_history_iterator.cpp index 32bdcae0440..815d3a9100b 100644 --- a/src/mongo/db/transaction/transaction_history_iterator.cpp +++ b/src/mongo/db/transaction/transaction_history_iterator.cpp @@ -45,20 +45,16 @@ namespace mongo { namespace { /** - * Finds the oplog entry with the given timestamp in the oplog, or in the tenant's change collection - * if this is being used in a serverless context. + * Query the oplog for an entry with the given timestamp. */ BSONObj findOneOplogEntry(OperationContext* opCtx, const repl::OpTime& opTime, bool permitYield, bool prevOpOnly = false) { - auto tenantId = CurOp::get(opCtx)->getNSS().tenantId(); BSONObj oplogBSON; invariant(!opTime.isNull()); - NamespaceString nss = tenantId ? NamespaceString::makeChangeCollectionNSS(tenantId) - : NamespaceString::kRsOplogNamespace; - auto findCommand = std::make_unique<FindCommandRequest>(nss); + auto findCommand = std::make_unique<FindCommandRequest>(NamespaceString::kRsOplogNamespace); findCommand->setFilter(opTime.asQuery()); if (prevOpOnly) { @@ -79,29 +75,22 @@ BSONObj findOneOplogEntry(OperationContext* opCtx, << causedBy(statusWithCQ.getStatus())); std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); - boost::optional<AutoGetOplog> oplogRead; - boost::optional<AutoGetChangeCollection> changeCollectionRead; - const CollectionPtr* collPtr; - if (tenantId) { - changeCollectionRead.emplace(opCtx, AutoGetChangeCollection::AccessMode::kRead, tenantId); - collPtr = &**changeCollectionRead; - } else { - oplogRead.emplace(opCtx, OplogAccessMode::kRead); - collPtr = &oplogRead->getCollection(); - } - - const auto dbName = nss.dbName(); + AutoGetOplog oplogRead(opCtx, OplogAccessMode::kRead); + const DatabaseName dbName(DatabaseName::kLocal); const auto localDb = DatabaseHolder::get(opCtx)->getDb(opCtx, dbName); invariant(localDb); AutoStatsTracker statsTracker(opCtx, - nss, + NamespaceString::kRsOplogNamespace, Top::LockType::ReadLocked, AutoStatsTracker::LogMode::kUpdateTop, CollectionCatalog::get(opCtx)->getDatabaseProfileLevel(dbName), Date_t::max()); - auto exec = uassertStatusOK(getExecutorFind( - opCtx, collPtr, std::move(cq), nullptr /*extractAndAttachPipelineStages */, permitYield)); + auto exec = uassertStatusOK(getExecutorFind(opCtx, + &oplogRead.getCollection(), + std::move(cq), + nullptr /*extractAndAttachPipelineStages */, + permitYield)); PlanExecutor::ExecState getNextResult; try { |