diff options
author | Ian Boros <ian.boros@10gen.com> | 2018-05-14 18:47:40 -0400 |
---|---|---|
committer | Ian Boros <ian.boros@10gen.com> | 2018-06-14 11:24:23 -0400 |
commit | 2a66542157d5eac9ad43c749f3531bd57097cd26 (patch) | |
tree | d553675b5e69d3baca258c630c892e1f254e4c4f /src/mongo/db/exec/subplan.cpp | |
parent | 208deb2a3652b5c055b988d4585aef4c98e0c4af (diff) | |
download | mongo-2a66542157d5eac9ad43c749f3531bd57097cd26.tar.gz |
SERVER-32452 add ability for plan cache entries to be inactive
Diffstat (limited to 'src/mongo/db/exec/subplan.cpp')
-rw-r--r-- | src/mongo/db/exec/subplan.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index 36526c713a7..532dea64044 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -133,17 +133,13 @@ Status SubplanStage::planSubqueries() { // Plan the i-th child. We might be able to find a plan for the i-th child in the plan // cache. If there's no cached plan, then we generate and rank plans using the MPS. - CachedSolution* rawCS; - if (PlanCache::shouldCacheQuery(*branchResult->canonicalQuery) && - _collection->infoCache() - ->getPlanCache() - ->get(*branchResult->canonicalQuery, &rawCS) - .isOK()) { + const auto* planCache = _collection->infoCache()->getPlanCache(); + if (auto cachedSol = planCache->getCacheEntryIfCacheable(*branchResult->canonicalQuery)) { // We have a CachedSolution. Store it for later. LOG(5) << "Subplanner: cached plan found for child " << i << " of " << _orExpression->numChildren(); - branchResult->cachedSolution.reset(rawCS); + branchResult->cachedSolution = std::move(cachedSol); } else { // No CachedSolution found. We'll have to plan from scratch. LOG(5) << "Subplanner: planning child " << i << " of " << _orExpression->numChildren(); |