diff options
Diffstat (limited to 'src/mongo/db/query/collection_query_info.cpp')
| -rw-r--r-- | src/mongo/db/query/collection_query_info.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mongo/db/query/collection_query_info.cpp b/src/mongo/db/query/collection_query_info.cpp index ff4e430f6a1..e624389b642 100644 --- a/src/mongo/db/query/collection_query_info.cpp +++ b/src/mongo/db/query/collection_query_info.cpp @@ -90,13 +90,12 @@ CollectionQueryInfo::PlanCacheState::PlanCacheState(OperationContext* opCtx, // TODO We shouldn't need to include unfinished indexes, but we must here because the index // catalog may be in an inconsistent state. SERVER-18346. - auto ii = collection->getIndexCatalog()->getIndexIterator( - opCtx, IndexCatalog::InclusionPolicy::kReady | IndexCatalog::InclusionPolicy::kUnfinished); + const bool includeUnfinishedIndexes = true; + std::unique_ptr<IndexCatalog::IndexIterator> ii = + collection->getIndexCatalog()->getIndexIterator(opCtx, includeUnfinishedIndexes); while (ii->more()) { const IndexCatalogEntry* ice = ii->next(); - if (ice->accessMethod()) { - indexCores.emplace_back(indexInfoFromIndexCatalogEntry(*ice)); - } + indexCores.emplace_back(indexInfoFromIndexCatalogEntry(*ice)); } planCacheIndexabilityState.updateDiscriminators(indexCores); @@ -118,8 +117,8 @@ const UpdateIndexData& CollectionQueryInfo::getIndexKeys(OperationContext* opCtx void CollectionQueryInfo::computeIndexKeys(OperationContext* opCtx, const CollectionPtr& coll) { _indexedPaths.clear(); - auto it = coll->getIndexCatalog()->getIndexIterator( - opCtx, IndexCatalog::InclusionPolicy::kReady | IndexCatalog::InclusionPolicy::kUnfinished); + std::unique_ptr<IndexCatalog::IndexIterator> it = + coll->getIndexCatalog()->getIndexIterator(opCtx, true); while (it->more()) { const IndexCatalogEntry* entry = it->next(); const IndexDescriptor* descriptor = entry->descriptor(); @@ -176,10 +175,10 @@ void CollectionQueryInfo::computeIndexKeys(OperationContext* opCtx, const Collec // handle partial indexes const MatchExpression* filter = entry->getFilterExpression(); if (filter) { - RelevantFieldIndexMap paths; + stdx::unordered_set<std::string> paths; QueryPlannerIXSelect::getFields(filter, &paths); for (auto it = paths.begin(); it != paths.end(); ++it) { - _indexedPaths.addPath(FieldRef(it->first)); + _indexedPaths.addPath(FieldRef(*it)); } } } @@ -239,8 +238,9 @@ void CollectionQueryInfo::updatePlanCacheIndexEntries(OperationContext* opCtx, } void CollectionQueryInfo::init(OperationContext* opCtx, const CollectionPtr& coll) { - auto ii = - coll->getIndexCatalog()->getIndexIterator(opCtx, IndexCatalog::InclusionPolicy::kReady); + const bool includeUnfinishedIndexes = false; + std::unique_ptr<IndexCatalog::IndexIterator> ii = + coll->getIndexCatalog()->getIndexIterator(opCtx, includeUnfinishedIndexes); while (ii->more()) { const IndexDescriptor* desc = ii->next()->descriptor(); CollectionIndexUsageTrackerDecoration::get(coll->getSharedDecorations()) |
