summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorRui Liu <rui.liu@mongodb.com>2022-06-22 09:52:36 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-22 10:42:32 +0000
commit2c2d85e73d0620d779544ce67218db171c154e8b (patch)
treec6172fde4fb0500c2254ceaf9cd92ac14c8b128d /src/mongo/db/pipeline
parentad2b9ae23ad19f871f2033dc338c96ad9aa8d161 (diff)
downloadmongo-2c2d85e73d0620d779544ce67218db171c154e8b.tar.gz
SERVER-64432 Integrate SBE plan cache for $lookup
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.cpp20
-rw-r--r--src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp3
2 files changed, 15 insertions, 8 deletions
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp
index b98af917d99..c992288a0e4 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_cursor.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/pipeline/document_source_cursor.h"
#include "mongo/db/catalog/collection.h"
+#include "mongo/db/db_raii.h"
#include "mongo/db/exec/document_value/document.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/query/collection_query_info.h"
@@ -225,15 +226,20 @@ Value DocumentSourceCursor::serialize(boost::optional<ExplainOptions::Verbosity>
{
auto opCtx = pExpCtx->opCtx;
- auto lockMode = getLockModeForQuery(opCtx, _exec->nss());
- AutoGetDb dbLock(opCtx, _exec->nss().db(), lockMode);
- Lock::CollectionLock collLock(opCtx, _exec->nss(), lockMode);
- auto collection = dbLock.getDb()
- ? CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, _exec->nss())
- : nullptr;
+ auto secondaryNssList = _exec->getSecondaryNamespaces();
+ AutoGetCollectionForReadMaybeLockFree readLock(opCtx,
+ _exec->nss(),
+ AutoGetCollectionViewMode::kViewsForbidden,
+ Date_t::max(),
+ secondaryNssList);
+ MultipleCollectionAccessor collections(opCtx,
+ &readLock.getCollection(),
+ readLock.getNss(),
+ readLock.isAnySecondaryNamespaceAViewOrSharded(),
+ secondaryNssList);
Explain::explainStages(_exec.get(),
- collection,
+ collections,
verbosity.get(),
_execStatus,
_winningPlanTrialStats,
diff --git a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
index e0ac0211ef2..2fecb18bebe 100644
--- a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
@@ -559,7 +559,8 @@ std::vector<BSONObj> CommonMongodProcessInterface::getMatchingPlanCacheEntryStat
collVersion = collQueryInfo.getPlanCacheInvalidatorVersion()](
const sbe::PlanCacheKey& key) {
// Only fetch plan cache entries with keys matching given UUID and collectionVersion.
- return uuid == key.getCollectionUuid() && collVersion == key.getCollectionVersion();
+ return uuid == key.getMainCollectionState().uuid &&
+ collVersion == key.getMainCollectionState().version;
};
auto planCacheEntriesSBE =