summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorIrina Yatsenko <irina.yatsenko@mongodb.com>2022-02-17 22:16:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-22 19:04:09 +0000
commit71c8da65b7750ed851facae85a1ced4dccb02075 (patch)
treee8ee430d6c106913d6c9e04ef35bc97bdf9ab4ac /src/mongo/db/query
parentf85c5ef236d2f7cf5da11555ae25519422f87cb1 (diff)
downloadmongo-71c8da65b7750ed851facae85a1ced4dccb02075.tar.gz
SERVER-63769 Remove the temporary unsafe code for index selection when lowering into SBE
(cherry picked from commit ac1b73c3f674d41b412489e57d30b942d405f5b0)
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/planner_analysis.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mongo/db/query/planner_analysis.cpp b/src/mongo/db/query/planner_analysis.cpp
index 3989188faa7..dc347cdbe7b 100644
--- a/src/mongo/db/query/planner_analysis.cpp
+++ b/src/mongo/db/query/planner_analysis.cpp
@@ -627,11 +627,11 @@ void QueryPlannerAnalysis::determineLookupStrategy(
// Does an eligible index exist?
// TODO SERVER-62913: finalize the logic for indexes analysis.
const auto& foreignField = eqLookupNode->joinFieldForeign;
- IndexEntry* prefixedIndex = nullptr;
- for (auto idxEntry : foreignCollItr->second.indexes) {
+ bool foundEligibleIndex = false;
+ for (const IndexEntry& idxEntry : foreignCollItr->second.indexes) {
tassert(5842601, "index key pattern should not be empty", !idxEntry.keyPattern.isEmpty());
if (idxEntry.keyPattern.firstElement().fieldName() == foreignField) {
- prefixedIndex = &idxEntry;
+ foundEligibleIndex = true;
break;
}
}
@@ -640,9 +640,8 @@ void QueryPlannerAnalysis::determineLookupStrategy(
// number of records and the storage size of the collection.
static constexpr auto kMaxHashJoinCollectionSize = 100 * 1024 * 1024;
- if (prefixedIndex) {
+ if (foundEligibleIndex) {
eqLookupNode->lookupStrategy = EqLookupNode::LookupStrategy::kIndexedLoopJoin;
- eqLookupNode->idxEntry = *prefixedIndex;
} else if (allowDiskUse &&
foreignCollItr->second.approximateCollectionSizeBytes < kMaxHashJoinCollectionSize) {
eqLookupNode->lookupStrategy = EqLookupNode::LookupStrategy::kHashJoin;